Fabric: Race condition when using RCTFabricSurfaceHostingProxyRootView
See original GitHub issue🐛 Bug Report
When attempting to use RCTFabricSurfaceHostingProxyRootView
the application crashes when the surface is asked to start before the bridge has finished loading. Note, that I sometimes get a red screen instead, saying _fbBatchedBridge couldn’t be found, it’s “random”. It is also pretty clear to me that the runtime pointer is null when this happens. Stack trace below:
To Reproduce
- Follow the directions to run on https://github.com/facebook/react-native/pull/23803
- Comment out the code in
Swizzle_RCTFabricSurface.m
- remove the
RCTJavaScriptDidLoadNotification
observer inAppDelegate.m
- Open workspace, run app, observe error.
Expected Behavior
RCTFabricSurfaceHostingProxyRootView
to wait for the bridge to fully load before starting the surface.
Code Example
https://github.com/facebook/react-native/pull/23803. Hopefully my swizzle / hack code can be of help in proper solution!
Environment
N/A? This is RNTester.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Fixing Race Conditions in React with useEffect - Max Rozen
You would typically notice a race condition (in React) when two slightly different requests for data have been made, and the application displays...
Read more >Race conditions in React and beyond. A race condition guard ...
Our code does not need to utilize multiple threads to have a race condition. A similar issue might occur with asynchronous code. Imagine...
Read more >Enabling TurboModule and Fabric in React Native 0.68 leads ...
I am using React Native 0.68 and trying to use TurboModules and Fabric. This is my AppDelegate.mm file #import "AppDelegate.h" #import ...
Read more >Avoiding Race Conditions when Fetching Data with ... - Medium
About a month ago, I posted an example of fetching data using React Hooks to Twitter. While it was well-intended, Dan Abromov (of...
Read more >Enabling Fabric on iOS - React Native
How to render your app with Fabric depends on your setup. ... #import <React/RCTFabricSurfaceHostingProxyRootView.h>
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
we’re tracking this internally and will investigate in a few weeks
Please re-open if the issue still exists.