Skip to content
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

Perfomance when wrap bottom bar with Stack.Navigator #56

Open
ducpt-bili opened this issue Mar 17, 2023 · 8 comments
Open

Perfomance when wrap bottom bar with Stack.Navigator #56

ducpt-bili opened this issue Mar 17, 2023 · 8 comments

Comments

@ducpt-bili
Copy link

The bottom tab is so lagging when i combine Curved Bottom Bar and Stack navigator. The layer is like this:

  • Stack.Navigator:
    • Stack.Screen with component is Curved Bottom Bar
    • Stack.Screen is other screen.

Thank you.

@arun-saleth
Copy link

Yes i am also facing issue while using nesting navigation.when clicking tab icons so much delay to navigate

@hoaphantn7604
Copy link
Owner

hi @ducpt-bili , @arun-saleth ,
What steps can I follow to replicate the issue you are experiencing?
Have you tried using React.memo and then wrapping the BottomBar?

@arun-saleth
Copy link

I will share my code here

<CurvedBottomBar.Navigator
style={styles.bottomBar}
screenOptions={{ headerShown: false }}
strokeColor="#DDDDDD"
circleWidth={60}
strokeWidth={1}
bgColor="white"
shadowStyle={styles.shawdow}
initialRouteName="Home"
// width={isTablet ? width / 2.3 : width}
borderTopLeftRight
renderCircle={({ selectedTab, navigate }) => (
<Animated.View style={styles.btnCircle}>
<TouchableOpacity
style={{
alignItems: "center",
flex: 1,
justifyContent: "center",
}}
onPress={pressfunc}
>


</Animated.View>
)}
tabBar={RenderTabBar}
>
<CurvedBottomBar.Screen name="Home" position="LEFT" component={Dashboardscreen} />
<CurvedBottomBar.Screen name="Job" component={isTablet && width > 700 ? JobstabletScreen : Jobscreen} position="LEFT" />
<CurvedBottomBar.Screen name="Calendar" component={CalendarScreen} position="RIGHT" />
<CurvedBottomBar.Screen name="Task" component={isTablet && width > 700 ? TasktabletScreen : Taskscreen} position="RIGHT" />
</CurvedBottomBar.Navigator>

const RenderTabBar = ({ routeName, selectedTab, navigate }) => {
return (
<TouchableOpacity
onPress={() => navigate(routeName)}
style={{
height: 50,
alignItems: "center",
}}
>
{_renderIcon(routeName, selectedTab)}

);
};

const _renderIcon = (routeName, selectedTab) => {
let icon = "";
switch (routeName) {
case "Home":
icon = routeName === selectedTab ? :
break;
case "Job":
icon = routeName === selectedTab ? :
break;
case "Calendar":
icon = routeName === selectedTab ? :
break;
case "Task":
icon = routeName === selectedTab ? :
break;
}

return (
    <View style={styles.btmname}>
        <View>{icon}</View>
        <Text style={{ color: routeName === selectedTab ? Color.skyblue : "grey" }}>
            {routeName}
        </Text>
    </View>
);

};

My nesting navigation structure:

 ------------------ Inside Drawernavigation I am using tab navigation -----------------------------------------   
    
        
         <Drawer.Navigator screenOptions={{ headerShown: false }} initialRouteName='HomeDrawer' drawerContent={(props) => <CustomDrawerContent
        {...props} />}>
        <Drawer.Screen name="HomeDrawer" component={TabNavigation} options={{ title: 'Home' }} />
    </Drawer.Navigator>

@arun-saleth
Copy link

@hoaphantn7604 when I expect this? .too much lagging

@arun-saleth
Copy link

@hoaphantn7604 I tried memo.Its woking perfectly.Thank you for your Suggestions

@jelyqs
Copy link

jelyqs commented May 12, 2023

Hi @arun-saleth

Can you share with me where to handle useMemo?

@Sulaiman122
Copy link

@hoaphantn7604 @arun-saleth
it's slow for me, I don't know why, tried useMemo didn't change
maybe i wrote it wrong, could you explain how to use useMemo or if there is another solution to this issue please help

@anhnguyen123
Copy link

CHÀO@ducpt-bili,@arun-saleth, Tôi có thể làm theo những bước nào để tái hiện vấn đề bạn đang gặp phải? Bạn đã thử sử dụng React.memo và sau đó gói BottomBar chưa?

Do you mean wrap usememo to cover the entire bottom bar?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants