react-native-navigation的迁移库

Navigation.js 913B

123456789101112131415161718192021222324252627282930313233343536
  1. import { AppRegistry } from 'react-native';
  2. import platformSpecific from './platformSpecific';
  3. const registeredScreens = {};
  4. function registerScreen(screenID, generator) {
  5. registeredScreens[screenID] = generator;
  6. AppRegistry.registerComponent(screenID, generator);
  7. }
  8. function getRegisteredScreen(screenID) {
  9. const generator = registeredScreens[screenID];
  10. if (!generator) {
  11. console.error('Navigation.getRegisteredScreen: ' + screenID + ' used but not yet registered');
  12. return;
  13. }
  14. return generator();
  15. }
  16. function showModal(params = {}) {
  17. return platformSpecific.showModal(params);
  18. }
  19. function dismissModal(params = {}) {
  20. return platformSpecific.dismissModal(params);
  21. }
  22. export default Navigation = {
  23. registerScreen,
  24. getRegisteredScreen,
  25. showModal,
  26. dismissModal,
  27. startTabBasedApp: platformSpecific.startTabBasedApp,
  28. startSingleScreenApp: platformSpecific.startSingleScreenApp
  29. }