React native 在ios模拟器上使用chrome调试器中断领域

React native 在ios模拟器上使用chrome调试器中断领域,react-native,realm,realm-js,React Native,Realm,Realm Js,我已经用npx react native init AwesomeProject(=version 0.64.1)建立了一个非常基本的react原生项目,然后我用warn add realm安装了realm 10.4.1。此外,我们在ios文件夹中运行pod安装 接下来,我用一个非常简单的汽车模型创建一个额外的文件realm.ts: import Realm from 'realm' class Car { static schema = { name: "C

我已经用
npx react native init AwesomeProject
(=version 0.64.1)建立了一个非常基本的react原生项目,然后我用
warn add realm
安装了realm 10.4.1。此外,我们在ios文件夹中运行
pod安装

接下来,我用一个非常简单的汽车模型创建一个额外的文件realm.ts:

import Realm from 'realm'

class Car {
    static schema = {
        name: "Car",
        primaryKey: '_id',
        properties: {
            _id: "int",
            _make: "string",
            _model: "string",
            _miles: "int",
        },
    };

    private _make: string;
    private _model: string;

    get carName() {
        return `${this._make} ${this._model}`;
    }

    set make(value){
        this._make = value;
    }
}

const realm = new Realm({
    schema: [Car]
});

realm.write(() => {
  realm.create('Car', { _id: 1, _make: 'VW', _model: 'Golf', _miles: 0 });
})

const car = realm.objectForPrimaryKey('Car', 1)
console.log(car.isValid());

export default realm;
然后我在
App.js
中导入默认域

这非常有效,您将在控制台中看到
true
,正如行
console.log(car.isValid())所预期的那样

另一方面,如果我们在Chrome模式下激活Debug(全部在iPhone 12(iOS 14.5)模拟器上完成),我们将收到错误消息:

类型错误:car.isValid不是函数

停止调试器,它将再次工作。。。这是怎么回事