react-native-navigation的迁移库

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import React, {Component} from 'react';
  2. import {
  3. StyleSheet,
  4. View,
  5. TouchableOpacity,
  6. Text,
  7. Image
  8. } from 'react-native';
  9. export default class CustomNavBar extends Component {
  10. constructor(props) {
  11. super(props);
  12. this.state = {};
  13. }
  14. render() {
  15. return (
  16. <View style={styles.container}>
  17. <TouchableOpacity stye={styles.button} onPress={ () => alert('Thanks for that :)') }>
  18. <Text style={{color: 'red', textAlign: 'center'}}>{this.props.name}</Text>
  19. <Text style={{textAlign: 'center'}}>Press Me</Text>
  20. </TouchableOpacity>
  21. </View>
  22. );
  23. }
  24. }
  25. const styles = StyleSheet.create({
  26. container: {
  27. flex: 1,
  28. justifyContent: 'center',
  29. alignItems: 'center',
  30. backgroundColor: 'transparent'
  31. },
  32. button: {
  33. textAlign: 'center',
  34. fontSize: 22,
  35. marginBottom: 10,
  36. marginTop: 10,
  37. color: 'blue',
  38. }
  39. });