A framework for building native applications using React
Add missing INIT_REACT_RUNTIME_START and APP_STARTUP_START in loadScript (#54255)
Summary:
Resolves https://github.com/facebook/react-native/issues/53818
On a freshly init bare react native project, upon booting up the iOS simulator, the logs shows the following warnings:
```
Unbalanced calls start/end for tag 20
Unbalanced calls start/end for tag 19
```
The detailed cause is explained in [this comment in the issue thread](https://github.com/facebook/react-native/issues/53818#issuecomment-3441319443), and I'm copying it here for ease of reading:
> The `Unbalanced calls start/end for tag 20` message comes from [RCTPerformanceLogger.markStartForTag](https://github.com/facebook/react-native/blob/2d980558a616d13c542a1d0f8659beb04d31ab08/packages/react-native/React/Base/RCTPerformanceLogger.mm#L78)
>
> 19 represents `RCTPLAppStartup` case of `RCTPLTag` (react performance logger tag), and 20 represents `RCTPLInitReactRuntime`
>
> In C++, they are also referred to as `ReactMarker::APP_STARTUP_STOP` and `ReactMarker::INIT_REACT_RUNTIME_STOP` respectively (see [here](https://github.com/facebook/react-native/blob/2d980558a616d13c542a1d0f8659beb04d31ab08/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTPerformanceLoggerUtils.mm#L21) and [here](https://github.com/facebook/react-native/blob/2d980558a616d13c542a1d0f8659beb04d31ab08/packages/react-native/React/CxxBridge/RCTCxxBridge.mm#L116))
>
> The performance logger logs these "stop" events inside [ReactInstance::loadScript](https://github.com/facebook/react-native/blob/2d980558a616d13c542a1d0f8659beb04d31ab08/packages/react-native/ReactCommon/react/runtime/ReactInstance.cpp#L270-L271).
>
> Notice that [L267-272](https://github.com/facebook/react-native/blob/2d980558a616d13c542a1d0f8659beb04d31ab08/packages/react-native/ReactCommon/react/runtime/ReactInstance.cpp#L267-L272), we have:
> ```
> if (hasLogger) {
> ReactMarker::logTaggedMarkerBridgeless(
> ReactMarker::RUN_JS_BUNDLE_STOP, scriptName.c_str());
> ReactMarker::logMarkerBridgeless(ReactMarker::INIT_REACT_RUNTIME_STOP);
> ReactMarker::logMarkerBridgeless(ReactMarker::APP_STARTUP_STOP);
> }
> ```
>
> But earlier in [L241-244](https://github.com/facebook/react-native/blob/2d980558a616d13c542a1d0f8659beb04d31ab08/packages/react-native/ReactCommon/react/runtime/ReactInstance.cpp#L241-L244), we have:
> ```
> if (hasLogger) {
> ReactMarker::logTaggedMarkerBridgeless(
> ReactMarker::RUN_JS_BUNDLE_START, scriptName.c_str());
> }
> ```
## Changelog:
<!-- Help reviewers and the release process by writing your own changelog entry.
Pick one each for the category and type tags:
[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[IOS] [FIXED] - Address unexpected warning about "Unbalanced calls start/end for tag 20/19"
Pull Request resolved: https://github.com/facebook/react-native/pull/54255
Test Plan:
Steps to reproduce are described by original issue reporter [here](https://github.com/facebook/react-native/issues/53818#issue-3426203510). The issue surfaced in a freshly init bare react native project
1. Create a bare react-native project
2. Run iOS simulator
3. "Unbalanced calls start/end for tag 20/19" does not show up in Xcode terminal
Reviewed By: javache
Differential Revision: D85421729
Pulled By: cipolleschi
fbshipit-source-id: f80c0dd18e1d4817b1111af29ca516b494742d5a L
LS Hung committed
796d182d8989ff826eaa3a57458bdfc79750f820
Parent: 0cadb8c
Committed by meta-codesync[bot] <215208954+meta-codesync[bot]@users.noreply.github.com>
on 10/27/2025, 11:00:29 AM