Skip to content

Commit

Permalink
[FIX] Messagebox tracking lost on pop gesture navigation (#2799)
Browse files Browse the repository at this point in the history
* Use setTimeout instead of InteractionManager

* Update tracking lib
  • Loading branch information
diegolmello authored Jan 15, 2021
1 parent 0330219 commit b77603c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
10 changes: 7 additions & 3 deletions app/containers/MessageBox/index.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit b77603c

Please sign in to comment.