mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Change returning value of DirectEventHandler and BubblingEventHandler to void
Summary: returning type of Bubbling and Direct Event should be always void of Promise (if async). Other situations shouldn't be permitted. Reformated all cases when it the function wasn't void. Reviewed By: rickhanlonii Differential Revision: D16165962 fbshipit-source-id: 7c1377c3ed4bd54a431a13e5bcda4f7ec0adf4dc
This commit is contained in:
committed by
Facebook Github Bot
parent
8e4b2e7448
commit
fb7b2d3533
@@ -28,7 +28,7 @@ const DRAWER_STATES = ['Idle', 'Dragging', 'Settling'];
|
||||
|
||||
import type {ViewStyleProp} from '../../StyleSheet/StyleSheet';
|
||||
import type {ColorValue} from '../../StyleSheet/StyleSheetTypes';
|
||||
import type {SyntheticEvent} from '../../Types/CoreEventTypes';
|
||||
import type {DirectEventHandler} from '../../Types/CodegenTypes';
|
||||
import type {
|
||||
MeasureOnSuccessCallback,
|
||||
MeasureInWindowOnSuccessCallback,
|
||||
@@ -37,17 +37,9 @@ import type {
|
||||
|
||||
type DrawerStates = 'Idle' | 'Dragging' | 'Settling';
|
||||
|
||||
type DrawerStateEvent = SyntheticEvent<
|
||||
$ReadOnly<{|
|
||||
drawerState: number,
|
||||
|}>,
|
||||
>;
|
||||
|
||||
type DrawerSlideEvent = SyntheticEvent<
|
||||
$ReadOnly<{|
|
||||
offset: number,
|
||||
|}>,
|
||||
>;
|
||||
type DrawerSlideEvent = $ReadOnly<{|
|
||||
offset: number,
|
||||
|}>;
|
||||
|
||||
type Props = $ReadOnly<{|
|
||||
/**
|
||||
@@ -93,7 +85,7 @@ type Props = $ReadOnly<{|
|
||||
/**
|
||||
* Function called whenever there is an interaction with the navigation view.
|
||||
*/
|
||||
onDrawerSlide?: ?(event: DrawerSlideEvent) => mixed,
|
||||
onDrawerSlide?: ?DirectEventHandler<DrawerSlideEvent>,
|
||||
|
||||
/**
|
||||
* Function called when the drawer state has changed. The drawer can be in 3 states:
|
||||
@@ -176,7 +168,13 @@ class DrawerLayoutAndroid extends React.Component<Props, State> {
|
||||
state = {statusBarBackgroundColor: null};
|
||||
|
||||
render() {
|
||||
const {onDrawerStateChanged, renderNavigationView, ...props} = this.props;
|
||||
const {
|
||||
onDrawerStateChanged,
|
||||
renderNavigationView,
|
||||
onDrawerOpen,
|
||||
onDrawerClose,
|
||||
...props
|
||||
} = this.props;
|
||||
const drawStatusBar =
|
||||
Platform.Version >= 21 && this.props.statusBarBackgroundColor;
|
||||
const drawerViewWrapper = (
|
||||
@@ -233,7 +231,7 @@ class DrawerLayoutAndroid extends React.Component<Props, State> {
|
||||
);
|
||||
}
|
||||
|
||||
_onDrawerSlide = (event: DrawerSlideEvent) => {
|
||||
_onDrawerSlide = event => {
|
||||
if (this.props.onDrawerSlide) {
|
||||
this.props.onDrawerSlide(event);
|
||||
}
|
||||
@@ -254,7 +252,7 @@ class DrawerLayoutAndroid extends React.Component<Props, State> {
|
||||
}
|
||||
};
|
||||
|
||||
_onDrawerStateChanged = (event: DrawerStateEvent) => {
|
||||
_onDrawerStateChanged = event => {
|
||||
if (this.props.onDrawerStateChanged) {
|
||||
this.props.onDrawerStateChanged(
|
||||
DRAWER_STATES[event.nativeEvent.drawerState],
|
||||
|
||||
Reference in New Issue
Block a user