react-native-navigation的迁移库

RNNBridgeModule.m 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #import "RNNBridgeModule.h"
  2. @interface RNNBridgeModule ()
  3. @property RNNCommandsHandler* commandsHandler;
  4. @end
  5. @implementation RNNBridgeModule
  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. self.commandsHandler = commandsHandler;
  13. return self;
  14. }
  15. #pragma mark - JS interface
  16. RCT_EXPORT_METHOD(setRoot:(NSDictionary*)layout) {
  17. [self.commandsHandler setRoot:layout];
  18. }
  19. RCT_EXPORT_METHOD(push:(NSString*)containerId layout:(NSDictionary*)layout) {
  20. [self.commandsHandler push:containerId layout:layout];
  21. }
  22. RCT_EXPORT_METHOD(pop:(NSString*)containerId) {
  23. [self.commandsHandler pop:containerId];
  24. }
  25. RCT_EXPORT_METHOD(showModal:(NSDictionary*)layout) {
  26. [self.commandsHandler showModal:layout];
  27. }
  28. RCT_EXPORT_METHOD(dismissModal:(NSString*)containerId) {
  29. [self.commandsHandler dismissModal:containerId];
  30. }
  31. RCT_EXPORT_METHOD(dismissAllModals) {
  32. [self.commandsHandler dismissAllModals];
  33. }
  34. @end