Skip to content

Instantly share code, notes, and snippets.

@troZee
Last active June 3, 2019 08:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save troZee/1995bfce1d53f79c7930404d203eb930 to your computer and use it in GitHub Desktop.
Save troZee/1995bfce1d53f79c7930404d203eb930 to your computer and use it in GitHub Desktop.
#import <React/RCTViewManager.h>
#import <React/RCTUIManager.h>
#import <React/RCTLog.h>
RCT_EXPORT_METHOD(goToPreviousPage:(nonnull NSNumber*) reactTag) {
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
NativeView *view = viewRegistry[reactTag];
if (!view || ![view isKindOfClass:[NativeView class]]) {
RCTLogError(@"Cannot find NativeView with tag #%@", reactTag);
return;
}
[view goToPreviousPage];
}];
}
RCT_EXPORT_METHOD(goToNextPage:(nonnull NSNumber*) reactTag) {
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
NativeView *view = viewRegistry[reactTag];
if (!view || ![view isKindOfClass:[NativeView class]]) {
RCTLogError(@"Cannot find NativeView with tag #%@", reactTag);
return;
}
[view goToNextPage];
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment