Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

[Realm/React-Native debugger]: constructor must be of type 'function', got (undefined)

It is working as well without debugger mode. But on debugger mode, I am getting error when try to create Realm object with schema parameters.

import Realm from 'realm';

class Todo extends Realm.Object {}
Todo.schema = {
    name: 'Todo',
    properties: {
        done: {type: 'bool', default: false},
        text: 'string',
    },
};

class TodoList extends Realm.Object {}
TodoList.schema = {
    name: 'TodoList',
    properties: {
        name: 'string',
        creationDate: 'date',
        items: {type: 'list', objectType: 'Todo'},
    },
};

export default new Realm({schema: [Todo, TodoList]});

Realm JS SDK Version: 2.17.0 React Native: 0.57.1

constructor must be of type 'function', got (undefined)

like image 620
Mustafa Buyukcelebi Avatar asked Oct 08 '18 23:10

Mustafa Buyukcelebi


1 Answers

This error only appears in version 2.18.0(latest) try downgrading to the version before 2.16.0

To downgrade the realm package

npm uninstall realm

npm install --save [email protected]
like image 164
Matheswaaran Avatar answered Nov 04 '22 09:11

Matheswaaran