react-native-navigation的迁移库

CustomTopBar.js 729B

12345678910111213141516171819202122232425262728293031323334353637
  1. const React = require('react');
  2. const { Component } = require('react');
  3. const {
  4. StyleSheet,
  5. View,
  6. TouchableOpacity,
  7. Text,
  8. Alert
  9. } = require('react-native');
  10. class CustomTopBar extends Component {
  11. render() {
  12. return (
  13. <View style={styles.container}>
  14. <TouchableOpacity onPress={() => Alert.alert(this.props.title, 'Thanks for that :)')}>
  15. <Text style={styles.text}>{this.props.text}</Text>
  16. </TouchableOpacity>
  17. </View>
  18. );
  19. }
  20. }
  21. module.exports = CustomTopBar;
  22. const styles = StyleSheet.create({
  23. container: {
  24. flex: 1,
  25. flexDirection: 'column',
  26. justifyContent: 'center',
  27. alignSelf: 'center'
  28. },
  29. text: {
  30. alignSelf: 'center',
  31. color: 'black',
  32. }
  33. });