【发布时间】:2018-11-08 10:53:11
【问题描述】:
我在我的应用中使用react-native-router-flux 进行导航。
我想在组件中定义NavBar的右键,而不是在Scene中,我该怎么做?
这是Scene的代码:
<Scene
navBar={PlatformNavbar}
leftElement={ <Text style={{color: Colors.white, marginLeft: 25, fontWeight:'500' }}>Go Back</Text> }
key='nodScreen'
component={NodScreen}
hideNavBar={false}
/>
我正在使用我的自定义navBar,我有渲染左右元素的函数:leftElement、rightElement。
为了在组件中渲染正确的元素,我使用了这段代码,但是它没有渲染任何东西。
componentDidMount() {
Actions.refresh({rightElement: this.renderRightElement
}) }
renderRightElement = () => {
return ( <TouchableOpacity onPress={() => {} }>
<Image style={{height: 24, width: 24, marginRight: 16}} source={{uri: 'score_progress_empty'}} resizeMode='contain'/>
</TouchableOpacity>)
}
【问题讨论】:
标签: react-native react-native-android react-native-router-flux