Skip to content

Commit

Permalink
Support changing javascript bundle location in runtime (#5247)
Browse files Browse the repository at this point in the history
  • Loading branch information
yogevbd authored Jul 1, 2019
1 parent c0ad194 commit 8959d68
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/ios/RNNBridgeManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ typedef UIViewController * (^RNNExternalViewCreator)(NSDictionary* props, RCTBri

@property (readonly, nonatomic, strong) RCTBridge *bridge;

- (void)setJSCodeLocation:(NSURL *)jsCodeLocation;

@end
4 changes: 4 additions & 0 deletions lib/ios/RNNBridgeManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ - (instancetype)initWithJsCodeLocation:(NSURL *)jsCodeLocation launchOptions:(NS
return self;
}

- (void)setJSCodeLocation:(NSURL *)jsCodeLocation {
_jsCodeLocation = jsCodeLocation;
}

- (void)registerExternalComponent:(NSString *)name callback:(RNNExternalViewCreator)callback {
[_store registerExternalComponent:name callback:callback];
}
Expand Down
2 changes: 2 additions & 0 deletions lib/ios/ReactNativeNavigation.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ typedef UIViewController * (^RNNExternalViewCreator)(NSDictionary* props, RCTBri

+ (UIViewController *)findViewController:(NSString *)componentId;

+ (void)setJSCodeLocation:(NSURL *)jsCodeLocation;

+ (RCTBridge *)getBridge;

@end
4 changes: 4 additions & 0 deletions lib/ios/ReactNativeNavigation.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ + (UIViewController *)findViewController:(NSString *)componentId {
return [RNNLayoutManager findComponentForId:componentId];
}

+ (void)setJSCodeLocation:(NSURL *)jsCodeLocation {
[[ReactNativeNavigation sharedInstance].bridgeManager setJSCodeLocation:jsCodeLocation];
}

# pragma mark - instance

+ (instancetype) sharedInstance {
Expand Down

0 comments on commit 8959d68

Please sign in to comment.