react native curved bottom bar
Release 3.4.0

反応ネイティブ用の高性能で美しく、完全にカスタマイズ可能な曲線下ナビゲーションバー。 React-Native-SVGおよび @React-Navigation/Bottom-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 | はい | タブバーとして表示するために反応要素を返す機能 |
| rendercircle | ({routename、selectedtab、navigate})=> jsx.element | はい | React Elementを[センタータブ]アイテムとして表示するために返す関数 |
| CircleWidth | 番号 | いいえ | センタータブアイテムの幅をカスタマイズします。最小値は50px、最大は60pxです |
| スタイル | viewstyle | いいえ | コンテナビュー用のスタイリング |
| ShadowStyle | viewstyle | いいえ | シャドウビューのスタイリング。 |
| 幅 | 番号 | いいえ | コンテナビューの幅をカスタマイズします |
| 身長 | 番号 | いいえ | コンテナビューの高さをカスタマイズし、最小値は50px、最大は90pxです |
| bordertopleftright | ブール | いいえ | コンテナビューの左上と右上のボーダー半径 |
| BorderColor | 弦 | いいえ | ボーダーカラー |
| 境界幅 | 番号 | いいえ | 境界幅 |
| bgcolor | 弦 | いいえ | コンテナビューの背景色 |
| 小道具 | パラメージ | isRequire | 説明 |
|---|---|---|---|
| 名前 | 弦 | はい | ジャンプするルートの名前 |
| 位置 | 「左」または「右」または「円」 | はい | タブバーアイコンの位置を円のボタンの左または右に設定します。 [サークル]を使用すると、[丸]ボタンが必要な場合にのみTabviewが必要です |
| 成分 | (小道具)=> jsx.element | はい | 宛先ルートにマージするための画面パラメーション |
| 関数 | パラメージ | 説明 |
|---|---|---|
| SetVisible | ブール | タブバーを非表示/表示するために使用されます。例: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' ,
} ,
} ) ; 