/**
- Sample React Native App
- https://github.com/facebook/react-native
- @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
TouchableOpacity,
Button,
} from 'react-native';
import TDemo from './TDemo'
import {StackNavigator} from 'react-navigation';
class Index extends Component {
render() {
var navigate = this.props.navigation.navigate;
return (
<TouchableOpacity style={styles.container}>
<View >
<Text>Hello, Chat App!</Text>
<Button
onPress={() => navigate('TDemo',{user:'用户'})}
title="Chat with Lucy"
/>
</View>
</TouchableOpacity>
);
}
}
Index.navigationOptions={
title:'首页',
};
const SimpleApp = StackNavigator({
Index:{screen:Index},
TDemo:{screen:TDemo}
});
const AppNavigation = () => (
<SimpleApp />
);
export default class App extends React.Component {
render() {
return (
<AppNavigation/>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
});