I created a schema and imported it into App.js.
const ConfigSchema = {
BrandSchema: {
name: 'Brand',
primaryKey: 'id',
properties: {
id: 'string',
brandName: 'string',
icon: 'string',
partner: 'bool',
color: {
brand: 'string',
brandCustomer: 'string?',
brandPro: 'string?',
},
},
},
};
import ConfigSchema from './models/Schemas';
const {BrandSchema} = ConfigSchema;
When I create a realm and pass it the schema,
const realm = new Realm({
schema: [{name: BrandSchema.name, properties: BrandSchema.properties}],
deleteRealmIfMigrationNeeded: true,
});
I get the following error:
Unhandled JS Exception: Error: type must be of type 'string', got (undefined)
which tells me it’s not recognizing the schema object.
What exactly is undefined about the schema object? Passing in the whole object, schema: [{BrandSchema}],
fails as well. What am I doing wrong?