react-native-navigation的迁移库

ThirdTabScreen.js 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import React, {
  2. Component,
  3. Text,
  4. View,
  5. ScrollView,
  6. TouchableOpacity,
  7. StyleSheet
  8. } from 'react-native';
  9. export default class ThirdTabScreen extends Component {
  10. static navigatorStyle = {
  11. drawUnderTabBar: true
  12. };
  13. constructor(props) {
  14. super(props);
  15. }
  16. render() {
  17. return (
  18. <View style={{flex: 1, padding: 20}}>
  19. <TouchableOpacity onPress={ this.onPushPress.bind(this) }>
  20. <Text style={styles.button}>Push Plain Screen</Text>
  21. </TouchableOpacity>
  22. <TouchableOpacity onPress={ this.onPushStyledPress.bind(this) }>
  23. <Text style={styles.button}>Push Styled Screen</Text>
  24. </TouchableOpacity>
  25. <TouchableOpacity onPress={ this.onPushStyled2Press.bind(this) }>
  26. <Text style={styles.button}>Push Styled Screen 2</Text>
  27. </TouchableOpacity>
  28. <TouchableOpacity onPress={ this.onModalPress.bind(this) }>
  29. <Text style={styles.button}>Show Modal Screen</Text>
  30. </TouchableOpacity>
  31. </View>
  32. );
  33. }
  34. onPushPress() {
  35. this.props.navigator.push({
  36. title: "More",
  37. screen: "example.PushedScreen"
  38. });
  39. }
  40. onPushStyledPress() {
  41. this.props.navigator.push({
  42. title: "Styled",
  43. screen: "example.StyledScreen"
  44. });
  45. }
  46. onPushStyled2Press () {
  47. this.props.navigator.push({
  48. title: "Styled",
  49. titleImage: require('../../img/two.png'),
  50. screen: "example.StyledScreen"
  51. });
  52. }
  53. onModalPress() {
  54. this.props.navigator.showModal({
  55. title: "Modal",
  56. screen: "example.ModalScreen"
  57. });
  58. }
  59. }
  60. const styles = StyleSheet.create({
  61. button: {
  62. textAlign: 'center',
  63. fontSize: 18,
  64. marginBottom: 10,
  65. marginTop:10,
  66. color: 'blue'
  67. }
  68. });