Skip to content

Commit

Permalink
feat: merge pull request #50 from NBN23dev/master
Browse files Browse the repository at this point in the history
feat: add support for setting drawer width on landscape
  • Loading branch information
Luke Brandon Farrell authored Mar 5, 2022
2 parents 8a2686c + 71251bb commit c3b80eb
Show file tree
Hide file tree
Showing 6 changed files with 224 additions and 130 deletions.
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,18 @@ There's a complete and functional example at the `example` folder, with more tho
The props below are used to configure the drawer and are to be used in RNN `passProps:`. Any aditional
props will be passed to your custom drawer component.

| Prop | Type | Optional | Default | Description |
| ------------------- | ------------- | --------- | ------- | --------------------------------------------------------------------------------------- |
| animationOpenTime | float | Yes | 300 | Time in milliseconds to execute the drawer opening animation. |
| animationCloseTime | float | Yes | 300 | Time in milliseconds to execute the drawer closing animation. |
| direction | string | Yes | left | Direction to open the collage, one of: ["left", "right", "top", "bottom"]. |
| dismissWhenTouchOutside | bool | Yes | true | Should the drawer be dismissed when a click is registered outside? |
| fadeOpacity | number | Yes | 0.6 | Opacity of the screen outside the drawer. |
| drawerScreenWidth | number | Yes | 0.8 | 0 - 1, width of drawer in relation to the screen. |
| drawerScreenHeight | number | Yes | 1 | 0 - 1, height of drawer in relation to the screen. |
| disableDragging | boolean | Yes | false | Whether you want to disable dragging of the drawer. Useful if you have ScrollView inside the drawer (addresses #62).|
| disableSwiping | boolean | Yes | false | Whether you want to disable swiping gesture. Use it only in pair with disableDragging.|
| Prop | Type | Optional | Default | Description |
| ---------------------------- | ------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| animationOpenTime | float | Yes | 300 | Time in milliseconds to execute the drawer opening animation. |
| animationCloseTime | float | Yes | 300 | Time in milliseconds to execute the drawer closing animation. |
| direction | string | Yes | left | Direction to open the collage, one of: ["left", "right", "top", "bottom"]. |
| dismissWhenTouchOutside | bool | Yes | true | Should the drawer be dismissed when a click is registered outside? |
| fadeOpacity | number | Yes | 0.6 | Opacity of the screen outside the drawer. |
| drawerScreenWidth | number/string | Yes | 80% | Width of drawer on portrait orientation. Pass a string containing '%' (e.g. "80%") for setting the width in relation to the screen or a number for absolute width (e.g. 300) |
| drawerScreenWidthOnLandscape | number/string | Yes | 30% | Width of drawer on landscape orientation. Pass a string containing '%' (e.g. "80%") for setting the width in relation to the screen or a number for absolute width (e.g. 300) |
| drawerScreenHeight | number/string | Yes | 100% | Height of drawer. Pass a string containing '%' (e.g. "30%") for setting the height in relation to the screen or a number for absolute height (e.g. 300)
| disableDragging | boolean | Yes | false | Whether you want to disable dragging of the drawer. Useful if you have ScrollView inside the drawer (addresses #62).|
| disableSwiping | boolean | Yes | false | Whether you want to disable swiping gesture. Use it only in pair with disableDragging. |

## SideMenuView

Expand Down
19 changes: 14 additions & 5 deletions lib/RNNDrawer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ declare interface RNNDrawerOptions {
* If not provided, drawer might have
* a weird effect when closing
*/
direction: DirectionType;
direction?: DirectionType;
/**
* Time in milliseconds to execute the drawer opening animation
*/
Expand All @@ -35,13 +35,22 @@ declare interface RNNDrawerOptions {
*/
fadeOpacity?: number;
/**
* Width of drawer in relation to the screen (0 to 1)
* Width of drawer on portrait orientation. Pass a string containing '%' (e.g. "80%")
* for setting the width in relation to the screen or a number for absolute width (e.g. 300)
*/
drawerScreenWidth?: number;
drawerScreenWidth?: number | string;
/**
* Height of drawer in relation to the screen (0 to 1)
* Width of drawer on landscape orientation. Pass a string containing '%' (e.g. "80%")
* for setting the width in relation to the screen or a number for absolute width (e.g. 300)
*/
drawerScreenHeight?: number;
drawerScreenWidthOnLandscape?: number | string;
/**
* Height of drawer. Pass a string containing '%' (e.g. "30%")
* for setting the height in relation to the screen or a number for absolute height (e.g. 300)
*/
drawerScreenHeight?: number | string;
disableDragging?: boolean;
disableSwiping?: boolean;
}
export declare enum DirectionType {
left = "left",
Expand Down
Loading

0 comments on commit c3b80eb

Please sign in to comment.