Skip to content

Commit c3b80eb

Browse files
author
Luke Brandon Farrell
authored
feat: merge pull request #50 from NBN23dev/master
feat: add support for setting drawer width on landscape
2 parents 8a2686c + 71251bb commit c3b80eb

File tree

6 files changed

+224
-130
lines changed

6 files changed

+224
-130
lines changed

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,18 @@ There's a complete and functional example at the `example` folder, with more tho
9292
The props below are used to configure the drawer and are to be used in RNN `passProps:`. Any aditional
9393
props will be passed to your custom drawer component.
9494

95-
| Prop | Type | Optional | Default | Description |
96-
| ------------------- | ------------- | --------- | ------- | --------------------------------------------------------------------------------------- |
97-
| animationOpenTime | float | Yes | 300 | Time in milliseconds to execute the drawer opening animation. |
98-
| animationCloseTime | float | Yes | 300 | Time in milliseconds to execute the drawer closing animation. |
99-
| direction | string | Yes | left | Direction to open the collage, one of: ["left", "right", "top", "bottom"]. |
100-
| dismissWhenTouchOutside | bool | Yes | true | Should the drawer be dismissed when a click is registered outside? |
101-
| fadeOpacity | number | Yes | 0.6 | Opacity of the screen outside the drawer. |
102-
| drawerScreenWidth | number | Yes | 0.8 | 0 - 1, width of drawer in relation to the screen. |
103-
| drawerScreenHeight | number | Yes | 1 | 0 - 1, height of drawer in relation to the screen. |
104-
| disableDragging | boolean | Yes | false | Whether you want to disable dragging of the drawer. Useful if you have ScrollView inside the drawer (addresses #62).|
105-
| disableSwiping | boolean | Yes | false | Whether you want to disable swiping gesture. Use it only in pair with disableDragging.|
95+
| Prop | Type | Optional | Default | Description |
96+
| ---------------------------- | ------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------ |
97+
| animationOpenTime | float | Yes | 300 | Time in milliseconds to execute the drawer opening animation. |
98+
| animationCloseTime | float | Yes | 300 | Time in milliseconds to execute the drawer closing animation. |
99+
| direction | string | Yes | left | Direction to open the collage, one of: ["left", "right", "top", "bottom"]. |
100+
| dismissWhenTouchOutside | bool | Yes | true | Should the drawer be dismissed when a click is registered outside? |
101+
| fadeOpacity | number | Yes | 0.6 | Opacity of the screen outside the drawer. |
102+
| 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) |
103+
| 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) |
104+
| 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)
105+
| disableDragging | boolean | Yes | false | Whether you want to disable dragging of the drawer. Useful if you have ScrollView inside the drawer (addresses #62).|
106+
| disableSwiping | boolean | Yes | false | Whether you want to disable swiping gesture. Use it only in pair with disableDragging. |
106107

107108
## SideMenuView
108109

lib/RNNDrawer.d.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ declare interface RNNDrawerOptions {
1717
* If not provided, drawer might have
1818
* a weird effect when closing
1919
*/
20-
direction: DirectionType;
20+
direction?: DirectionType;
2121
/**
2222
* Time in milliseconds to execute the drawer opening animation
2323
*/
@@ -35,13 +35,22 @@ declare interface RNNDrawerOptions {
3535
*/
3636
fadeOpacity?: number;
3737
/**
38-
* Width of drawer in relation to the screen (0 to 1)
38+
* Width of drawer on portrait orientation. Pass a string containing '%' (e.g. "80%")
39+
* for setting the width in relation to the screen or a number for absolute width (e.g. 300)
3940
*/
40-
drawerScreenWidth?: number;
41+
drawerScreenWidth?: number | string;
4142
/**
42-
* Height of drawer in relation to the screen (0 to 1)
43+
* Width of drawer on landscape orientation. Pass a string containing '%' (e.g. "80%")
44+
* for setting the width in relation to the screen or a number for absolute width (e.g. 300)
4345
*/
44-
drawerScreenHeight?: number;
46+
drawerScreenWidthOnLandscape?: number | string;
47+
/**
48+
* Height of drawer. Pass a string containing '%' (e.g. "30%")
49+
* for setting the height in relation to the screen or a number for absolute height (e.g. 300)
50+
*/
51+
drawerScreenHeight?: number | string;
52+
disableDragging?: boolean;
53+
disableSwiping?: boolean;
4554
}
4655
export declare enum DirectionType {
4756
left = "left",

0 commit comments

Comments
 (0)