Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 2354506

Browse files
committed
fix reflection not getting field from superclass
1 parent 807f4cf commit 2354506

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,10 @@ private void loadBundle() {
126126
// The React Native version might be older than 0.29, or the activity does not
127127
// extend ReactActivity, so we try to get the instance manager via the
128128
// "mReactInstanceManager" field.
129-
Field instanceManagerField = currentActivity.getClass().getDeclaredField("mReactInstanceManager");
129+
Class instanceManagerHolderClass = currentActivity instanceof ReactActivity
130+
? ReactActivity.class
131+
: currentActivity.getClass();
132+
Field instanceManagerField = instanceManagerHolderClass.getDeclaredField("mReactInstanceManager");
130133
instanceManagerField.setAccessible(true);
131134
instanceManager = (ReactInstanceManager)instanceManagerField.get(currentActivity);
132135
}

0 commit comments

Comments
 (0)