mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Add type for onLayout
Reviewed By: sahrens Differential Revision: D5364203 fbshipit-source-id: ad87179422b0e595fc78db21a3108d50ba31564c
This commit is contained in:
committed by
Facebook Github Bot
parent
6e13adbf56
commit
9108f98ca7
@@ -21,13 +21,8 @@ const View = require('View');
|
||||
const ViewPropTypes = require('ViewPropTypes');
|
||||
|
||||
import type EmitterSubscription from 'EmitterSubscription';
|
||||
import type {ViewLayout, ViewLayoutEvent} from 'ViewPropTypes';
|
||||
|
||||
type Rect = {
|
||||
x: number,
|
||||
y: number,
|
||||
width: number,
|
||||
height: number,
|
||||
};
|
||||
type ScreenRect = {
|
||||
screenX: number,
|
||||
screenY: number,
|
||||
@@ -40,11 +35,6 @@ type KeyboardChangeEvent = {
|
||||
duration?: number,
|
||||
easing?: string,
|
||||
};
|
||||
type LayoutEvent = {
|
||||
nativeEvent: {
|
||||
layout: Rect,
|
||||
}
|
||||
};
|
||||
|
||||
const viewRef = 'VIEW';
|
||||
|
||||
@@ -85,7 +75,7 @@ const KeyboardAvoidingView = React.createClass({
|
||||
},
|
||||
|
||||
subscriptions: ([]: Array<EmitterSubscription>),
|
||||
frame: (null: ?Rect),
|
||||
frame: (null: ?ViewLayout),
|
||||
|
||||
relativeKeyboardHeight(keyboardFrame: ScreenRect): number {
|
||||
const frame = this.frame;
|
||||
@@ -121,7 +111,7 @@ const KeyboardAvoidingView = React.createClass({
|
||||
this.setState({bottom: height});
|
||||
},
|
||||
|
||||
onLayout(event: LayoutEvent) {
|
||||
onLayout(event: ViewLayoutEvent) {
|
||||
this.frame = event.nativeEvent.layout;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user