Comments (16)
Thank you for the clarification.
from react-native-curved-bottom-bar.
hi All,
Refer Ex:
import React from 'react';
import { Alert, Animated, TouchableOpacity, View } from 'react-native';
import { CurvedBottomBar } from 'react-native-curved-bottom-bar';
import { scale } from 'react-native-size-scaling';
import Ionicons from 'react-native-vector-icons/Ionicons';
import HomeScreen from 'screens/home';
import SettingScreen from 'screens/setting';
import { styles } from './styles';
export const bottomBarRef = React.createRef<any>();
// bottomBarRef?.current?.setVisible(false); //Hidden
// bottomBarRef?.current?.setVisible(true); //Visible
export const tabBar = () => {
const _renderIcon = (routeName: string, selectedTab: string) => {
let icon = '';
switch (routeName) {
case 'title1':
icon = 'ios-home-outline';
break;
case 'title2':
icon = 'settings-outline';
break;
}
return <Ionicons name={icon} size={scale(25)} color={routeName === selectedTab ? 'black' : 'gray'} />;
};
const renderTabBar = ({ routeName, selectedTab, navigate }: any) => {
return (
<TouchableOpacity
onPress={() => navigate(routeName)}
style={{
flex: 1,
alignItems: 'center',
justifyContent: 'center',
}}>
{_renderIcon(routeName, selectedTab)}
</TouchableOpacity>
);
};
return (
<View style={{ flex: 1 }}>
<CurvedBottomBar.Navigator
ref={bottomBarRef}
style={styles.bottomBar}
strokeWidth={0.5}
height={scale(55)}
circleWidth={scale(55)}
bgColor="white"
initialRouteName="title1"
renderCircle={({ selectedTab, navigate }) => (
<Animated.View style={styles.btnCircle}>
<TouchableOpacity
style={{
flex: 1,
justifyContent: 'center',
}}
onPress={() => Alert.alert('Click Action')}>
<Ionicons name={'apps-sharp'} color="gray" size={scale(25)} />
</TouchableOpacity>
</Animated.View>
)}
tabBar={renderTabBar}>
<CurvedBottomBar.Screen name="title1" position="LEFT" component={({ navigate }) => <HomeScreen />} />
<CurvedBottomBar.Screen name="title2" position="RIGHT" component={({ navigate }) => <SettingScreen />} />
</CurvedBottomBar.Navigator>
</View>
);
};
from react-native-curved-bottom-bar.
Hi @iamsaadMehmood ,
Iām working on it.
from react-native-curved-bottom-bar.
hi @hoaphantn7604,
Sure and Thanks for replying
from react-native-curved-bottom-bar.
hi @iamsaadMehmood ,
Now has more method setVisible. Used to hide/show the tab bar. Ex: ref.current.setVisible(false).
Please install later version (2.1.0).
from react-native-curved-bottom-bar.
Can you be a little more descriptive about how to use the setVisible method?
from react-native-curved-bottom-bar.
Hi @Amitdutta121 ,
Use react Ref. Call method ref.current.setVisible(false) to hidden, ref.current.setVisible(true) to show.
from react-native-curved-bottom-bar.
How to get the ref of the bottom tab?
from react-native-curved-bottom-bar.
@hoaphantn7604 we can use it by navigation.getParent()?.setVisible(false) right??
from react-native-curved-bottom-bar.
not able to use it this way cause it says "undefined" is not a function
from react-native-curved-bottom-bar.
@iamsaadMehmood I faced a problem where Touchable opacity is not working on top of the screen after using this library. Manly, if you had any button at the top of the screen, the android touch event does not register. Did you face such problems?
from react-native-curved-bottom-bar.
@iamsaadMehmood I faced a problem where Touchable opacity is not working on top of the screen after using this library. Manly, if you had any button at the top of the screen, the android touch event does not register. Did you face such problems?
Re-check with later version 2.1.1
from react-native-curved-bottom-bar.
@hoaphantn7604 @iamsaadMehmood
Even after updating to the latest version getting the same error.hi All, Refer Ex:
import React from 'react'; import { Alert, Animated, TouchableOpacity, View } from 'react-native'; import { CurvedBottomBar } from 'react-native-curved-bottom-bar'; import { scale } from 'react-native-size-scaling'; import Ionicons from 'react-native-vector-icons/Ionicons'; import HomeScreen from 'screens/home'; import SettingScreen from 'screens/setting'; import { styles } from './styles'; export const bottomBarRef = React.createRef<any>(); // bottomBarRef.current.setVisible(false); //Hidden // bottomBarRef.current.setVisible(false); //Visible export const tabBar = () => { const _renderIcon = (routeName: string, selectedTab: string) => { let icon = ''; switch (routeName) { case 'title1': icon = 'ios-home-outline'; break; case 'title2': icon = 'settings-outline'; break; } return <Ionicons name={icon} size={scale(25)} color={routeName === selectedTab ? 'black' : 'gray'} />; }; const renderTabBar = ({ routeName, selectedTab, navigate }: any) => { return ( <TouchableOpacity onPress={() => navigate(routeName)} style={{ flex: 1, alignItems: 'center', justifyContent: 'center', }}> {_renderIcon(routeName, selectedTab)} </TouchableOpacity> ); }; return ( <View style={{ flex: 1 }}> <CurvedBottomBar.Navigator ref={bottomBarRef} style={styles.bottomBar} strokeWidth={0.5} height={scale(55)} circleWidth={scale(55)} bgColor="white" initialRouteName="title1" renderCircle={({ selectedTab, navigate }) => ( <Animated.View style={styles.btnCircle}> <TouchableOpacity style={{ flex: 1, justifyContent: 'center', }} onPress={() => Alert.alert('Click Action')}> <Ionicons name={'apps-sharp'} color="gray" size={scale(25)} /> </TouchableOpacity> </Animated.View> )} tabBar={renderTabBar}> <CurvedBottomBar.Screen name="title1" position="LEFT" component={({ navigate }) => <HomeScreen />} /> <CurvedBottomBar.Screen name="title2" position="RIGHT" component={({ navigate }) => <SettingScreen />} /> </CurvedBottomBar.Navigator> </View> ); };
from react-native-curved-bottom-bar.
@hoaphantn7604 @iamsaadMehmood
hi All, Refer Ex:
import React from 'react'; import { Alert, Animated, TouchableOpacity, View } from 'react-native'; import { CurvedBottomBar } from 'react-native-curved-bottom-bar'; import { scale } from 'react-native-size-scaling'; import Ionicons from 'react-native-vector-icons/Ionicons'; import HomeScreen from 'screens/home'; import SettingScreen from 'screens/setting'; import { styles } from './styles'; export const bottomBarRef = React.createRef<any>(); // bottomBarRef.current.setVisible(false); //Hidden // bottomBarRef.current.setVisible(false); //Visible export const tabBar = () => { const _renderIcon = (routeName: string, selectedTab: string) => { let icon = ''; switch (routeName) { case 'title1': icon = 'ios-home-outline'; break; case 'title2': icon = 'settings-outline'; break; } return <Ionicons name={icon} size={scale(25)} color={routeName === selectedTab ? 'black' : 'gray'} />; }; const renderTabBar = ({ routeName, selectedTab, navigate }: any) => { return ( <TouchableOpacity onPress={() => navigate(routeName)} style={{ flex: 1, alignItems: 'center', justifyContent: 'center', }}> {_renderIcon(routeName, selectedTab)} </TouchableOpacity> ); }; return ( <View style={{ flex: 1 }}> <CurvedBottomBar.Navigator ref={bottomBarRef} style={styles.bottomBar} strokeWidth={0.5} height={scale(55)} circleWidth={scale(55)} bgColor="white" initialRouteName="title1" renderCircle={({ selectedTab, navigate }) => ( <Animated.View style={styles.btnCircle}> <TouchableOpacity style={{ flex: 1, justifyContent: 'center', }} onPress={() => Alert.alert('Click Action')}> <Ionicons name={'apps-sharp'} color="gray" size={scale(25)} /> </TouchableOpacity> </Animated.View> )} tabBar={renderTabBar}> <CurvedBottomBar.Screen name="title1" position="LEFT" component={({ navigate }) => <HomeScreen />} /> <CurvedBottomBar.Screen name="title2" position="RIGHT" component={({ navigate }) => <SettingScreen />} /> </CurvedBottomBar.Navigator> </View> ); };Even after updating to the latest version getting the same error.
@vipulchakravarthy Did you find any solution to it? please let me know. I am facing the same issue. TIA
from react-native-curved-bottom-bar.
hi @vipulchakravarthy & @Munir-Hassan ,
We need to check if the tabBarRef is initialized before calling the function. tabBarRef?.current?.setVisible()
import React, { createRef } from 'react'; // <== import createRef
import {
Alert,
Animated,
StyleSheet,
TouchableOpacity,
View,
} from 'react-native';
import { CurvedBottomBar } from 'react-native-curved-bottom-bar';
import Ionicons from 'react-native-vector-icons/Ionicons';
import { NavigationContainer } from '@react-navigation/native';
export const tabBarRef: any = createRef(); // <== Call this function to hide tabbar tabBarRef?.current?.setVisible(false);
export const tabBar = () => {
const _renderIcon = (routeName: string, selectedTab: string) => {
let icon = '';
switch (routeName) {
case 'title1':
icon = 'ios-home-outline';
break;
case 'title2':
icon = 'settings-outline';
break;
}
return (
<Ionicons
name={icon}
size={25}
color={routeName === selectedTab ? 'black' : 'gray'}
/>
);
};
const renderTabBar = ({ routeName, selectedTab, navigate }: any) => {
return (
<TouchableOpacity
onPress={() => navigate(routeName)}
style={{
flex: 1,
alignItems: 'center',
justifyContent: 'center',
}}>
{_renderIcon(routeName, selectedTab)}
</TouchableOpacity>
);
};
return (
<View style={{ flex: 1 }}>
<NavigationContainer>
<CurvedBottomBar.Navigator
ref={tabBarRef} // <== Add line
style={styles.bottomBar}
strokeWidth={0.5}
strokeColor="#DDDDDD"
height={55}
circleWidth={55}
bgColor="white"
initialRouteName="title1"
borderTopLeftRight
renderCircle={({ selectedTab, navigate }) => (
<Animated.View style={styles.btnCircle}>
<TouchableOpacity
style={{
flex: 1,
justifyContent: 'center',
}}
onPress={() => Alert.alert('Click Action')}>
<Ionicons name={'apps-sharp'} color="gray" size={25} />
</TouchableOpacity>
</Animated.View>
)}
tabBar={renderTabBar}>
<CurvedBottomBar.Screen
name="title1"
position="LEFT"
component={() => (
<View style={{ backgroundColor: '#BFEFFF', flex: 1 }} />
)}
/>
<CurvedBottomBar.Screen
name="title2"
component={() => (
<View style={{ backgroundColor: '#FFEBCD', flex: 1 }} />
)}
position="RIGHT"
/>
</CurvedBottomBar.Navigator>
</NavigationContainer>
</View>
);
};
export const styles = StyleSheet.create({
container: {
flex: 1,
padding: 20,
},
button: {
marginVertical: 5,
},
bottomBar: {},
btnCircle: {
width: 60,
height: 60,
borderRadius: 35,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: 'white',
padding: 10,
shadowColor: '#000',
shadowOffset: {
width: 0,
height: 0.5,
},
shadowOpacity: 0.2,
shadowRadius: 1.41,
elevation: 1,
bottom: 30,
},
imgCircle: {
width: 30,
height: 30,
tintColor: 'gray',
},
img: {
width: 30,
height: 30,
},
});
from react-native-curved-bottom-bar.
not working for me. even if i try to log the tabBarRef
, I will get this error:
ERROR Error: Couldn't find a 'component', 'getComponent' or 'children' prop for the screen 'Notifications'. This can happen if you passed 'undefined'. You likely forgot to export your component from the file it's defined in, or mixed up default import and named import when importing.
from react-native-curved-bottom-bar.
Related Issues (20)
- setVisible set to true cant show again the tab bar
- react-native-curved-bottom-bar doesn't seem to be linked.make sure:
- react-native-curved-bottom-bar doesn't seem to be linked.make sure: HOT 7
- Support screen options HOT 7
- Perfomance when wrap bottom bar with Stack.Navigator HOT 8
- Lagging while clicking the tabs HOT 2
- Can we add borderColor and borderWidth to curved tab HOT 6
- Render all tabs at startup/mounting HOT 3
- Bottom padding to <CurvedBottomBar.Navigator /> component style HOT 1
- [Android] Shadow issue on Expo HOT 4
- Work with expo-router
- options={{headerShown: false}} in CurvedBottomBar.Screen is not working HOT 8
- headerShown is false HOT 7
- i am trying to show component when user click on middle circle <Animated.view
- Dynamic changing of icon
- Border Width and Radius issue HOT 1
- custom curves HOT 1
- Navigating to stack with curved bottom bar shows white screen HOT 1
- strokeColor and strokeWidth issue on V3 HOT 1
- Curved Border colour and border width
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-curved-bottom-bar.