Skip to content

Commit

Permalink
Add API to reset CxxModuleWrapper's module pointer
Browse files Browse the repository at this point in the history
Reviewed By: mhorowitz

Differential Revision: D4914335

fbshipit-source-id: f28f57c2e74d590dacfb85d8027747837f768fdc
  • Loading branch information
javache authored and facebook-github-bot committed Apr 20, 2017
1 parent db8efd9 commit 17020ff
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -2,7 +2,6 @@


package com.facebook.react.cxxbridge; package com.facebook.react.cxxbridge;


import java.util.Map;


import com.facebook.jni.HybridData; import com.facebook.jni.HybridData;
import com.facebook.proguard.annotations.DoNotStrip; import com.facebook.proguard.annotations.DoNotStrip;
Expand Down Expand Up @@ -52,4 +51,12 @@ public void onCatalystInstanceDestroy() {
protected CxxModuleWrapperBase(HybridData hd) { protected CxxModuleWrapperBase(HybridData hd) {
mHybridData = hd; mHybridData = hd;
} }

// Replace the current native module held by this wrapper by a new instance
protected void resetModule(HybridData hd) {
if (hd != mHybridData) {
mHybridData.resetNative();
mHybridData = hd;
}
}
} }

0 comments on commit 17020ff

Please sign in to comment.