Skip to content
This repository has been archived by the owner on May 13, 2019. It is now read-only.

react-navigation支持吗 #262

Open
jjiangkm opened this issue Jun 26, 2017 · 6 comments
Open

react-navigation支持吗 #262

jjiangkm opened this issue Jun 26, 2017 · 6 comments

Comments

@jjiangkm
Copy link

jjiangkm commented Jun 26, 2017

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

@cpunion
Copy link

cpunion commented Jun 26, 2017

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

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'

@xiamingyu
Copy link

打补丁怎么打

@cpunion
Copy link

cpunion commented Jul 21, 2017

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

@xiamingyu
Copy link

image
目测只有这行代码有用

@sandofsuro
Copy link

我打了补丁没有用啊

@FattySpring
Copy link

我也不能用

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants