Reputation: 428
I'm having problems updating the React local state from a child component.
here my reproducible code.
Basically there are 3 tabs, the active one is the second one. When you click on another tabs, the state is not updated correctly. What am I missing?
This is not really a React Native related question, it's simply a React related.
Note: I can't restructure the entire component, so I can't transform it to a function component and so I can't use hooks.
Upvotes: 0
Views: 32
Reputation: 12777
Because you are using onPress with wrong params. You just update like this:
onPress={() => onPress(tabKey)}
Upvotes: 1