1*af2ec015STomasz Sapeta/**
2*af2ec015STomasz Sapeta * Copyright (c) Meta Platforms, Inc. and affiliates.
3*af2ec015STomasz Sapeta *
4*af2ec015STomasz Sapeta * This source code is licensed under the MIT license found in the
5*af2ec015STomasz Sapeta * LICENSE file in the root directory of this source tree.
6*af2ec015STomasz Sapeta *
7*af2ec015STomasz Sapeta * @format
8*af2ec015STomasz Sapeta */
9*af2ec015STomasz Sapeta
10*af2ec015STomasz Sapetaimport type * as React from 'react';
11*af2ec015STomasz Sapetaimport {Constructor} from '../../../types/private/Utilities';
12*af2ec015STomasz Sapetaimport {NativeMethods} from '../../../types/public/ReactNativeTypes';
13*af2ec015STomasz Sapetaimport {ColorValue} from '../../StyleSheet/StyleSheet';
14*af2ec015STomasz Sapetaimport {
15*af2ec015STomasz Sapeta  NativeSyntheticEvent,
16*af2ec015STomasz Sapeta  NativeTouchEvent,
17*af2ec015STomasz Sapeta} from '../../Types/CoreEventTypes';
18*af2ec015STomasz Sapetaimport {ViewProps} from '../View/ViewPropTypes';
19*af2ec015STomasz Sapeta
20*af2ec015STomasz Sapetaexport interface DrawerSlideEvent
21*af2ec015STomasz Sapeta  extends NativeSyntheticEvent<NativeTouchEvent> {}
22*af2ec015STomasz Sapeta
23*af2ec015STomasz Sapeta/**
24*af2ec015STomasz Sapeta * @see DrawerLayoutAndroid.android.js
25*af2ec015STomasz Sapeta */
26*af2ec015STomasz Sapetaexport interface DrawerLayoutAndroidProps extends ViewProps {
27*af2ec015STomasz Sapeta  /**
28*af2ec015STomasz Sapeta   * Specifies the background color of the drawer. The default value
29*af2ec015STomasz Sapeta   * is white. If you want to set the opacity of the drawer, use rgba.
30*af2ec015STomasz Sapeta   * Example:
31*af2ec015STomasz Sapeta   * return (
32*af2ec015STomasz Sapeta   *   <DrawerLayoutAndroid drawerBackgroundColor="rgba(0,0,0,0.5)">
33*af2ec015STomasz Sapeta   *   </DrawerLayoutAndroid>
34*af2ec015STomasz Sapeta   *);
35*af2ec015STomasz Sapeta   */
36*af2ec015STomasz Sapeta  drawerBackgroundColor?: ColorValue | undefined;
37*af2ec015STomasz Sapeta
38*af2ec015STomasz Sapeta  /**
39*af2ec015STomasz Sapeta   * Specifies the lock mode of the drawer. The drawer can be locked
40*af2ec015STomasz Sapeta   * in 3 states:
41*af2ec015STomasz Sapeta   *
42*af2ec015STomasz Sapeta   * - unlocked (default), meaning that the drawer will respond
43*af2ec015STomasz Sapeta   *   (open/close) to touch gestures.
44*af2ec015STomasz Sapeta   *
45*af2ec015STomasz Sapeta   * - locked-closed, meaning that the drawer will stay closed and not
46*af2ec015STomasz Sapeta   *   respond to gestures.
47*af2ec015STomasz Sapeta   *
48*af2ec015STomasz Sapeta   * - locked-open, meaning that the drawer will stay opened and
49*af2ec015STomasz Sapeta   *   not respond to gestures. The drawer may still be opened and
50*af2ec015STomasz Sapeta   *   closed programmatically (openDrawer/closeDrawer).
51*af2ec015STomasz Sapeta   */
52*af2ec015STomasz Sapeta  drawerLockMode?: 'unlocked' | 'locked-closed' | 'locked-open' | undefined;
53*af2ec015STomasz Sapeta
54*af2ec015STomasz Sapeta  /**
55*af2ec015STomasz Sapeta   * Specifies the side of the screen from which the drawer will slide in.
56*af2ec015STomasz Sapeta   * - 'left' (the default)
57*af2ec015STomasz Sapeta   * - 'right'
58*af2ec015STomasz Sapeta   */
59*af2ec015STomasz Sapeta  drawerPosition?: 'left' | 'right' | undefined;
60*af2ec015STomasz Sapeta
61*af2ec015STomasz Sapeta  /**
62*af2ec015STomasz Sapeta   * Specifies the width of the drawer, more precisely the width of the
63*af2ec015STomasz Sapeta   * view that be pulled in from the edge of the window.
64*af2ec015STomasz Sapeta   */
65*af2ec015STomasz Sapeta  drawerWidth?: number | undefined;
66*af2ec015STomasz Sapeta
67*af2ec015STomasz Sapeta  /**
68*af2ec015STomasz Sapeta   * Determines whether the keyboard gets dismissed in response to a drag.
69*af2ec015STomasz Sapeta   * - 'none' (the default), drags do not dismiss the keyboard.
70*af2ec015STomasz Sapeta   * - 'on-drag', the keyboard is dismissed when a drag begins.
71*af2ec015STomasz Sapeta   */
72*af2ec015STomasz Sapeta  keyboardDismissMode?: 'none' | 'on-drag' | undefined;
73*af2ec015STomasz Sapeta
74*af2ec015STomasz Sapeta  /**
75*af2ec015STomasz Sapeta   * Function called whenever the navigation view has been closed.
76*af2ec015STomasz Sapeta   */
77*af2ec015STomasz Sapeta  onDrawerClose?: (() => void) | undefined;
78*af2ec015STomasz Sapeta
79*af2ec015STomasz Sapeta  /**
80*af2ec015STomasz Sapeta   * Function called whenever the navigation view has been opened.
81*af2ec015STomasz Sapeta   */
82*af2ec015STomasz Sapeta  onDrawerOpen?: (() => void) | undefined;
83*af2ec015STomasz Sapeta
84*af2ec015STomasz Sapeta  /**
85*af2ec015STomasz Sapeta   * Function called whenever there is an interaction with the navigation view.
86*af2ec015STomasz Sapeta   */
87*af2ec015STomasz Sapeta  onDrawerSlide?: ((event: DrawerSlideEvent) => void) | undefined;
88*af2ec015STomasz Sapeta
89*af2ec015STomasz Sapeta  /**
90*af2ec015STomasz Sapeta   * Function called when the drawer state has changed.
91*af2ec015STomasz Sapeta   * The drawer can be in 3 states:
92*af2ec015STomasz Sapeta   * - idle, meaning there is no interaction with the navigation
93*af2ec015STomasz Sapeta   *   view happening at the time
94*af2ec015STomasz Sapeta   * - dragging, meaning there is currently an interaction with the
95*af2ec015STomasz Sapeta   *   navigation view
96*af2ec015STomasz Sapeta   * - settling, meaning that there was an interaction with the
97*af2ec015STomasz Sapeta   *   navigation view, and the navigation view is now finishing
98*af2ec015STomasz Sapeta   *   it's closing or opening animation
99*af2ec015STomasz Sapeta   */
100*af2ec015STomasz Sapeta  onDrawerStateChanged?:
101*af2ec015STomasz Sapeta    | ((event: 'Idle' | 'Dragging' | 'Settling') => void)
102*af2ec015STomasz Sapeta    | undefined;
103*af2ec015STomasz Sapeta
104*af2ec015STomasz Sapeta  /**
105*af2ec015STomasz Sapeta   * The navigation view that will be rendered to the side of the
106*af2ec015STomasz Sapeta   * screen and can be pulled in.
107*af2ec015STomasz Sapeta   */
108*af2ec015STomasz Sapeta  renderNavigationView: () => JSX.Element;
109*af2ec015STomasz Sapeta
110*af2ec015STomasz Sapeta  /**
111*af2ec015STomasz Sapeta   * Make the drawer take the entire screen and draw the background of
112*af2ec015STomasz Sapeta   * the status bar to allow it to open over the status bar. It will
113*af2ec015STomasz Sapeta   * only have an effect on API 21+.
114*af2ec015STomasz Sapeta   */
115*af2ec015STomasz Sapeta  statusBarBackgroundColor?: ColorValue | undefined;
116*af2ec015STomasz Sapeta}
117*af2ec015STomasz Sapeta
118*af2ec015STomasz Sapetainterface DrawerPosition {
119*af2ec015STomasz Sapeta  Left: number;
120*af2ec015STomasz Sapeta  Right: number;
121*af2ec015STomasz Sapeta}
122*af2ec015STomasz Sapeta
123*af2ec015STomasz Sapetadeclare class DrawerLayoutAndroidComponent extends React.Component<DrawerLayoutAndroidProps> {}
124*af2ec015STomasz Sapetadeclare const DrawerLayoutAndroidBase: Constructor<NativeMethods> &
125*af2ec015STomasz Sapeta  typeof DrawerLayoutAndroidComponent;
126*af2ec015STomasz Sapetaexport class DrawerLayoutAndroid extends DrawerLayoutAndroidBase {
127*af2ec015STomasz Sapeta  /**
128*af2ec015STomasz Sapeta   * drawer's positions.
129*af2ec015STomasz Sapeta   */
130*af2ec015STomasz Sapeta  positions: DrawerPosition;
131*af2ec015STomasz Sapeta
132*af2ec015STomasz Sapeta  /**
133*af2ec015STomasz Sapeta   * Opens the drawer.
134*af2ec015STomasz Sapeta   */
135*af2ec015STomasz Sapeta  openDrawer(): void;
136*af2ec015STomasz Sapeta
137*af2ec015STomasz Sapeta  /**
138*af2ec015STomasz Sapeta   * Closes the drawer.
139*af2ec015STomasz Sapeta   */
140*af2ec015STomasz Sapeta  closeDrawer(): void;
141*af2ec015STomasz Sapeta}
142