react-native-navigation icon indicating copy to clipboard operation
react-native-navigation copied to clipboard

RNN and Realm integration

Open tab opened this issue 8 months ago • 1 comments

What happened?

Hey there, I would like to report an issue that I've encountered while develop my app.

Here is the error log:

info Reloading app...
BUNDLE  ./index.js

LOG  Running "com.demo.Home" with {"rootTag":91,"initialProps":{"componentId":"Component1"}}
LOG  Running "com.demo.Profile" with {"rootTag":101,"initialProps":{"componentId":"Component2"}}
LOG  Running "com.demo.Search" with {"rootTag":111,"initialProps":{"componentId":"Component5"}}
ERROR  [Error: Realm at path '~/Library/Developer/CoreSimulator/Devices/80804451-2C6B-4234-A1E3-EEB10978C5D7/data/Containers/Data/Application/58C9FF7E-B06B-4C30-9366-9C10E72BD14B/Documents/mongodb-realm/devicesync-sxnya/6540f36a748707f093355a2a/s_6540f36a748707f093355a2a.realm' already opened with a different sync user.]

This error occurs when I try to open a modal using the following code:

Navigation.showModal({
  stack: {
    children: [
      {
        component: {
          name: SEARCH_SCREEN.name,
          options: SEARCH_SCREEN.options,
          passProps: {},
        },
      },
    ],
  },
})
export const SEARCH_SCREEN = {
  id: "SEARCH_SCREEN",
  name: "com.demo.Search",
  options: {
    topBar: {
      visible: false,
    },
    bottomTabs: {
      visible: false,
    },
    modal: {
      swipeToDismiss: true,
    },
    layout: {
      backgroundColor: "transparent",
      componentBackgroundColor: "transparent",
    },
  },
}

Please let me know if you need any further information or if there's anything I can do to assist in resolving this issue.

Thank you for your attention.

What was the expected behaviour?

No response

Was it tested on latest react-native-navigation?

  • [X] I have tested this issue on the latest react-native-navigation release and it still reproduces.

Help us reproduce this issue!

Demo application

https://github.com/tab/rnn-realm-demo

In what environment did this happen?

React Native Navigation version: 7.37.1 React Native version: 0.72.6 Has Fabric (React Native's new rendering system) enabled: no Node version: 20.5.1

"@realm/react": "^0.6.1" "realm": "^12.2.1"

tab avatar Nov 01 '23 09:11 tab

Unfortunately, this is a problem with realm-js. This was designed for a single React DOM tree.

I created an issue yesterday. https://github.com/realm/realm-js/issues/6233

However it's not the full solution. You must use e.g. mobx also (because React Context is also for a specific React DOM Tree only)

Take a look at: https://gist.github.com/aight8/21d78a05ff0f648fb93671879b2c83aa

aight8 avatar Nov 05 '23 16:11 aight8