realm-js icon indicating copy to clipboard operation
realm-js copied to clipboard

Realm Context doesn't work with new React Native architecture

Open myou11 opened this issue 2 years ago • 1 comments

How frequently does the bug occur?

All the time

Description

Hello, I am trying to create a new Typescript React Native app with Realm, but whenever I try running the project with the new architecture enabled, the app does not start up. The app works fine when I first try to run it without enabling the new architecture.

Stacktrace & log output

No response

Can you reproduce the bug?

Yes, always

Reproduction Steps

I made a repo that uses the react-native TS template with some realm code: https://github.com/myou11/RealmContextErrorApp

If you run cd ios && pod install, then try running the app through XCode or npx react-native run-ios, the app starts up fine and you can see the TextField and Button I added to the template. Adding strings (Tasks) to the realm db works.

If you stop the app and close the Metro window, then try running the app with the new architecture enabled, the app no longer works.

These are the steps I followed to enable the new architecture (based on React Native 0.68 release post). In the ios folder, I do the following:

> RCT_NEW_ARCH_ENABLED=1 bundle exec pod install
Could not find gem 'cocoapods (~> 1.11, >= 1.11.2)' in locally installed gems.
Run `bundle install` to install missing gems.

I then run bundle install. Then, running RCT_NEW_ARCH_ENABLED=1 bundle exec pod install works as intended.

Running the ios app now produces the following error: Screen Shot 2022-06-03 at 12 01 21

Sorry for the screenshot, but I don't see any stacktrace I can paste from the console.

Version

realm 10.19.0

What SDK flavour are you using?

Local Database only

Are you using encryption?

No, not using encryption

Platform OS and version(s)

iOS

Build environment

Which debugger for React Native: .. node 18.2.0 "@realm/react": "^0.3.1", "react": "17.0.2", "react-native": "0.68.2", "realm": "^10.19.0" "typescript": "^4.4.4"

Cocoapods version

1.11.3

myou11 avatar Jun 03 '22 18:06 myou11

@myou11 Thanks for pointing this out. We definitely want to stay compatible with the new architecture. We will investigate and post any updates here.

takameyer avatar Jun 07 '22 06:06 takameyer

I don't know a single christian that is capable to make realm runs with the new architecture setting true. Tried everything and all versions of react native 0.69 and above and always getting the same error. Pray for this issue to be solved sometine.

brunoducattii avatar Aug 10 '22 18:08 brunoducattii

We have released RJS v11.0.0 which has a complete rewrite of the integration with JSC and @realm/react v0.4.0. I am closing the issue, and ask you to upgrade. If the issue is still observed, please create a new issue.

kneth avatar Oct 20 '22 11:10 kneth