Realm returns blank when not using React Native Debugger
See original GitHub issueGoals
I’m trying to add an entity into Realm and then read and list it in another scene.
Expected Results
The data that is read is supposed to be rendered as a list. It does happen but the data itself is not present.
Actual Results
The data is saved to the database and is subsequently read from the database. A single item is rendered to the list, but all its values are empty. When clicking the item, a new screen opens which showcases all the data from that specific item (the item itself only shows 2 of the details) This only happens if I’m not running the React Native debugger. I’ve generated the debug APK for testing purposes and the error still persisted.
Steps to Reproduce
I’m not sure what can be done to reproduce this. I’m saving one item to a schema and later reading it. The data is retrieved but all the values in it are empty.
Code Sample
1.This is the code that reads the data from the database. None of the values are undefined or null. This return the blank data when not using the debugger:
const data = realm.objects('Visita').filtered(`matricula == '${this.props.matricula}' AND idObra == ${this.props.data.id}`)
- This is the code that created the data prior to it being read in another page:
getRealm()
.then(realm => {
/*Some boilerplatecode*/
realm.write(() => {
realm.create('Visita', visita)
})
- This is the schema that is being added:
export default class VisitaSchema {
static schema = {
name: 'Visita',
primaryKey: 'idVisita',
properties: {
idVisita: { type: 'int', indexed: true },
descricao: 'string',
latitude: 'string',
longitude: 'string',
matricula: 'string',
idObra: 'int',
data: 'string'
}
}
}
Version of Realm and Tooling
- Realm JS SDK Version: ?
- Node or React Native: ?
- Client OS & Version: ?
- Which debugger for React Native: ?/None
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:30 (8 by maintainers)
After a day of trying to get realm to work with a fresh react-native app, we’ve abandoned all hope. Best fix for this 2 year old issue is:
yarn remove realm
@manoj-makkuboy if you are using class models, please try extending from
Realm.Object
, like so: