react-native-navigation的迁移库

Lifecycle.js 839B

1234567891011121314151617181920212223242526272829303132
  1. class Lifecycle {
  2. constructor(store) {
  3. this.store = store;
  4. this.containerDidAppear = this.containerDidAppear.bind(this);
  5. this.containerDidDisappear = this.containerDidDisappear.bind(this);
  6. this.onNavigationButtonPressed = this.onNavigationButtonPressed.bind(this);
  7. }
  8. containerDidAppear(id) {
  9. const ref = this.store.getRefForContainerId(id);
  10. if (ref && ref.didAppear) {
  11. ref.didAppear();
  12. }
  13. }
  14. containerDidDisappear(id) {
  15. const ref = this.store.getRefForContainerId(id);
  16. if (ref && ref.didDisappear) {
  17. ref.didDisappear();
  18. }
  19. }
  20. onNavigationButtonPressed(params) {
  21. const ref = this.store.getRefForContainerId(params.containerId);
  22. if (ref && ref.onNavigationButtonPressed) {
  23. ref.onNavigationButtonPressed(params.buttonId);
  24. }
  25. }
  26. }
  27. module.exports = Lifecycle;