TypeError:mobx-persist react-native中没有默认值

时间:2018-10-30 18:10:27

标签: react-native react-native-android mobx mobx-persist

这仅在没有远程js调试的android中发生。持久性在调试模式和ios中工作正常。

在写入持久化可观察变量期间也有an uncaught exception thrown by a reaction or observer component

这是我的商店:

class UserStore {

  @observable
  token = null;

  @observable
  location = null;

  @observable
  mobile_number = null;

  @action.bound
  updateToken(token = "") {
    this.token = token;
  }

  @action.bound
  updateLocation(location) {
    this.location = location;
  }

  @action.bound
  updateMobileNumber(mobile_number) {
    this.mobile_number = mobile_number;
  }
}

class RootStore {
  @persist("object")
  @observable
  userStore = new UserStore();
}

这是水合物呼叫

hydrate("userStore", this.props.store, {
      token: null,
      location: null,
      mobile_number: null
}).then(() => {
      console.log("UserStore obtained");
});

0 个答案:

没有答案