Gathering detailed insights and metrics for @nonam4/react-native-bottom-sheet
Gathering detailed insights and metrics for @nonam4/react-native-bottom-sheet
Gathering detailed insights and metrics for @nonam4/react-native-bottom-sheet
Gathering detailed insights and metrics for @nonam4/react-native-bottom-sheet
npm install @nonam4/react-native-bottom-sheet
Typescript
Module System
Node Version
NPM Version
71.2
Supply Chain
98.8
Quality
75.4
Maintenance
100
Vulnerability
100
License
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
12.5%
18
Compared to previous week
Last Month
37.7%
95
Compared to previous month
Last Year
30.1%
2,453
Compared to previous year
Showcase iOS | Showcase Android |
---|---|
![]() | ![]() |
npm i @nonam4/react-native-bottom-sheet --save
yarn add @nonam4/react-native-bottom-sheet
1import React, { Component } from "react"; 2import { View, Button } from "react-native"; 3import RBSheet from "@nonam4/react-native-bottom-sheet"; 4 5export default class Example extends Component { 6 render() { 7 return ( 8 <View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}> 9 <Button title="OPEN BOTTOM SHEET" onPress={() => this.RBSheet.open()} /> 10 <RBSheet 11 ref={ref => { 12 this.RBSheet = ref; 13 }} 14 height={300} 15 openDuration={250} 16 customStyles={{ 17 container: { 18 justifyContent: "center", 19 alignItems: "center" 20 } 21 }} 22 > 23 <YourOwnComponent /> 24 </RBSheet> 25 </View> 26 ); 27 } 28}
1import React, { useRef } from "react"; 2import { View, Button } from "react-native"; 3import RBSheet from "@nonam4/react-native-bottom-sheet"; 4 5export default function Example() { 6 const refRBSheet = useRef<RBSheet | null>(null); 7 return ( 8 <View 9 style={{ 10 flex: 1, 11 justifyContent: "center", 12 alignItems: "center", 13 backgroundColor: "#000" 14 }} 15 > 16 <Button title="OPEN BOTTOM SHEET" onPress={() => refRBSheet.current?.open()} /> 17 <RBSheet 18 ref={refRBSheet} 19 closeOnDragDown={true} 20 closeOnPressMask={false} 21 customStyles={{ 22 wrapper: { 23 backgroundColor: "transparent" 24 }, 25 draggableIcon: { 26 backgroundColor: "#000" 27 } 28 }} 29 > 30 <YourOwnComponent /> 31 </RBSheet> 32 </View> 33 ); 34}
1renderItem = (item, index) => ( 2 <View> 3 <Button title={`OPEN BOTTOM SHEET-${index}`} onPress={() => this[RBSheet + index].open()} /> 4 <RBSheet 5 ref={ref => { 6 this[RBSheet + index] = ref; 7 }} 8 > 9 <YourOwnComponent onPress={() => this[RBSheet + index].close()} /> 10 </RBSheet> 11 </View> 12);
Props | Type | Description | Default |
---|---|---|---|
animationType | string | Background animation ("none", "fade", "slide") | "none" |
height | number | Height of Bottom Sheet | 260 |
minClosingHeight | number | Minimum height of Bottom Sheet before close | 0 |
minStartHeight | number | Minimum starting height of the bottom sheet before opening | 0 |
openDuration | number | Open Bottom Sheet animation duration | 300 (ms) |
closeDuration | number | Close Bottom Sheet animation duration | 200 (ms) |
closeOnDragDown | boolean | Use gesture drag down to close Bottom Sheet | false |
dragFromTopOnly | boolean | Drag only the top area of the draggableIcon to close Bottom Sheet instead of the whole content | false |
closeOnPressMask | boolean | Press the area outside to close Bottom Sheet | true |
closeOnPressBack | boolean | Press back android to close Bottom Sheet (Android only) | true |
onOpen | function | Callback function when Bottom Sheet has opened | null |
onClose | function | Callback function when Bottom Sheet has closed | null |
customStyles | object | Custom style to Bottom Sheet | {} |
keyboardAvoidingViewEnabled | boolean | Enable KeyboardAvoidingView | true (ios) |
customStyles: {
wrapper: {...}, // The Root of Component (You can change the `backgroundColor` or any styles)
container: {...}, // The Container of Bottom Sheet
draggableIcon: {...} // The Draggable Icon (If you set closeOnDragDown to true)
}
Method Name | Description |
---|---|
open | Open Bottom Sheet |
close | Close Bottom Sheet |
RBSheet
with react-native-gesture-handler, the components inside RBSheet will not fire onPress event on Android #37.example folder
.This project is licensed under the MIT License - see the LICENSE.md file for details
Made with ❤️ by NY Samnang.
Edited/updated by NoNam4.
No vulnerabilities found.