react-native-navigation的迁移库

NativeCommandsSender.ts 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import { NativeModules } from 'react-native';
  2. export class NativeCommandsSender {
  3. private nativeCommandsModule;
  4. constructor() {
  5. this.nativeCommandsModule = NativeModules.RNNBridgeModule;
  6. }
  7. setRoot(commandId: string, layout: { root: any, modals: any[], overlays: any[] }) {
  8. return this.nativeCommandsModule.setRoot(commandId, layout);
  9. }
  10. setDefaultOptions(options: object) {
  11. return this.nativeCommandsModule.setDefaultOptions(options);
  12. }
  13. mergeOptions(componentId: string, options: object) {
  14. return this.nativeCommandsModule.mergeOptions(componentId, options);
  15. }
  16. push(commandId: string, onComponentId: string, layout: object) {
  17. return this.nativeCommandsModule.push(commandId, onComponentId, layout);
  18. }
  19. pop(commandId: string, componentId: string, options: object) {
  20. return this.nativeCommandsModule.pop(commandId, componentId, options);
  21. }
  22. popTo(commandId: string, componentId: string) {
  23. return this.nativeCommandsModule.popTo(commandId, componentId);
  24. }
  25. popToRoot(commandId: string, componentId: string) {
  26. return this.nativeCommandsModule.popToRoot(commandId, componentId);
  27. }
  28. setStackRoot(commandId: string, onComponentId: string, layout: object) {
  29. return this.nativeCommandsModule.setStackRoot(commandId, onComponentId, layout);
  30. }
  31. showModal(commandId: string, layout: object) {
  32. return this.nativeCommandsModule.showModal(commandId, layout);
  33. }
  34. dismissModal(commandId: string, componentId: string) {
  35. return this.nativeCommandsModule.dismissModal(commandId, componentId);
  36. }
  37. dismissAllModals(commandId: string) {
  38. return this.nativeCommandsModule.dismissAllModals(commandId);
  39. }
  40. showOverlay(commandId: string, layout: object) {
  41. return this.nativeCommandsModule.showOverlay(commandId, layout);
  42. }
  43. dismissOverlay(commandId: string, componentId: string) {
  44. return this.nativeCommandsModule.dismissOverlay(commandId, componentId);
  45. }
  46. }