react-native-paper-tabs
react-native-paper-tabs copied to clipboard
Initial load of tab screens rendered twice
Is there a way to prevent all screens from re-rendering on initial load?
Thanks
Wrap the subscreen in a React.memo should fix it there. Does this happen on the web version or ios/android?
they are already wrapper with React.memo however still no luck. Also, each swipe action all of the TabScreens are loaded as well. I am using React Native IOS simulator
Where do you put the React.memo? do you use the use the useTabIndex()?
You need to
<TabScreen label="Flights" icon="airplane">
<Flights />
</TabScreen>
Flights.tsx/js
function Flights(){
console.log('re render flights')
return View style={{ backgroundColor: 'black', flex:1 }} />
}
export default React.memo(Flights)
Hi, thanks for this library, I have the same problem, I already apply React.Memo, also all the TabScreens are rendered at the beginning
(I'm using Expo, the project is in production, iOS and Android)
Please provide a simple snack