60 lines
1.2 KiB
JavaScript
60 lines
1.2 KiB
JavaScript
/**
|
|
* Sample React Native App
|
|
* https://github.com/facebook/react-native
|
|
*/
|
|
'use strict';
|
|
|
|
var React = require('react-native');
|
|
var {
|
|
AppRegistry,
|
|
StyleSheet,
|
|
Text,
|
|
View,
|
|
TouchableNativeFeedback,
|
|
} = React;
|
|
|
|
var JniToastAndroid = require('NativeModules').JniToastAndroid;
|
|
|
|
var Demo = React.createClass({
|
|
buttonClicked: function() {
|
|
JniToastAndroid.show("Hello Zepp", JniToastAndroid.LONG);
|
|
},
|
|
render: function() {
|
|
return (
|
|
<View style={styles.container}>
|
|
<Text style={styles.welcome}>
|
|
Calling JNI String from Javascript.
|
|
</Text>
|
|
<TouchableNativeFeedback
|
|
style={styles.button}
|
|
onPress={this.buttonClicked.bind(this)}>
|
|
<View style={{backgroundColor: 'red'}}>
|
|
<Text style={{margin: 5}}>Click Me :)</Text>
|
|
</View>
|
|
</TouchableNativeFeedback>
|
|
</View>
|
|
);
|
|
}
|
|
});
|
|
|
|
var styles = StyleSheet.create({
|
|
container: {
|
|
flex: 1,
|
|
justifyContent: 'center',
|
|
alignItems: 'center',
|
|
backgroundColor: '#F5FCFF',
|
|
},
|
|
welcome: {
|
|
fontSize: 20,
|
|
textAlign: 'center',
|
|
margin: 10,
|
|
},
|
|
instructions: {
|
|
textAlign: 'center',
|
|
color: '#333333',
|
|
marginBottom: 5,
|
|
},
|
|
});
|
|
|
|
AppRegistry.registerComponent('Demo', () => Demo);
|