在头部添加了一个搜索框 ~~~ class HeadScreen extends React.Component{ constructor(props) { super(props); } render(){ return ( <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}> <TouchableOpacity onPress={() => { this.props.navigation.navigate('search'); }}> <Image source={require('./icon/ic_search_black_24dp.png')} style={styles.headAdd} /> </TouchableOpacity> </View> ); } } ~~~ 点击搜索框跳转到搜索组件 ~~~ class SearchScreen extends React.Component{ constructor(props) { super(props); } render(){ return ( <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}> <Text>44444444444444444444444444</Text> </View> ); } } ~~~ 发现不能跳转 只需要在调用时传入`navigation={navigation}`参数即可 ~~~ dynamicStack: { screen: TabScreen, navigationOptions: ({navigation}) => ({ headerStyle:styles.headerBar, headerTintColor:'#fff', headerRight:(<HeadScreen navigation={navigation}></HeadScreen>), }), }, ~~~