Skip to content

Commit 19a1457

Browse files
committed
first commit
1 parent 959ceff commit 19a1457

File tree

1 file changed

+57
-57
lines changed

1 file changed

+57
-57
lines changed

README.md

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -18,63 +18,63 @@
1818
- 例子
1919

2020

21-
import React, { Component } from 'react';
22-
import {
23-
AppRegistry,
24-
StyleSheet,
25-
Text,
26-
View,
27-
Platform,
28-
Button
29-
} from 'react-native';
30-
31-
import {StackNavigator} from 'react-navigation';
32-
33-
class HomeScreen extends Component {
34-
static navigationOptions={
35-
title:'Home'
21+
import React, { Component } from 'react';
22+
import {
23+
AppRegistry,
24+
StyleSheet,
25+
Text,
26+
View,
27+
Platform,
28+
Button
29+
} from 'react-native';
30+
31+
import {StackNavigator} from 'react-navigation';
32+
33+
class HomeScreen extends Component {
34+
static navigationOptions={
35+
title:'Home'
36+
}
37+
38+
render() {
39+
const {navigate}=this.props.navigation;
40+
return (
41+
<View>
42+
<Text>home</Text>
43+
<Button onPress={()=>navigate('Chat',{user:'lucy',password:'123'})} title='go to chat'></Button>
44+
</View>
45+
);
46+
}
3647
}
37-
38-
render() {
39-
const {navigate}=this.props.navigation;
40-
return (
41-
<View>
42-
<Text>home</Text>
43-
<Button onPress={()=>navigate('Chat',{user:'lucy',password:'123'})} title='go to chat'></Button>
44-
</View>
45-
);
46-
}
47-
}
48-
49-
class ChatScreen extends Component{
50-
static navigationOptions=({navigation})=>{
51-
title:`Chat with ${navigation.state.params.user}`
52-
};
53-
54-
render(){
55-
const {params}=this.props.navigation.state
56-
return (
57-
<View>
58-
<Text>chat with {params.user} ;password:{params.password}</Text>
59-
</View>
60-
);
48+
49+
class ChatScreen extends Component{
50+
static navigationOptions=({navigation})=>{
51+
title:`Chat with ${navigation.state.params.user}`
52+
};
53+
54+
render(){
55+
const {params}=this.props.navigation.state
56+
return (
57+
<View>
58+
<Text>chat with {params.user} ;password:{params.password}</Text>
59+
</View>
60+
);
61+
}
6162
}
62-
}
63-
64-
const styles = StyleSheet.create({
65-
container: {
66-
flex: 1,
67-
justifyContent: 'center',
68-
alignItems: 'center',
69-
backgroundColor: '#F5FCFF',
70-
},
71-
72-
});
73-
74-
const SimpleApp=StackNavigator({
75-
Home:{screen:HomeScreen},
76-
Chat:{screen:ChatScreen}
77-
})
78-
79-
AppRegistry.registerComponent('NavigationDemo', () => SimpleApp);
63+
64+
const styles = StyleSheet.create({
65+
container: {
66+
flex: 1,
67+
justifyContent: 'center',
68+
alignItems: 'center',
69+
backgroundColor: '#F5FCFF',
70+
},
71+
72+
});
73+
74+
const SimpleApp=StackNavigator({
75+
Home:{screen:HomeScreen},
76+
Chat:{screen:ChatScreen}
77+
})
78+
79+
AppRegistry.registerComponent('NavigationDemo', () => SimpleApp);
8080

0 commit comments

Comments
 (0)