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

Possible to get a RN 74 example? #188

Open
blakecallens opened this issue Jun 3, 2024 · 11 comments
Open

Possible to get a RN 74 example? #188

blakecallens opened this issue Jun 3, 2024 · 11 comments
Labels

Comments

@blakecallens
Copy link

Is your feature request related to a problem? Please describe.
With the upgrade to Yoga 3.0 and the removal of Flipper, it would be helpful to have an example app showing how to configure iOS scenes in this version.

Describe the solution you'd like
An example app for React Native >= 74

@lovegaoshi
Copy link

removing flipper related lines in the header file and podfile will just work for rn0.74, old arch.

@mefjuu
Copy link

mefjuu commented Jun 11, 2024

@lovegaoshi Are you using AppDelegate ObjC or Swift version (like in example app in master branch)?

@lovegaoshi
Copy link

lovegaoshi commented Jun 11, 2024 via email

@mefjuu
Copy link

mefjuu commented Jun 11, 2024

@lovegaoshi Did you have any problems with migrating? I have some issues with "'RCTAppDelegate.h' file not found" in {TargetName}-Bridging-Header.h while compiling. I'm investigating what's the reason of the problem (maybe it's dependencies related problem? such as RN Firebase...)

@lovegaoshi
Copy link

lovegaoshi commented Jun 11, 2024 via email

@blakecallens
Copy link
Author

I've been able to resolve the issue. A key difference in pure ReactNative v74 is that you need to add a bundleURL function to the AppDelegate, because it's not a class variable any longer.

override func bundleURL() -> URL? {
    return RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index");
}

@mefjuu
Copy link

mefjuu commented Jun 12, 2024

@lovegaoshi Glad to see real-world app using Car Play! Thanks for linking the repo.
My problem with bridging header was setting it also for extra targets which I use in my app (for iOS Widgets). After leaving it only for main app target the error has gone.

@lovegaoshi
Copy link

appreciate mentioning of the bundleURL function! I did encounter that too and the snippet would fix it perfectly. I got it confused with sourceURL so I forced it in there.

@DanielKuhn
Copy link
Contributor

I upgraded the example app to RN 75 in this PR.

It uses the same approach as @lovegaoshi 's - which poses a problem: In application:didFinishLaunchingWithOptions a second rootView is created, additionally to the one already created by the RCTRootViewFactory in RCTAppDelegate's application:didFinishLaunchingWithOptions here. This leads to duplicate rootViewControllers with rootViews causing side effects like react native hooks to be run twice... In other words: The app is "run twice":
Bildschirmfoto 2024-08-23 um 15 59 39

I outlined this problem in the README of my standalone-app-PR
So far, the only way I found around it is to use the initAppFromScene-approach, recreating RCTAppDelegate's application:didFinishLaunchingWithOptions except for the rootViewController and window creation and leaving those to the PhoneSceneDelegate.

In RN 74 and 75, this seems to require patching the react native package itself and exposing createRCTRootViewFactory in RCTAppDelegate.h (see discussion here).

@DanielKuhn
Copy link
Contributor

Related issue (RN 0.75) for Android: #210

@Wendy-Nam
Copy link

Hi! Are you using an arm64 architecture, like an M1 Mac?
While I’m not entirely sure if our issues are the same, I encountered a similar "RCTAppDelegate.h file not found" error after installing Firebase for distributing test apps. Initially, I suspected Firebase dependencies, but the issue in my case was related to switching to a Rosetta terminal in VSCode for build scripts.

Disabling Rosetta and clearing caches resolved it for me. I don’t think Rosetta itself was the issue, but my core dependencies (like Ruby, rbenv, and CocoaPods) were installed in a native arm64 terminal previously, which likely caused conflicts against new dependencies installed using Rosetta.

I’ve detailed the steps I took in this comment.
Hope it helps! 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants