React Native Navigation that supports seamless navigation between Native and React.
支持 WindowInsets API
建议使用 react-native-keyboard-insets 来处理键盘相关。
建议使用 react-native-safe-area-context 来规避系统 UI 的遮挡。
添加 statusBarHeight()
、toolbarHeight()
、topBarHeight()
几个方法用来获取状态栏、工具栏、顶部栏的高度
import { statusBarHeight, toolbarHeight, topBarHeight } from 'hybrid-navigation'
标记 Garden
、ReactRegistry
为弃用,使用 Navigation
对象对应的方法代替
import Navigation from 'hybrid-navigation'
import App from './App'
Navigation.registerComponent('App', () => App)
标记 Navigator
中的大部分静态方法为弃用,使用 Navigation
对象对应的方法代替
import Navigation from 'hybrid-navigation'
Navigation.setRoot({})
处理了切换页面时,TextInput 自动获取焦点弹出键盘导致的问题
调整传递给 ReactRegistry.startRegisterComponent
的 HOC 的使用顺序,现在可以通过以下方式全局设置页面特定属性:
ReactRegistry.startRegisterComponent(withNavigationItem({ topBarHidden: true }))
⚠️ 实现 HOC 时,注意传递 props 给被包裹的组件,以及注意复制 navigationItem
这个静态属性,如
export function withRedux(WrappedComponent: ComponentType<any>) {
return class ReduxProvider extends React.Component {
// 注意复制 navigationItem
static navigationItem = (WrappedComponent as any).navigationItem
static displayName = `withRedux(${WrappedComponent.displayName})`
render() {
return (
<Provider store={store}>
// 注意传递 props 属性
<WrappedComponent {...this.props} />
</Provider>
)
}
}
}
添加 Garden#setTabItem
,可以动态修改 tab 图标,标题,徽章。
弃用 Garden#setTabIcon
弃用 Garden#setTabBadge
支持和 react-native-gesture-handler
一起使用
如果需要支持 react-native-gesture-handler, 需要按如下方式修改 AppDelegate.m 文件
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
[[HBDReactBridgeManager get] installWithBridge:bridge];
添加 homeIndicatorAutoHiddenIOS
配置项,仅对页面可设置,可以动态变更,用于隐藏该页面的 Home 指示器