react-native-navigation的迁移库

RNNBridgeModule.m 1.4KB

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