Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 28469

Error: Cannot access realm that has been closed?

$
0
0

I used the old version of realm. Today I updated the react-native and realm to the latest version and I get this error?

previous version of realm is "realm": "1.13.0", previous version of reactn-naitve is "react-native": "0.44.0",

My code was working fine, this is sample of code i used `

const getSetting = (name, defaultValue = '') => {
  if (!realm.objects('settings').isValid())
    return defaultValue;

  let data = realm.objects('settings').filtered('name = "'+ name +'"');
  return !data || data.length === 0 ? defaultValue : data[0].value;
};
export const getDeviceKey = () => {
      let deviceKey = getSetting("device_key");
      logger('settings.get.device_key:', typeof deviceKey, deviceKey);
      return deviceKey;
    };

`


Viewing all articles
Browse latest Browse all 28469

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>