[FIX] Messagebox tracking lost on pop gesture navigation (#2799)

* Use setTimeout instead of InteractionManager

* Update tracking lib
This commit is contained in:
Diego Mello 2021-01-15 11:14:25 -03:00 committed by GitHub
parent 03302198a6
commit b77603c729
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 7 deletions

View File

@ -1,7 +1,7 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import {
View, Alert, Keyboard, NativeModules, Text, InteractionManager
View, Alert, Keyboard, NativeModules, Text
} from 'react-native';
import { connect } from 'react-redux';
import { KeyboardAccessoryView } from 'react-native-ui-lib/keyboard';
@ -224,12 +224,12 @@ class MessageBox extends Component {
this.unsubscribeFocus = navigation.addListener('focus', () => {
// didFocus
// We should wait pushed views be dismissed
InteractionManager.runAfterInteractions(() => {
this.trackingTimeout = setTimeout(() => {
if (this.tracking && this.tracking.resetTracking) {
// Reset messageBox keyboard tracking
this.tracking.resetTracking();
}
});
}, 500);
});
this.unsubscribeBlur = navigation.addListener('blur', () => {
this.component?.blur();
@ -258,6 +258,10 @@ class MessageBox extends Component {
} else if (!nextProps.message) {
this.clearInput();
}
if (this.trackingTimeout) {
clearTimeout(this.trackingTimeout);
this.trackingTimeout = false;
}
}
shouldComponentUpdate(nextProps, nextState) {

View File

@ -108,7 +108,7 @@
"react-native-scrollable-tab-view": "^1.0.0",
"react-native-simple-crypto": "RocketChat/react-native-simple-crypto",
"react-native-slowlog": "^1.0.2",
"react-native-ui-lib": "RocketChat/react-native-ui-lib",
"react-native-ui-lib": "RocketChat/react-native-ui-lib#minor-improvements",
"react-native-unimodules": "0.10.1",
"react-native-vector-icons": "7.0.0",
"react-native-webview": "10.3.2",

View File

@ -13109,9 +13109,9 @@ react-native-text-size@4.0.0-rc.1:
resolved "https://registry.yarnpkg.com/react-native-text-size/-/react-native-text-size-4.0.0-rc.1.tgz#1e048d345dd6a5a8e1269e0585c1a5948c478da5"
integrity sha512-CysqjU2jK6Yc+a+kEI222pUyTY2ywcU2HqbFqf1KHymW6OPTdvBBHqbEJKL0QiLhQaFYDbqicM+h990s9TP00g==
react-native-ui-lib@RocketChat/react-native-ui-lib:
version "4.2.0"
resolved "https://codeload.github.com/RocketChat/react-native-ui-lib/tar.gz/48478a9567c1d5d6ade8def7297578efb04554ca"
react-native-ui-lib@RocketChat/react-native-ui-lib#minor-improvements:
version "4.2.1"
resolved "https://codeload.github.com/RocketChat/react-native-ui-lib/tar.gz/a80f38aaa947849736ce8643253991cdcb639414"
dependencies:
babel-plugin-transform-inline-environment-variables "^0.0.2"
color "^3.1.0"