react native curved bottom bar
Release 3.4.0

高性能,美丽且完全可定制的曲面导航杆,用于React Native。使用React-Native-SVG和 @React-Navigation/Boty-Tabs实施。
If you love this library , give us a star , you will be a ray of sunshine in our lives : )用美丽的UI反应本地模板。
npm install react - native - curved - bottom - bar -- save或者
yarn add react - native - curved - bottom - bar现在,我们需要安装React-Native-SVG和 @React-Navigation/bottom-tabs。


| 道具 | 参数 | Isrequire | 描述 |
|---|---|---|---|
| 类型 | “下降”或“向上” | 是的 | 中心标签项目的类型,向下曲线或向上曲线 |
| 圆形 | “中心”或“左”或“右” | 不 | 圆按钮的位置 |
| InitialRoutEname | 细绳 | 是的 | 在导航器的首次负载上渲染路线的名称 |
| 塔巴尔 | ({routename,SelectedTab,navigate})=> jsx.element | 是的 | 返回React元素以显示为选项卡栏的函数 |
| rendercircle | ({routename,SelectedTab,navigate})=> jsx.element | 是的 | 返回React元素以显示为“中心”选项卡项目的函数 |
| 圆宽 | 数字 | 不 | 自定义中心标签项目的宽度。最低为50px,最大为60px |
| 风格 | ViewStyle | 不 | 容器视图的造型 |
| 阴影风格 | ViewStyle | 不 | 阴影视图的样式。 |
| 宽度 | 数字 | 不 | 自定义容器视图的宽度 |
| 高度 | 数字 | 不 | 自定义容器视图的高度,最小值为50px,最大为90px |
| BorderTopleFright | 布尔 | 不 | 边界半径左上和顶部的容器视图 |
| 边界色 | 细绳 | 不 | 边框颜色 |
| 边界开关 | 数字 | 不 | 边界宽度 |
| bgcolor | 细绳 | 不 | 容器视图的背景颜色 |
| 道具 | 参数 | Isrequire | 描述 |
|---|---|---|---|
| 姓名 | 细绳 | 是的 | 跳到路线的名称 |
| 位置 | “左”或“右”或“圆” | 是的 | 将塔巴尔图标的位置设置在圆按钮的左侧或右侧。仅当要圆按钮是tabview时才使用类型“圆” |
| 成分 | (props)=> jsx.element | 是的 | 屏幕参数合并到目标路线 |
| 功能 | 参数 | 描述 |
|---|---|---|
| 可见 | 布尔 | 用于隐藏/显示标签栏。例如:ref.current.setvisible(false) |

import React from 'react' ;
import {
Alert ,
Animated ,
StyleSheet ,
TouchableOpacity ,
View ,
} from 'react-native' ;
import { CurvedBottomBarExpo } from 'react-native-curved-bottom-bar' ;
import Ionicons from '@expo/vector-icons/Ionicons' ;
import { NavigationContainer } from '@react-navigation/native' ;
const Screen1 = ( ) => {
return < View style = { styles . screen1 } /> ;
} ;
const Screen2 = ( ) => {
return < View style = { styles . screen2 } /> ;
} ;
export default function App ( ) {
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 = { styles . tabbarItem }
>
{ _renderIcon ( routeName , selectedTab ) }
</ TouchableOpacity >
) ;
} ;
return (
< NavigationContainer >
< CurvedBottomBarExpo . Navigator
type = "DOWN"
style = { styles . bottomBar }
shadowStyle = { styles . shawdow }
height = { 55 }
circleWidth = { 50 }
bgColor = "white"
initialRouteName = "title1"
borderTopLeftRight
renderCircle = { ( { selectedTab , navigate } ) => (
< Animated . View style = { styles . btnCircleUp } >
< TouchableOpacity
style = { styles . button }
onPress = { ( ) => Alert . alert ( 'Click Action' ) }
>
< Ionicons name = { 'apps-sharp' } color = "gray" size = { 25 } />
</ TouchableOpacity >
</ Animated . View >
) }
tabBar = { renderTabBar }
>
< CurvedBottomBarExpo . Screen
name = "title1"
position = "LEFT"
component = { ( ) => < Screen1 /> }
/>
< CurvedBottomBarExpo . Screen
name = "title2"
component = { ( ) => < Screen2 /> }
position = "RIGHT"
/>
</ CurvedBottomBarExpo . Navigator >
</ NavigationContainer >
) ;
}
export const styles = StyleSheet . create ( {
container : {
flex : 1 ,
padding : 20 ,
} ,
shawdow : {
shadowColor : '#DDDDDD' ,
shadowOffset : {
width : 0 ,
height : 0 ,
} ,
shadowOpacity : 1 ,
shadowRadius : 5 ,
} ,
button : {
flex : 1 ,
justifyContent : 'center' ,
} ,
bottomBar : { } ,
btnCircleUp : {
width : 60 ,
height : 60 ,
borderRadius : 30 ,
alignItems : 'center' ,
justifyContent : 'center' ,
backgroundColor : '#E8E8E8' ,
bottom : 30 ,
shadowColor : '#000' ,
shadowOffset : {
width : 0 ,
height : 1 ,
} ,
shadowOpacity : 0.2 ,
shadowRadius : 1.41 ,
elevation : 1 ,
} ,
imgCircle : {
width : 30 ,
height : 30 ,
tintColor : 'gray' ,
} ,
tabbarItem : {
flex : 1 ,
alignItems : 'center' ,
justifyContent : 'center' ,
} ,
img : {
width : 30 ,
height : 30 ,
} ,
screen1 : {
flex : 1 ,
backgroundColor : '#BFEFFF' ,
} ,
screen2 : {
flex : 1 ,
backgroundColor : '#FFEBCD' ,
} ,
} ) ;
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' ;
const Screen1 = ( ) => {
return < View style = { styles . screen1 } /> ;
} ;
const Screen2 = ( ) => {
return < View style = { styles . screen2 } /> ;
} ;
export default function App ( ) {
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 = { styles . tabbarItem }
>
{ _renderIcon ( routeName , selectedTab ) }
</ TouchableOpacity >
) ;
} ;
return (
< NavigationContainer >
< CurvedBottomBar . Navigator
type = "UP"
style = { styles . bottomBar }
shadowStyle = { styles . shawdow }
height = { 55 }
circleWidth = { 50 }
bgColor = "white"
initialRouteName = "title1"
borderTopLeftRight
renderCircle = { ( { selectedTab , navigate } ) => (
< Animated . View style = { styles . btnCircleUp } >
< TouchableOpacity
style = { styles . button }
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 = { ( ) => < Screen1 /> }
/>
< CurvedBottomBar . Screen
name = "title2"
component = { ( ) => < Screen2 /> }
position = "RIGHT"
/>
</ CurvedBottomBar . Navigator >
</ NavigationContainer >
) ;
}
export const styles = StyleSheet . create ( {
container : {
flex : 1 ,
padding : 20 ,
} ,
shawdow : {
shadowColor : '#DDDDDD' ,
shadowOffset : {
width : 0 ,
height : 0 ,
} ,
shadowOpacity : 1 ,
shadowRadius : 5 ,
} ,
button : {
flex : 1 ,
justifyContent : 'center' ,
} ,
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' ,
} ,
tabbarItem : {
flex : 1 ,
alignItems : 'center' ,
justifyContent : 'center' ,
} ,
img : {
width : 30 ,
height : 30 ,
} ,
screen1 : {
flex : 1 ,
backgroundColor : '#BFEFFF' ,
} ,
screen2 : {
flex : 1 ,
backgroundColor : '#FFEBCD' ,
} ,
} ) ; 