react-native-navigation的迁移库

component.js 633B

1234567891011121314151617181920212223242526272829303132
  1. import React, { Component } from 'react';
  2. import { Text } from 'react-native';
  3. import { connect } from 'remx/react-native';
  4. import * as store from './store';
  5. class MyContainer extends Component {
  6. render() {
  7. if (this.props.renderCountIncrement) {
  8. this.props.renderCountIncrement();
  9. }
  10. return this.renderText(this.props.printAge ? this.props.age : this.props.name);
  11. }
  12. renderText(txt) {
  13. return (
  14. <Text>{txt}</Text>
  15. );
  16. }
  17. }
  18. function mapStateToProps() {
  19. return {
  20. name: store.getters.getName(),
  21. age: store.getters.getAge()
  22. };
  23. }
  24. export default connect(mapStateToProps)(MyContainer);