Skip to content

Commit

Permalink
assertion in caller
Browse files Browse the repository at this point in the history
  • Loading branch information
Kudo committed Jun 11, 2024
1 parent a237918 commit e6a722d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ private void attachRootViewToInstance(final ReactRoot reactRoot) {
rootTag =
uiManager.startSurface(
reactRoot.getRootViewGroup(),
reactRoot.getJSModuleName(),
Assertions.assertNotNull(reactRoot.getJSModuleName()),
initialProperties == null
? new WritableNativeMap()
: Arguments.fromBundle(initialProperties),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,9 @@ public void run() {
if (mShouldLogContentAppeared) {
mShouldLogContentAppeared = false;
String jsModuleName = getJSModuleName();
ReactMarker.logMarker(ReactMarkerConstants.CONTENT_APPEARED, jsModuleName, mRootViewTag);
if (jsModuleName != null) {
ReactMarker.logMarker(ReactMarkerConstants.CONTENT_APPEARED, jsModuleName, mRootViewTag);
}
}
}

Expand Down Expand Up @@ -630,7 +632,7 @@ public void setEventListener(@Nullable ReactRootViewEventListener eventListener)

@Override
public String getJSModuleName() {
return Assertions.assertNotNull(mJSModuleName);
return mJSModuleName;
}

@Override
Expand Down Expand Up @@ -665,7 +667,7 @@ public void runApplication() {
}

CatalystInstance catalystInstance = reactContext.getCatalystInstance();
String jsAppModuleName = getJSModuleName();
String jsAppModuleName = Assertions.assertNotNull(getJSModuleName());

if (mWasMeasured) {
updateRootLayoutSpecs(true, mWidthMeasureSpec, mHeightMeasureSpec);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.facebook.common.logging.FLog;
import com.facebook.debug.holder.PrinterHolder;
import com.facebook.debug.tags.ReactDebugOverlayTags;
import com.facebook.infer.annotation.Assertions;
import com.facebook.infer.annotation.ThreadConfined;
import com.facebook.proguard.annotations.DoNotStripAny;
import com.facebook.react.bridge.ColorPropConverter;
Expand Down Expand Up @@ -255,7 +256,7 @@ public <T extends View> int addRootView(final T rootView, final WritableMap init
new ThemedReactContext(
mReactApplicationContext, rootView.getContext(), reactRootView.getSurfaceID(), rootTag);
mMountingManager.startSurface(rootTag, reactContext, rootView);
String moduleName = reactRootView.getJSModuleName();
String moduleName = Assertions.assertNotNull(reactRootView.getJSModuleName());
if (ENABLE_FABRIC_LOGS) {
FLog.d(TAG, "Starting surface for module: %s and reactTag: %d", moduleName, rootTag);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public interface ReactRoot {
@Nullable
Bundle getAppProperties();

@Nullable
String getJSModuleName();

/** Fabric or Default UI Manager, see {@link UIManagerType} */
Expand Down

0 comments on commit e6a722d

Please sign in to comment.