- Notifications
You must be signed in to change notification settings - Fork193
Add Your Own Component To Bottom Sheet Whatever You Want (Android and iOS)
License
NotificationsYou must be signed in to change notification settings
nysamnang/react-native-raw-bottom-sheet
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Please pay close attention if you are upgrading the RBSheet from version 2 to version 3.
- Functional Components: Starting from v3.0.0, RBSheet has been completely rewritten using Functional Components. This improves performance and aligns with modern React practices.
- Prop Removal & Renaming: Several props have been removed and renamed for improved clarity and maintainability. Please refer to the updated documentation for a complete list of available props and their intended behavior.
- Super Lightweight Component
- Add Your Own Component To Bottom Sheet
- Customize Whatever You Like
- Support Drag Down Gesture
- Support All Orientations
- Support Both Android And iOS
- Smooth Animation
- Zero Configuration
- Zero dependency
- Millions of Downloads
Showcase iOS | Showcase Android |
---|---|
![]() | ![]() |
npm i react-native-raw-bottom-sheet --save
yarn add react-native-raw-bottom-sheet
Please check theexample folder to explore more example codes.
importReact,{useRef}from'react';import{View,Button}from'react-native';importRBSheetfrom'react-native-raw-bottom-sheet';exportdefaultfunctionExample(){constrefRBSheet=useRef();return(<Viewstyle={{flex:1}}><Buttontitle="OPEN BOTTOM SHEET"onPress={()=>refRBSheet.current.open()}/><RBSheetref={refRBSheet}useNativeDriver={true}customStyles={{wrapper:{backgroundColor:'transparent',},draggableIcon:{backgroundColor:'#000',},}}customModalProps={{animationType:'slide',statusBarTranslucent:true,}}customAvoidingViewProps={{enabled:false,}}><YourOwnComponent/></RBSheet></View>);}
constrefRBSheet=useRef([]);constrenderItem=({item, index})=>{return(<View><TouchableOpacitystyle={styles.button}onPress={()=>refRBSheet.current[index].open()}><Textstyle={styles.buttonText}>ITEM{item+1}</Text></TouchableOpacity><RBSheetref={ref=>(refRBSheet.current[index]=ref)}><Viewstyle={styles.bottomSheetContainer}><Textstyle={styles.bottomSheetText}>I AM ITEM{item+1}</Text></View></RBSheet></View>);};
Props | Type | Description | Default |
---|---|---|---|
height | number | The height of bottom sheet. | 260 |
openDuration | number | Duration of the animation when opening bottom sheet. | 300 (ms) |
closeDuration | number | Duration of the animation when closing bottom sheet. | 200 (ms) |
closeOnPressMask | boolean | Press the outside area (mask) to close bottom sheet. | true |
closeOnPressBack | boolean | Press hardware back android to close bottom sheet (Android only). | false |
draggable | boolean | Enable the drag-down gesture to close the bottom sheet. | false |
dragOnContent | boolean | The draggable is only worked on the draggable icon. Set this totrue if you want to drag on the content as well (doesn't work with ScrollView). | false |
useNativeDriver | boolean | Use the native driver to run smoother animation. | false |
customStyles | object | Addcustom styles to bottom sheet. | {} |
customModalProps | object | Addcustom props to modal. | {} |
customAvoidingViewProps | object | Addcustom props to KeyboardAvoidingView. | {} |
onOpen | function | Callback function that will be called after the bottom sheet has been opened. | null |
onClose | function | Callback function that will be called after the bottom sheet has been closed. | null |
customStyles:{wrapper:{...},// The Root of component (Change the mask's background color here).container:{...},// The Container of bottom sheet (The animated view that contains your component).draggableIcon:{...}// The style of Draggable Icon (If you set `draggable` to `true`).}
Method Name | Description | Usage |
---|---|---|
open | The method to open bottom sheet. | refRBSheet.current.open() |
close | The method to close bottom sheet. | refRBSheet.current.close() |
I'm really glad you're reading this, because we need volunteer developers to help bring this project to life.
- Clone this repository
- Open project, then run
yarn
to install devDependencies - Add your magic code for contribution
- Test your code
- Navigate to
example
folder - Run
yarn
&yarn start
to run the example project - Test your code in
example/App.js
- Navigate to
- Update
README.md
to update documentation (Optional) - Write unit testing in
__tests__
folder (Optional) - Update
index.d.ts
to update typing (Optional) - Make a pull request, Genius!
This project is licensed under the MIT License - see theLICENSE.md file for details.
Made with ❤️ byNY Samnang.
About
Add Your Own Component To Bottom Sheet Whatever You Want (Android and iOS)
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.