react-native-navigation的迁移库

RNNBridgeModule.m 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #import "RNNBridgeModule.h"
  2. @implementation RNNBridgeModule {
  3. RNNCommandsHandler* _commandsHandler;
  4. }
  5. RCT_EXPORT_MODULE();
  6. - (dispatch_queue_t)methodQueue {
  7. return dispatch_get_main_queue();
  8. }
  9. -(instancetype)initWithCommandsHandler:(RNNCommandsHandler *)commandsHandler {
  10. self = [super init];
  11. _commandsHandler = commandsHandler;
  12. return self;
  13. }
  14. #pragma mark - JS interface
  15. RCT_EXPORT_METHOD(setRoot:(NSDictionary*)layout) {
  16. [_commandsHandler setRoot:layout];
  17. }
  18. RCT_EXPORT_METHOD(push:(NSString*)containerId layout:(NSDictionary*)layout) {
  19. [_commandsHandler push:containerId layout:layout];
  20. }
  21. RCT_EXPORT_METHOD(pop:(NSString*)containerId) {
  22. [_commandsHandler pop:containerId];
  23. }
  24. RCT_EXPORT_METHOD(popTo:(NSString*)fromContainerId toContainerId:(NSString*)toContainerId) {
  25. [_commandsHandler popTo:toContainerId fromContainerId:fromContainerId];
  26. }
  27. RCT_EXPORT_METHOD(popToRoot:(NSString*)containerId) {
  28. [_commandsHandler popToRoot:containerId];
  29. }
  30. RCT_EXPORT_METHOD(showModal:(NSDictionary*)layout) {
  31. [_commandsHandler showModal:layout];
  32. }
  33. RCT_EXPORT_METHOD(dismissModal:(NSString*)containerId) {
  34. [_commandsHandler dismissModal:containerId];
  35. }
  36. RCT_EXPORT_METHOD(dismissAllModals) {
  37. [_commandsHandler dismissAllModals];
  38. }
  39. @end