现在,我正在尝试使用React Native,Mobx和Expo制作一个应用。
但是,在我安装Mobx并使Mobx的Store具有可观察性之后,出现了如下错误。
除了我提到的这些信息,我还使用了@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
}
});