react-native-navigation的迁移库

CustomTextButton.js 854B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. const React = require('react');
  2. const { Component } = require('react');
  3. const {
  4. StyleSheet,
  5. View,
  6. TouchableOpacity,
  7. Text,
  8. Alert,
  9. Platform
  10. } = require('react-native');
  11. class CustomTextButton extends Component {
  12. constructor(props) {
  13. super(props);
  14. this.state = {};
  15. }
  16. render() {
  17. return (
  18. <View style={styles.container}>
  19. <TouchableOpacity stye={styles.button} onPress={() => Alert.alert(this.props.title, 'Thanks for that :)')}>
  20. <Text style={styles.text}>Press Me</Text>
  21. </TouchableOpacity>
  22. </View>
  23. );
  24. }
  25. }
  26. module.exports = CustomTextButton;
  27. const styles = StyleSheet.create({
  28. container: {
  29. flex: 1,
  30. width: 60,
  31. flexDirection: 'column',
  32. justifyContent: 'center',
  33. },
  34. button: {
  35. flex: 1,
  36. flexDirection: 'column',
  37. },
  38. text: {
  39. color: 'black',
  40. }
  41. });