refactor: minor tweaks

This commit is contained in:
Satyajit Sahoo
2020-01-03 17:05:46 +01:00
parent fa4411a14d
commit 87d28ca430
2 changed files with 8 additions and 2 deletions

View File

@@ -11,9 +11,10 @@ type Props = {
};
export default class KeyboardManager extends React.Component<Props> {
componentWillUnmount = () => {
componentWillUnmount() {
this.clearKeyboardTimeout();
};
}
// Numeric id of the previously focused text input
// When a gesture didn't change the tab, we can restore the focused input with this
private previouslyFocusedTextInput: number | null = null;
@@ -31,6 +32,7 @@ export default class KeyboardManager extends React.Component<Props> {
if (!this.props.enabled) {
return;
}
this.clearKeyboardTimeout();
const input = TextInput.State.currentlyFocusedField();
@@ -49,6 +51,7 @@ export default class KeyboardManager extends React.Component<Props> {
if (!this.props.enabled) {
return;
}
this.clearKeyboardTimeout();
Keyboard.dismiss();
@@ -61,6 +64,7 @@ export default class KeyboardManager extends React.Component<Props> {
if (!this.props.enabled) {
return;
}
this.clearKeyboardTimeout();
// The page didn't change, we should restore the focus of text input

View File

@@ -159,6 +159,7 @@ export default class Card extends React.Component<Props> {
spec.animation === 'spring' ? Animated.spring : Animated.timing;
this.handleStartInteraction();
onTransitionStart?.({ closing: Boolean(closing) });
animation(gesture, {
isInteraction: false,
@@ -168,6 +169,7 @@ export default class Card extends React.Component<Props> {
toValue,
}).start(({ finished }) => {
this.handleEndInteraction();
if (finished) {
if (closing) {
onClose();