ReRender child component of FlatList - React Native - react-native

I have a Flatlist that is rendered with dynamic data, Here is the heirarchy of components used.
FlatList
List Item
Image
Button
Now these child components are rendered via "RenderItem" method of Flatlist, and everything works fine as expected, Now When I want to change any "prop" of the button by using "state" it changes the state (i can see in log) but just cant see changes to the button, which means the button is not rendered after change of state, it works fine if i use it out of the Flatlist Component, but inside, it doesnot work at all.
Any Idea Why?

Related

React Native flatlist: why is onViewableItemsChanged called at initial render?

I have a simple question: why is onViewableItemsChanged called at initial render without a horizontal flatlist being even visible? This flatlist is only shown when scrolling to it.
How can I fix this?
Thank you!
It is also possible for onViewableItemsChanged to be called during the initial render of a FlatList, even if the list is not yet visible on the screen. This can happen if the initialNumToRender prop of the FlatList is set to a value greater than 0, causing the FlatList to render more items than the ones that are currently visible on the screen.
In such cases, the onViewableItemsChanged callback will receive the list of viewable items that have been rendered, but they will not yet be visible to the user. This is the expected behavior of the FlatList component, and it is designed to optimize the performance of the list by pre-rendering items that are likely to become visible in the near future.
If you want to avoid having onViewableItemsChanged being called during the initial render, you can set the initialNumToRender prop to 0, or use other techniques to control the visibility of the FlatList component, such as conditional rendering based on a state variable or a prop passed from the parent component.

React native flatlist nested child component issue

enter image description here
I am using react-native-modalizar with flatlist props, when I open custom made modal type component, it renders behind the next flatlist component. any solution please

React Native Text Selectable prop not working

I have a Text component which I would like to make selectable. I provided the Text component the selectable prop, however it isn't working. I am pretty sure that it is because I have it nested in a ScrollView and my pressing it is only registering on the scrollview. Any way to get past this?
Can provide a code example if needed.

React native - Paginated SectionList inside ScrollView

My screen layout is SectionList inside a View and on onEndReached I am calling an API to get paginated data successfully (LoadMore behaviour).
As, SectionList is covering only 40% part of screen, I tried adding ScrollView so that complete screen becomes scrollable.
Problem: When the screen loads it fetches the initial paginated data. After rendering the UI, onEndReached event gets fired which in-turn calls api to get load more data again. This runs in loop until the complete data is fetched.
Has anyone faced the same issue. Any solution how to stop that.
Instead of adding a SectionList inside ScrollView, What you can do is by adding your above view (i.e. your other 60% area) as header of the SectionList. This way your entire screen will be treated as SectionList, and onEndReached will only gets called when user performs scroll.

React Native Flatlist inside ScrollView

I am trying to develop a profile screen which has the persons profile pic, name, etc in the header as well as tabs that determines which data gets displayed in the FlatList below. I want the header component to be scrollable with the FlatList so that the header does not take up screen space while scrolling the FlatList. Also, the header's tabs will change the data that gets render in the list. I have tried two approaches but neither one has worked. Including the header and flatlist inside of a scrollview causes the flatlist to continually call onEndReach until all of the data is returned, but I also read that this is not recommended. The second approach was setting the ListHeaderComponent on the flatlist to the header component, but every time a tab is change the entire screen reloads. I am looking to have the header scrollable as if it were part of the flatlist, and only the flatlist re-render when a tab is pressed. Similar to what Instagram has with their profile screen. Any help with this issue would be much appreciated.