react-web icon indicating copy to clipboard operation
react-web copied to clipboard

react-navigation支持吗

Open jjiangkm opened this issue 8 years ago • 6 comments

新版本的reactnative推荐使用reactnavigation,打开后提示 image

jjiangkm avatar Jun 26 '17 08:06 jjiangkm

打下面的补丁以后可以用:

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'

cpunion avatar Jun 26 '17 09:06 cpunion

打补丁怎么打

xiamingyu avatar Jul 21 '17 10:07 xiamingyu

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('...', () => ...)

cpunion avatar Jul 21 '17 13:07 cpunion

image 目测只有这行代码有用

xiamingyu avatar Jul 25 '17 11:07 xiamingyu

我打了补丁没有用啊

sandofsuro avatar Dec 28 '17 03:12 sandofsuro

我也不能用

FattySpring avatar Jan 18 '18 10:01 FattySpring