react-native/RNTester/js/RNTesterButton.js

54 lines
1.1 KiB
JavaScript
Raw Normal View History

2015-09-03 20:00:09 +00:00
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
2015-09-03 20:00:09 +00:00
* @flow
*/
2015-09-03 20:00:09 +00:00
'use strict';
var React = require('react');
var PropTypes = require('prop-types');
var ReactNative = require('react-native');
var {StyleSheet, Text, TouchableHighlight} = ReactNative;
2015-09-03 20:00:09 +00:00
class RNTesterButton extends React.Component<{onPress?: Function}> {
static propTypes = {
onPress: PropTypes.func,
};
render() {
2015-09-03 20:00:09 +00:00
return (
<TouchableHighlight
onPress={this.props.onPress}
style={styles.button}
underlayColor="grey">
<Text>
{
// $FlowFixMe found when converting React.createClass to ES6
this.props.children
}
2015-09-03 20:00:09 +00:00
</Text>
</TouchableHighlight>
);
}
}
2015-09-03 20:00:09 +00:00
var styles = StyleSheet.create({
button: {
borderColor: '#696969',
2015-09-03 20:00:09 +00:00
borderRadius: 8,
borderWidth: 1,
padding: 10,
margin: 5,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: '#d3d3d3',
2015-09-03 20:00:09 +00:00
},
});
module.exports = RNTesterButton;