Add Timer example

Differential Revision: D2433417

committer: Service User <svcscm@fb.com>
This commit is contained in:
Andrei Coman 2015-09-11 01:56:51 -07:00 committed by facebook-github-bot-7
parent b45f89e69f
commit 360d04e9c8
2 changed files with 9 additions and 3 deletions

View File

@ -18,7 +18,9 @@
var React = require('react-native');
var {
AlertIOS,
Platform,
Text,
ToastAndroid,
TouchableHighlight,
View,
} = React;
@ -73,7 +75,11 @@ var TimerTester = React.createClass({
var msg = 'Finished ' + this._ii + ' ' + this.props.type + ' calls.\n' +
'Elapsed time: ' + e + ' ms\n' + (e / this._ii) + ' ms / iter';
console.log(msg);
AlertIOS.alert(msg);
if (Platform.OS === 'ios') {
AlertIOS.alert(msg);
} else if (Platform.OS === 'android') {
ToastAndroid.show(msg, ToastAndroid.SHORT);
}
this._start = 0;
this.forceUpdate(() => { this._ii = 0; });
return;

View File

@ -42,14 +42,14 @@ var UIExplorerButton = React.createClass({
var styles = StyleSheet.create({
button: {
borderColor: 'dimgray',
borderColor: '#696969',
borderRadius: 8,
borderWidth: 1,
padding: 10,
margin: 5,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: 'lightgrey',
backgroundColor: '#d3d3d3',
},
});