用于观察者/观察的1数组数据不起作用2数组数据 更改,但不监视数据。 3数据长度20 4如何修复 它吗?
configure({
enforceActions: "observed"
});
class GozlemStore {
...
@observable misafirList = [];
@action async misafirListBTN(username, value) {
..if..
item.removeBTN = value;
break;
}
@action misafirAdd(name, surname, user) {
....
if(!isValid){
....
this.misafirListBTN(user, true);
..
this.masterProperty(listobj);
}
runInAction(()=>{
})
}
平面列表渲染功能
renderItem = ({ item }) => {
return (
<ListItem>
<Body>
...
</Body>
<Right>
{item.removeBTN == false ? (
<Icon type="FontAwesome" style={{ color: "#fe8a35" }} name="plus"
onPress={() => {
this.props.GozlemStore.misafirAdd(item.kulAd);
}}
/>
) : (
<Icon
type="FontAwesome"
style={{ color: "#fe8a35" }}
onPress={() => {
this.props.GozlemStore.misafirDelete(item.kulAd);
}}
name="remove"
/>
)}
</Right>
</ListItem>
);
};
平面列表组件
@inject("GozlemStore")
@observer
export default class MisafirModal extends Component {
...
<FlatList
data={GozlemStore.filtered}
renderItem={this.renderItem}
keyExtractor={(item, index) => index.toString()}
/>