私はチュートリアルに完全に従いましたhttps://reactnavigation.org/docs/intro/ しかし、ヘッダーは表示されません。私はボタンをクリックしたときに ここで、ここでのコードと結果反応ナビゲーションの動的ヘッダーが機能しません。
import Expo from 'expo';
import React from 'react';
import { StyleSheet, Text, View, Button } from 'react-native';
import {StackNavigator} from 'react-navigation';
class HomeScreen extends React.Component {
static navigationOptions = {
title: 'Welcome',
}
render() {
const {navigate} = this.props.navigation;
return (
<View style={styles.container}>
<Text>Open up main.js to start working on your app!</Text>
<Button onPress={()=>navigate('Chat',{user:'Lucy'})} title = 'Chat with Lucy'></Button>
</View>
);
}
}
class ChatScreen extends React.Component {
// Nav options can be defined as a function of the screen's props:
static navigationOptions = ({ navigation }) => ({
title: `Chat with ${navigation.state.params.user}`,
});
render() {
// The screen's current route is passed in to `props.navigation.state`:
const { params } = this.props.navigation.state;
return (
<View>
<Text>Chat with {params.user}</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
const SimpleApp = StackNavigator({
Home: {screen: HomeScreen},
Chat: {screen: ChatScreen}
})
Expo.registerRootComponent(SimpleApp);
別の問題である私は
static navigationOptions = {
title: 'Chat with Lucy',
};
次に使う場合に、 「ウェルカム」はまだチュートリアルとは異なるマーク「<」の横にあります。
私は週の残りのために本当に忙しいんだけど、私はに戻ってポップしようとするでしょうここで私は自由な時間を得る。同様の問題を抱えた2つの質問があるので、私はそれが反応、反応ネイティブ、反応ナビゲーションのバージョンと関係している可能性があるので、使用しているものを投稿できますか?そうすれば、あなたの状況を正確に再現できます。 –