Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RN][iOS] Cherry Pick #43757 and #43994 #44007

Merged
merged 3 commits into from
Apr 10, 2024

Conversation

cipolleschi
Copy link
Contributor

@cipolleschi cipolleschi commented Apr 9, 2024

Summary:

This PR includes the Cherry picks for #43757 and #43994 which includes:

  • supporting launchOptions in Bridgeless to enable RCTLinkingManager in Bridgeless, thus unblocking deep linking and universal links
  • fix connection to Metro in bridgeless when the app is started before Metro.

Changelog:

[iOS][Fixed] - Support launchOptions in Bridgeless mode.
[iOS][Fixed] - Let RCTHost be initialized with a function to provide the bundleURL so that it can connect to metro on Reload when the url changes.

Test Plan:

Landed on main already

zhongwuzw and others added 2 commits April 9, 2024 19:43
Summary:
Support launchOptions in bridgeless mode
bypass-github-export-checks

[IOS] [FIXED] - Support launchOptions in bridgeless mode

Pull Request resolved: #43757

Test Plan:
```
useEffect(() => {
    const processInitialURL = async () => {
      const url = await Linking.getInitialURL();
      if (url !== null) {
        console.log(`Initial url is: ${url}`);
      }
    };

    processInitialURL();
  }, []);
```

Reviewed By: javache

Differential Revision: D55790758

Pulled By: cipolleschi

fbshipit-source-id: 0f6aa6bdcebfc5bc42d632bea9193f122c1eb84f
Summary:
Pull Request resolved: #43994

We received [this issue](#43764) from OSS where an app can't connect to Metro on reloads in the following scenario:

* Start the App when metro does not run.
* Observe the error screen
* Start Metro
* Press Reload
* Observe the error message again

While the desired behavior should be to connect to Metro now that this is running.

The root cause of the problem is that the RCTHost is initialized with a value of the `bundleURL` that is `nil`. Upon reload, the RCTHost is **not** recreated: the instance is restarted, but with the previous `bundleURL`, which is still `nil`.

The solution is to initialize the `RCTHost` with a closure that re-evaluate the `bundleURL` whenever it is invoked and to evaluate it only on `start`, to keep the initialization path light.
This way, when the app is started with Metro not running, the `bundleURL` is `nil`. But when it is reloaded with Metro starting, the `bundleURL` is properly initialized.

Note that the changes in this diff are not breaking as I reimplemented (and deprecated) the old initializer so that they should work in the same way.

[iOS][Fixed] - Let RCTHost be initialized with a function to provide the `bundleURL` so that it can connect to metro on Reload when the url changes.

Reviewed By: dmytrorykun

Differential Revision: D55916135

fbshipit-source-id: 6927b2154870245f28f42d26bd0209b28c9518f2
@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Apr 9, 2024
@cipolleschi cipolleschi changed the base branch from main to 0.74-stable April 9, 2024 18:49
@cipolleschi cipolleschi requested a review from cortinico April 9, 2024 18:51
@cipolleschi cipolleschi marked this pull request as ready for review April 9, 2024 18:51
@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 17,820,445 -1,578,860
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 21,178,718 -1,596,768
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: a25004c
Branch: main

@cortinico cortinico merged commit cb2d93e into 0.74-stable Apr 10, 2024
25 of 34 checks passed
@cortinico cortinico deleted the cipolleschi/cherry-pick-bridgeless branch April 10, 2024 10:01
This was referenced Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner Pick Request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants