【问题标题】:"Super expression must either be null or a function, not object" error“超级表达式必须为空或函数,而不是对象”错误
【发布时间】:2016-05-19 15:46:43
【问题描述】:

我使用来自https://github.com/realm/realm-js/blob/master/examples/ReactExample/components/realm.js 的示例代码。

'use strict';

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',
        items: {type: 'list', objectType: 'Todo'},
    },
};

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

当我运行这个时,我得到了

超级表达式必须是 null 或函数,而不是对象

错误。

我正在使用

"react": "^0.14.8",
"react-native": "^0.25.1",
"realm": "^0.12.0",

我该如何解决这个问题?感谢您的任何提示!

【问题讨论】:

    标签: react-native realm react-native-android


    【解决方案1】:

    这已在即将发布的最新版本0.13.0 中得到修复。您现在可以通过在 package.json 中将版本设置为 0.13.0-rc 来尝试发布候选版

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-07-11
      • 2018-02-19
      • 2017-07-11
      • 2018-01-21
      • 2016-09-23
      • 2023-04-10
      • 1970-01-01
      相关资源
      最近更新 更多