Skip to content

Conversation

lukmccall
Copy link
Contributor

@lukmccall lukmccall commented Feb 1, 2023

Why

Fixes https://www.notion.so/expo/iOS-Unversioned-QA-47e54e52912a4dfc9e4127cdb136e5a7?d=5791b37a93d245209352457d6d677358#399ef36c314643de8b633106ee652067.

How

It has been discovered that jsiRuntime is null in the code at

jsi::Runtime *jsiRuntime = [bridge respondsToSelector:@selector(runtime)] ? reinterpret_cast<jsi::Runtime *>(bridge.runtime) : nullptr;
return jsiRuntime ? [[EXJavaScriptRuntime alloc] initWithRuntime:jsiRuntime callInvoker:bridge.jsCallInvoker] : nil;

However, in a normal (non-test) scenario, it should have been set to the current runtime. This issue only occurs in Expo Go and is related to using extraModulesForBridge to add modules in the Go app, causing a change in the execution order and preventing the runtime from initializing when needed.

Test Plan

  • NCL with Expo Go and bare expo ✅

@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label Feb 1, 2023
@lukmccall lukmccall marked this pull request as ready for review February 1, 2023 13:11
Copy link
Contributor

@Kudo Kudo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirmed this is a regression from #20506 which as @lukmccall mentioned, only happening on expo go with extraModulesForBridge.

this is from bare-expo without extraModulesForBridge. there is an enqueue on main thread.

Screenshot 2023-02-01 at 11 37 14 PM

this is from expo go with extraModulesForBridge, from main to setBridge directly.

Screenshot 2023-02-01 at 11 37 33 PM

so the current solution simulates the main thread enqueue makes sense to me. thanks for investigating the issue 👏

@@ -41,6 +41,30 @@ public final class ExpoBridgeModule: NSObject, RCTBridgeModule {
public var bridge: RCTBridge! {
didSet {
appContext.reactBridge = bridge

if bridge.responds(to: Selector(("runtime"))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not too much parentheses? 😂

Suggested change
if bridge.responds(to: Selector(("runtime"))) {
if bridge.responds(to: Selector("runtime")) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, that was intentional to suppress the XCode warning:
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, I didn't know this suppresses that warning 🙂

@aleqsio
Copy link
Contributor

aleqsio commented Feb 2, 2023

Can confirm this fix works for me

@expo-bot
Copy link
Collaborator

expo-bot commented Feb 2, 2023

Hi there! 👋 I'm a bot whose goal is to ensure your contributions meet our guidelines.

I've found some issues in your pull request that should be addressed (click on them for more details) 👇

⚠️ Suggestion: Missing changelog entries


Your changes should be noted in the changelog. Read Updating Changelogs guide and consider adding an appropriate entry to the following changelogs:


Generated by ExpoBot 🤖 against 0c0e97c

@lukmccall lukmccall merged commit 3e4f4af into main Feb 2, 2023
@lukmccall lukmccall deleted the @lukmccall/core/fix-global-is-not-registerds branch February 2, 2023 13:34
thecodedrift added a commit to thecodedrift/expo that referenced this pull request Feb 2, 2023
…flipper

* upstream/main: (47 commits)
  [docs] Update Hermes guide to state that Hermes is the new default engine (expo#21047)
  chore: don't mark issues with the "Issue accepted" label as stale (expo#21058)
  Switch default JS engine to Hermes (expo#21001)
  [mail-composer][android] fix composeAsync not resolving after send/ discard (expo#20869)
  Update CHANGELOG.md (expo#21061)
  [core][iOS] Fix expo modules aren't added to global (expo#21037)
  [test-suite] Fix import in the Image example (expo#21043)
  [test-suite] fix video hanging (expo#21057)
  [av][ncl][go] fix audio and video qa issues (expo#21055)
  [tools] Selecting pull requests to label in the publish command (expo#20991)
  [document-picker] fill missing descriptions in `DocumentResult` type (expo#21040)
  [tools] Bump http-cache-semantics from 4.1.0 to 4.1.1 (expo#21049)
  Bump http-cache-semantics from 4.1.0 to 4.1.1 in /docs (expo#21050)
  [apps][yarn-workspace] replace deprecated activateKeepAwake
  update changelogs for react-native 0.71 upgrade (expo#20858)
  Upgrade react native to 0.71.2 (expo#21045)
  [go] update @shopify/react-native-skia to 0.1.172 (expo#21014)
  [stripe] Upgrade stripe to 0.23.1 (expo#20964)
  [expo-firebase-*] Remove libraries (expo#20979)
  [docs] Update expo-secure-store to add info about Export compliance (expo#21021)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: suggestions ExpoBot has some suggestions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants