From b77603c729aaa3616a21d2fa3d9c4d83505bc717 Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Fri, 15 Jan 2021 11:14:25 -0300 Subject: [PATCH] [FIX] Messagebox tracking lost on pop gesture navigation (#2799) * Use setTimeout instead of InteractionManager * Update tracking lib --- app/containers/MessageBox/index.js | 10 +++++++--- package.json | 2 +- yarn.lock | 6 +++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/containers/MessageBox/index.js b/app/containers/MessageBox/index.js index f398390591..39f44279a7 100644 --- a/app/containers/MessageBox/index.js +++ b/app/containers/MessageBox/index.js @@ -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) { diff --git a/package.json b/package.json index b41a54c50f..26768e8eaf 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/yarn.lock b/yarn.lock index 1dcea128a5..36c5c405c8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"