jasonmerino / react-native-realm

A higher-order component for listening to Realm data in React components.
https://www.npmjs.com/package/react-native-realm
63 stars 10 forks source link

Warning: forceUpdate #11

Closed DiederikvandenB closed 3 years ago

DiederikvandenB commented 6 years ago

Hi! I'm using this package together with react-native-navigation.

This is my setup:

Navigation.registerComponent('OverviewScreen', () => OverviewScreen, {}, RealmHoC);

const RealmHoC = (Component) => (
  <RealmProvider realm={realm}>
    {Component.children}
  </RealmProvider>
);

But I unfortunately get this warning:

Warning: forceUpdate(...): Can only update a mounted or mounting component. This usually means you called forceUpdate() on an unmounted component. This is a no-op.

Please check the code for the ConnectedRealmComponent component.
reactConsoleErrorHandler @ ExceptionsManager.js:73
console.error @ YellowBox.js:71
printWarning @ warning.js:33
warning @ warning.js:57
warnNoop @ react.development.js:123
enqueueForceUpdate @ react.development.js:159
Component.forceUpdate @ react.development.js:255
updateView @ connectRealm.js:68
sendRequest @ rpc.js:275
callMethod @ rpc.js:85
(anonymous) @ util.js:50
(anonymous) @ connectRealm.js:45
addListeners @ connectRealm.js:42
ConnectedRealmComponent @ connectRealm.js:23

When I remove this line from the code, the warning disappears, but that seems to break the rest of the application.

"react": "16.2.0",
"react-native": "0.51.0",