react-native-navigation的迁移库

123456789101112131415161718192021222324252627282930313233343536
  1. const React = require('react');
  2. const { Component } = require('react');
  3. const { Text } = require('react-native');
  4. const { connect } = require('remx');
  5. const store = require('./MyStore');
  6. class MyComponent extends Component {
  7. static options = {
  8. title: 'MyComponent'
  9. };
  10. render() {
  11. if (this.props.renderCountIncrement) {
  12. this.props.renderCountIncrement();
  13. }
  14. return this.renderText(this.props.printAge ? this.props.age : this.props.name);
  15. }
  16. renderText(txt) {
  17. return (
  18. <Text>{txt}</Text>
  19. );
  20. }
  21. }
  22. function mapStateToProps() {
  23. return {
  24. name: store.getters.getName(),
  25. age: store.getters.getAge()
  26. };
  27. }
  28. module.exports = connect(mapStateToProps)(MyComponent);