react-native-navigation的迁移库

TopTabScreen.js 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. const React = require('react');
  2. const { PureComponent } = require('react');
  3. const { View, Text } = require('react-native');
  4. const Navigation = require('react-native-navigation');
  5. class TopTabScreen extends PureComponent {
  6. static get navigationOptions() {
  7. return {
  8. topBar: {
  9. textColor: 'black',
  10. textFontSize: 16,
  11. textFontFamily: 'HelveticaNeue-Italic'
  12. }
  13. };
  14. }
  15. constructor(props) {
  16. super(props);
  17. Navigation.setOptions(this.props.containerId, {
  18. topBar: {
  19. title: this.props.title
  20. }
  21. });
  22. }
  23. render() {
  24. return (
  25. <View style={styles.root}>
  26. <Text style={styles.h1}>{this.props.text || 'Top Tab Screen'}</Text>
  27. <Text style={styles.footer}>{`this.props.containerId = ${this.props.containerId}`}</Text>
  28. </View>
  29. );
  30. }
  31. }
  32. module.exports = TopTabScreen;
  33. const styles = {
  34. root: {
  35. flexGrow: 1,
  36. justifyContent: 'center',
  37. alignItems: 'center',
  38. backgroundColor: '#f5fcff'
  39. },
  40. h1: {
  41. fontSize: 24,
  42. textAlign: 'center',
  43. margin: 10
  44. },
  45. h2: {
  46. fontSize: 12,
  47. textAlign: 'center',
  48. margin: 10
  49. },
  50. footer: {
  51. fontSize: 10,
  52. color: '#888',
  53. marginTop: 10
  54. }
  55. };