Skip to content

Instantly share code, notes, and snippets.

@vc7
Last active April 17, 2018 09:11
Show Gist options
  • Save vc7/a32a7574783342a2825d9b1259fce47f to your computer and use it in GitHub Desktop.
Save vc7/a32a7574783342a2825d9b1259fce47f to your computer and use it in GitHub Desktop.

範例

Navigator

React Native Navigation

Installation

安裝:

yarn add react-native-navigation@latest

把 react-native-navigation 的 binary 塞進主要專案:

react-native link

注意すべきポイント

  • 需要用到的 Component 一定要註冊 - (cf)
  • iOS Project 中的 AppDelegate 初期一定要改過:
[[RCCManager sharedInstance] initBridgeWithBundleURL:jsCodeLocation launchOptions:launchOptions];

以 Navigation Controller 為起始畫面

Navigation.startSingleScreenApp({
  screen: {
    screen: 'HomeScreen' // 放入註冊 component 時使用的字串
  }
});

Push 最低限實作

this.props.navigator.push({
  screen: "DetailsScreen", // 放入註冊 component 時使用的字串
});

其他參考

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment