-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React component does not react to mobx observable data #15507
Comments
Update: I have added a Text component before the FlatList. Adding a Text component or console logging inside the component class's render method does make the FlatList react to the changes. I don't know why this is happening though.
|
this is not a react native issue, but more about understanding mobx. I suggest you open up a stackoverflow question for that and I'll answer it :) |
@facebook-github-bot no-template |
1 similar comment
@facebook-github-bot no-template |
Hey, thanks for reporting this issue! It looks like your description is missing some necessary information, or the list of reproduction steps is not complete. Can you please add all the details specified in the Issue Template? This is necessary for people to be able to understand and reproduce the issue being reported. I am going to close this, but feel free to open a new issue with the additional information provided. Thanks! See "What to Expect from Maintainers" to learn more. |
Hey, thanks for reporting this issue! It looks like your description is missing some necessary information, or the list of reproduction steps is not complete. Can you please add all the details specified in the Issue Template? This is necessary for people to be able to understand and reproduce the issue being reported. I am going to close this, but feel free to open a new issue with the additional information provided. Thanks! See "What to Expect from Maintainers" to learn more. |
I am using mobX for my react native project. Please consider this store class:
And this is the react component:
From above it looks to me that:
When the Flat component mounts, it calls the method of the store
setListOne()
.setListOne()
setsfetchingListOne
to true and makes an API call.On the component side, when the
fetchingListOne
is true, the ActivityIndicator displays, and in the ListHeaderComponent it should display true.On the store side, after a successful/unsuccessful response, it sets
fetchingListOne
to false.Finally on the component side, because
fetchingListOne
is set to false, ActivityIndicator should not display and in the ListHeaderComponent it should display false.However, this is not what's happening. Here, when the
setListOne()
method is called after it sets thefetchingListOne
to true, the component does not react to the changes made after API call. And the ActivityIndicator keeps displaying and in ListHeaderComponent it's displaying true.What am I doing wrong here? Could you please help me. Thank you
I am using:
The text was updated successfully, but these errors were encountered: