Open jjiangkm opened 7 years ago
打下面的补丁以后可以用:
import {StyleSheet} from 'react-web'
import { Linking } from 'react-navigation/lib/PlatformHelpers'
Linking.getInitialURL = () => {
return new Promise(resolve => {
resolve('')
})
}
StyleSheet.absoluteFill = StyleSheet.create({
position: 'absolute',
left: 0,
right: 0,
top: 0,
bottom: 0
})
注意 import
时一定加上 .js
后缀,否则会导入 react-navigation.web.js
,这个没有实现完整:
import {
StackNavigator,
TabNavigator
} from 'react-navigation/lib/react-navigation.js'
打补丁怎么打
index.ios.js:
import './patch.js'
require('./src') // 用 require 保证在 import patch 之后运行
patch.js
import {StyleSheet} from 'react-web'
import { Linking } from 'react-navigation/lib/PlatformHelpers'
Linking.getInitialURL = () => {
return new Promise(resolve => {
resolve('')
})
}
StyleSheet.absoluteFill = StyleSheet.create({
position: 'absolute',
left: 0,
right: 0,
top: 0,
bottom: 0
})
src/index.js
import { AppRegistry } from 'react-native'
import {
StackNavigator,
TabNavigator
} from 'react-navigation/lib/react-navigation.js'
// 你的 react native 程序代码...
AppRegistry.registerComponent('...', () => ...)
目测只有这行代码有用
我打了补丁没有用啊
我也不能用
新版本的reactnative推荐使用reactnavigation,打开后提示