我有以下几点:
import React from 'react';
import { StyleSheet, Text, View, Button } from 'react-native';
import { StackNavigator } from 'react-navigation';
class HomeScreen extends React.Component {
render() {
const { navigate } = this.props.navigation;
return (
<View>
<Text>Hello, Chat App!</Text>
<Button
onPress={() => navigate('Chat')}
title="Chat with Lucy"
/>
</View>
);
}
}
class ChatScreen extends React.Component {
render() {
return (
<View>
<Text>Chat with Lucy</Text>
</View>
);
}
}
const SimpleApp = StackNavigator({
Home: {
screen: HomeScreen,
navigationOptions: {
title: 'Home'
},
},
Chat: {
screen: ChatScreen,
navigationOptions: {
title: 'Chat with Lucy'
}
},
});
export default class App extends React.Component {
render() {
return <SimpleApp />;
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center'
}
});
上HomeScreen
有一个头,现在看起来是这样的:
如何隐藏此标题?我只想要一个空白屏幕,或者在这种情况下,只<Text>Hello, Chat App!</Text>
需要显示?