From c5efc63663a96aa20ccaf63f870bff46f65e6ee0 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Tue, 10 Dec 2019 20:30:08 -0800 Subject: [PATCH] Expose getJSIModule as part of the ReactContext class Summary: This diff exposes the getJSIModule on the ReactContext class. This class already has methods to obtain NativeModules and JSModules, it make sense to expose the getJSIModule method too. Changelog: [internal] Reviewed By: JoshuaGross Differential Revision: D18862858 fbshipit-source-id: 95fe48c065266060c96fc40a002041ba398b3134 --- .../main/java/com/facebook/react/bridge/ReactContext.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java index b8b210c6b82..bdae0b2f6d8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java @@ -427,4 +427,12 @@ public class ReactContext extends ContextWrapper { public JavaScriptContextHolder getJavaScriptContextHolder() { return mCatalystInstance.getJavaScriptContextHolder(); } + + public JSIModule getJSIModule(JSIModuleType moduleType) { + if (!hasActiveCatalystInstance()) { + throw new IllegalStateException( + "Unable to retrieve a JSIModule if CatalystInstance is not active."); + } + return mCatalystInstance.getJSIModule(moduleType); + } }