SrBrahma / react-native-shadow-2

Cross-platform shadow for React Native. Supports Android, iOS, Web, and Expo
MIT License
664 stars 55 forks source link

I'm using react-native-shadow-2 but it's weirdly slow when switching to screen ? #80

Closed sindarovcoder closed 5 months ago

sindarovcoder commented 5 months ago

My code: ` <View style={{ justifyContent: "space-between", flexDirection: "row", gap: 6 }}> {lngs.map((item) => (

changeLanguage(item?.value)}> {item.flag} {item?.title}
            ))}
             </View>`

work without react-native-shadow-2: Screencast from 2024-04-24 12-32-56.webm

Working with react-native-shadow-2: Screencast from 2024-04-24 12-32-06.webm

sindarovcoder commented 5 months ago

Thanks in advance for the reply

SrBrahma commented 5 months ago

Try to wrap your Shadow component and content with React.memo/useMemo.

Maybe the transition is causing a re-render of the shadow for every animation frame, which is costly.

By using the memo, the component won't be calculated again if the dependencies don't change.