Skip to content

Commit f412600

Browse files
Merge pull request #33 from aspect-apps/chore/docs-and-types
improving types and docs
2 parents dd3a92c + f58eb0c commit f412600

File tree

3 files changed

+56
-4
lines changed

3 files changed

+56
-4
lines changed

.DS_Store

-6 KB
Binary file not shown.

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,11 @@ RNNDrawer.showDrawer({
6464
style: { // Styles the drawer container, supports any react-native style
6565
backgroundColor: "red",
6666
},
67-
parentComponentId: this.props.componentId, // Custom prop, will be available in your custom drawer component props
67+
parentComponentId: props.componentId, // Custom prop, will be available in your custom drawer component props
6868
},
6969
}
7070
});
71-
```
7271

73-
```js
7472
RNNDrawer.dismissDrawer();
7573
````
7674

lib/RNNDrawer.d.ts

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,68 @@
44
*/
55
import * as React from 'react';
66
import { Layout } from 'react-native-navigation';
7+
8+
type DirectionType = "left" | "right" | "top" | "bottom";
9+
10+
declare interface RNNDrawerOptions {
11+
/**
12+
* Id of parent component of the drawer.
13+
* This field is necessary in order to be able
14+
* to push screens inside the drawer
15+
*/
16+
parentComponentId: string;
17+
18+
/**
19+
* Time in milliseconds to execute the drawer opening animation
20+
*/
21+
animationOpenTime?: number;
22+
23+
/**
24+
* Time in milliseconds to execute the drawer closing animation
25+
*/
26+
animationCloseTime?: number;
27+
28+
/**
29+
* Direction to open the collage,
30+
* one of: ["left", "right", "top", "bottom"]
31+
*/
32+
direction?: DirectionType;
33+
34+
/**
35+
* Whether the drawer be dismissed when a click is registered outside
36+
*/
37+
dismissWhenTouchOutside?: boolean;
38+
39+
/**
40+
* Opacity of the screen outside the drawer
41+
*/
42+
fadeOpacity?: number;
43+
44+
/**
45+
* Width of drawer in relation to the screen (0 to 1)
46+
*/
47+
drawerScreenWidth?: number;
48+
49+
/**
50+
* Height of drawer in relation to the screen (0 to 1)
51+
*/
52+
drawerScreenHeight?: number;
53+
}
54+
755
declare class RNNDrawer {
56+
/**
57+
* Generates the drawer component to
58+
* be used with react-native-navigation
59+
*
60+
* @param component
61+
*/
862
static create(Component: React.ComponentType): any;
963
/**
1064
* Shows a drawer component
1165
*
1266
* @param layout
1367
*/
14-
static showDrawer(layout: Layout): void;
68+
static showDrawer(layout: Layout<RNNDrawerOptions>): void;
1569
/**
1670
* Dismiss the drawer component
1771
*/

0 commit comments

Comments
 (0)