-
Type: Bug
-
Resolution: Duplicate
-
Priority: Critical - P2
-
None
-
Affects Version/s: None
-
Component/s: None
-
SDK FY21-Q3.
-
3138
Hi, i took a completely new init, and compared a JSON.stringify of a class vs non class.
It appears that a class dosen't seem to show the properties of the schema. Not sure if its expected.
You will realize the code is exactly the same as the docs. (using the person class example and the dog json example)
And you can see the dog works but the person does not
"react-native": "0.63.2",
"realm": "^6.0.4"
class Person { get fullName() { return this.firstName + ' ' + this.lastName; } } Person.schema = { name: 'Person', properties: { firstName: 'string', lastName: 'string', }, }; const App: () => React$Node = () => { const [realm, setRealm] = useState(null) useEffect (()=>{ Realm.open({ schema: [ { name: 'Dog', properties: {name: 'string'} }, Person ] }).then(realm => { realm.write(() => { realm.create('Dog', {name: 'Rex'}); const john = realm.create('Person', { firstName: 'John', lastName: 'Smith', }); }); let dogs = realm.objects('Dog'); let persons = realm.objects('Person'); for (let d of dogs) console.log("dog ", JSON.stringify(d)) for (let p of persons) console.log("person ", JSON.stringify(p)) setRealm({ realm }); }); }, [])
- duplicates
-
RJS-719 TypeError: Reflect.construct requires the first argument to be a constructor
- Closed