├── .babelrc ├── .gitignore ├── LICENSE ├── README.md ├── demo.gif ├── example └── example.js ├── index.js ├── package-lock.json ├── package.json └── src ├── Animator.js └── BottomDrawer.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["module:metro-react-native-babel-preset"] 3 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/**/* 2 | .DS_Store 3 | .watchmanconfig -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Jack Klein 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Bottom drawer for React Native 2 | 3 |

4 | Demo gif 5 |

6 | 7 | ## Content 8 | 9 | - [Installation](#installation) 10 | - [Usage example](#usage-example) 11 | - [Configuration](#configuration) 12 | - [Questions?](#questions) 13 | 14 | ## Installation 15 | 16 | Install `rn-bottom-drawer`. 17 | 18 | ``` 19 | npm install rn-bottom-drawer --save 20 | ``` 21 | 22 | ## Usage Example 23 | (go to the example folder for a more fleshed out example) 24 | 25 | ```javascript 26 | import React from 'react'; 27 | import { View, Text } from 'react-native'; 28 | import BottomDrawer from 'rn-bottom-drawer'; 29 | 30 | const TAB_BAR_HEIGHT = 49; 31 | 32 | export default class App extends React.Component { 33 | renderContent = () => { 34 | return ( 35 | 36 | Get directions to your location 37 | 38 | ) 39 | } 40 | 41 | render() { 42 | return ( 43 | 47 | {this.renderContent()} 48 | 49 | ) 50 | } 51 | } 52 | 53 | ``` 54 | [Refer to this code](https://github.com/jacklein/rn-bottom-drawer/issues/7#issuecomment-465554054) if you want to put a **scrollview** within the bottom drawer 55 | 56 | ## Configuration 57 | 58 | | Prop | Type | Default | Description | 59 | | ---- | ---- | ----| ---- | 60 | | containerHeight | number | -- | The height of the drawer. | 61 | | offset | number | 0 | If your app uses tab navigation or a header, **offset** equals their combined heights. In the demo gif, the offset is the header + tab heights so that the drawer renders correctly within the map view. | 62 | | downDisplay | number | containerHeight / 1.5 | When the drawer is swiped into down position, **downDisplay** controls how far it settles below its up position. For example, if its value is 20, the drawer will settle 20 points below the up position. The default value shows 1/3 of the container (if containerHeight = 60, the default downDisplay value = 40). | 63 | | backgroundColor | string | '#ffffff' | The background color of the drawer. | 64 | | startUp | bool | true | If **true**, the drawer will start in up position. If **false**, it will start in down position. | 65 | | roundedEdges | bool | true | If **true**, the top of the drawer will have rounded edges. | 66 | | shadow | bool | true | if **true**, the top of the drawer will have a shadow. | 67 | | onExpanded | func | -- | A callback function triggered when the drawer is swiped into up position | 68 | | onCollapsed | func | -- | A callback function triggered when the drawer is swiped into down position | 69 | 70 | ### Questions? 71 | Feel free to contact me at [jackdillklein@gmail.com](mailto:jackdillklein@gmail.com) or [create an issue](https://github.com/jacklein/rn-bottom-drawer/issues/new) 72 | -------------------------------------------------------------------------------- /demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jacklein/rn-bottom-drawer/35513d5e627871feeb72cbb437dd33acf72518f8/demo.gif -------------------------------------------------------------------------------- /example/example.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { View, Text,StyleSheet } from 'react-native'; 3 | import { Button } from 'react-native-elements'; 4 | import BottomDrawer from 'rn-bottom-drawer'; 5 | 6 | // this example assumes you're using a header and a tab bar 7 | const TAB_BAR_HEIGHT = 49; 8 | const HEADER_HEIGHT = 60; 9 | 10 | export default class App extends React.Component { 11 | renderContent = () => { 12 | return ( 13 | 14 | Get directions to your location 15 | 16 |