MM-10784 Remove keyboard animation (#1742)

* Patch layout bug

* Fixed warnings
This commit is contained in:
Harrison Healey 2018-06-07 16:24:24 -04:00 committed by Elias Nahum
parent 2dcf718f81
commit bbe27df6ea

View file

@ -3,12 +3,10 @@
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {Animated, Keyboard, Platform, View} from 'react-native';
import {Keyboard, Platform, View} from 'react-native';
import {makeStyleSheetFromTheme} from 'app/utils/theme';
const {View: AnimatedView} = Animated;
export default class KeyboardLayout extends PureComponent {
static propTypes = {
children: PropTypes.node,
@ -25,7 +23,7 @@ export default class KeyboardLayout extends PureComponent {
this.subscriptions = [];
this.count = 0;
this.state = {
bottom: new Animated.Value(0),
bottom: 0,
};
}
@ -42,26 +40,20 @@ export default class KeyboardLayout extends PureComponent {
this.subscriptions.forEach((sub) => sub.remove());
}
onKeyboardWillHide = (e) => {
const {duration} = e;
Animated.timing(this.state.bottom, {
toValue: 0,
duration,
}).start();
onKeyboardWillHide = () => {
this.setState({bottom: 0});
};
onKeyboardChange = (e) => {
if (!e) {
this.setState({bottom: new Animated.Value(0)});
this.setState({bottom: 0});
return;
}
const {endCoordinates, duration} = e;
const {endCoordinates} = e;
const {height} = endCoordinates;
Animated.timing(this.state.bottom, {
toValue: height,
duration,
}).start();
this.setState({bottom: height});
};
render() {
@ -80,11 +72,11 @@ export default class KeyboardLayout extends PureComponent {
}
return (
<AnimatedView
<View
style={[style.keyboardLayout, {bottom: this.state.bottom}]}
>
{children}
</AnimatedView>
</View>
);
}
}