加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

[Realm / React-Native debugger]:构造函数必须是’function’

发布时间:2020-12-15 05:07:47 所属栏目:百科 来源:网络整理
导读:它没有调试器模式也可以正常工作.但是在调试器模式下,我在尝试使用模式参数创建Realm对象时遇到错误. import Realm from 'realm';class Todo extends Realm.Object {}Todo.schema = { name: 'Todo',properties: { done: {type: 'bool',default: false},text:
它没有调试器模式也可以正常工作.但是在调试器模式下,我在尝试使用模式参数创建Realm对象时遇到错误.
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版本:2.17.0
React Native:0.57.1

constructor must be of type ‘function’,got (undefined)

此错误仅出现在版本2.18.0( latest)中,尝试降级到版本 before 2.16.0

降级领域包

npm uninstall realm

npm install --save realm@2.16.0

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读