Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
react-native-curved-bottom-bar
Advanced tools
A high performance, beautiful and fully customizable curved bottom navigation bar for React Native.
A high performance, beautiful and fully customizable curved bottom navigation bar for React Native. Implemented using react-native-svg and @react-navigation/bottom-tabs.
npm install react-native-curved-bottom-bar --save
or
yarn add react-native-curved-bottom-bar
Now we need to install react-native-svg and @react-navigation/bottom-tabs.
Props | Params | isRequire | Description |
---|---|---|---|
type | 'DOWN' or 'UP' | Yes | Type of the center tab item, downward curve or upward curve |
circlePosition | 'CENTER' or 'LEFT' or 'RIGHT' | No | Position of circle button |
initialRouteName | String | Yes | The name of the route to render on first load of the navigator |
tabBar | ({ routeName, selectedTab, navigate }) => JSX.Element | Yes | Function that returns a React element to display as the tab bar |
renderCircle | ({ routeName, selectedTab, navigate }) => JSX.Element | Yes | Function that returns a React element to display as the center tab item |
circleWidth | Number | No | Customize width of the center tab item. Minimum is 50px and Maximum is 60px |
style | ViewStyle | No | Styling for container view |
width | Number | No | Customize width for container view |
height | Number | No | Customize height for container view, Minimum is 50px and Maximum is 90px |
borderTopLeftRight | Boolean | No | Border radius top left and top right of container view |
bgColor | String | No | Background color of container view |
Props | Params | isRequire | Description |
---|---|---|---|
name | String | Yes | Name of the route to jump to |
position | 'LEFT' or 'RIGHT' or 'CIRCLE' | Yes | Set position of tabbar icon to the left or right of the circle button. Use type "CIRCLE" only when you want the circle button is a tabview |
component | (props) => JSX.Element | Yes | Screen params to merge into the destination route |
Function | Params | Description |
---|---|---|
setVisible | Boolean | Used to hide/show the tab bar. Ex: ref.current.setVisible(false) |
import React from 'react';
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 tabBar = () => {
const _renderIcon = (routeName, selectedTab) => {
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 }) => {
return (
<TouchableOpacity
onPress={() => navigate(routeName)}
style={{
flex: 1,
alignItems: 'center',
justifyContent: 'center',
}}>
{_renderIcon(routeName, selectedTab)}
</TouchableOpacity>
);
};
return (
<View style={{ flex: 1 }}>
<NavigationContainer>
<CurvedBottomBar.Navigator
style={styles.bottomBar}
height={55}
circleWidth={50}
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,
},
});
import React from 'react';
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 tabBar = () => {
const _renderIcon = (routeName, selectedTab) => {
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 }) => {
return (
<TouchableOpacity
onPress={() => navigate(routeName)}
style={{
flex: 1,
alignItems: 'center',
justifyContent: 'center',
}}>
{_renderIcon(routeName, selectedTab)}
</TouchableOpacity>
);
};
return (
<View style={{ flex: 1 }}>
<NavigationContainer>
<CurvedBottomBar.Navigator
type="UP"
style={styles.bottomBar}
height={55}
circleWidth={50}
bgColor="white"
initialRouteName="title1"
borderTopLeftRight
renderCircle={({ selectedTab, navigate }) => (
<Animated.View style={styles.btnCircleUp}>
<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: {},
btnCircleUp: {
width: 60,
height: 60,
borderRadius: 30,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: '#E8E8E8',
bottom: 18,
shadowColor: '#000',
shadowOffset: {
width: 0,
height: 1,
},
shadowOpacity: 0.2,
shadowRadius: 1.41,
elevation: 1,
},
imgCircle: {
width: 30,
height: 30,
tintColor: 'gray',
},
img: {
width: 30,
height: 30,
},
});
FAQs
A high performance, beautiful and fully customizable curved bottom navigation bar for React Native.
The npm package react-native-curved-bottom-bar receives a total of 1,090 weekly downloads. As such, react-native-curved-bottom-bar popularity was classified as popular.
We found that react-native-curved-bottom-bar demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.