/
index.android.js
55 lines (51 loc) · 1.02 KB
/
index.android.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
'use strict';
import React from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
TouchableOpacity,
NativeModules
} from 'react-native';
const GotoActivity = NativeModules.GotoActivity;
class HelloWorld extends React.Component {
render() {
return (
<View style={styles.container}>
<TouchableOpacity style={styles.button} onPress={() => {this.onPress()}}>
<Text style={styles.gotoNative}>Goto Native</Text>
</TouchableOpacity>
</View>
)
}
onPress() {
GotoActivity.gotoMainActivity();
}
}
var styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center'
},
hello: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
gotoNative: {
fontSize: 20,
textAlign: 'center',
margin: 10,
color: 'black'
},
button: {
paddingTop: 8,
paddingBottom: 8,
height: 64,
width:200,
backgroundColor: '#F37C21',
}
});
AppRegistry.registerComponent('HelloWorld', () => HelloWorld);