Skip to content

feat: add support for setting drawer width on landscape #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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