如何使用Mobx和react-nativation解决本机错误?

时间:2019-03-13 07:38:51

标签: reactjs react-native expo mobx

现在,我正在尝试使用React Native,Mobx和Expo制作一个应用。

但是,在我安装Mobx并使Mobx的Store具有可观察性之后,出现了如下错误。

enter image description here

除了我提到的这些信息,我还使用了@observer和@inject,Provider之类的装饰器。

通过Provider添加我的组件代码。

import React from "react";
import { View, StyleSheet } from "react-native";
import { Provider } from "mobx-react/native";
import HomeHeader from "../Elements/Home/HomeHeader";
import HomeShopList from "../Elements/Home/HomeShopList";
import HomeAllCouponListButton from "../Elements/Home/HomeAllCouponListButton";
import HomeAllShopListButton from "../Elements/Home/HomeAllShopListButton";
import RestaurantStore from "../Stores/EachStores/RestaurantStore";

class Home extends React.Component {
  render() {
    const { navigation } = this.props;
    return (
      <View style={styles.container}>
        <HomeHeader />
        <Provider restaurantStore={RestaurantStore}>
          <HomeShopList navigation={navigation} />
        </Provider>
        <HomeAllCouponListButton />
        <HomeAllShopListButton />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1
  }
});

0 个答案:

没有答案