mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-26 23:06:03 +08:00
refactor: minor tweaks
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user