From 80d14037bedd0d6a615dbf43cdddb7fe48d50e98 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Tue, 28 Sep 2021 16:25:20 -0300 Subject: [PATCH] [FIX] Canned Responses minor fixes (#3400) * fix onChangeText usedCanned on tablet * removed refreshControl Co-authored-by: Diego Mello --- app/containers/MessageBox/index.tsx | 2 +- app/views/CannedResponsesListView/index.js | 17 ++--------------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/app/containers/MessageBox/index.tsx b/app/containers/MessageBox/index.tsx index 0366bc1b3..047c128bd 100644 --- a/app/containers/MessageBox/index.tsx +++ b/app/containers/MessageBox/index.tsx @@ -274,7 +274,7 @@ class MessageBox extends Component { } if (isMasterDetail && usedCannedResponse) { - this.onChangeText(''); + this.onChangeText(usedCannedResponse); } this.unsubscribeFocus = navigation.addListener('focus', () => { diff --git a/app/views/CannedResponsesListView/index.js b/app/views/CannedResponsesListView/index.js index a9d59b228..f9f515deb 100644 --- a/app/views/CannedResponsesListView/index.js +++ b/app/views/CannedResponsesListView/index.js @@ -1,6 +1,6 @@ import React, { useEffect, useState, useCallback } from 'react'; import PropTypes from 'prop-types'; -import { FlatList, RefreshControl } from 'react-native'; +import { FlatList } from 'react-native'; import { useSelector } from 'react-redux'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { HeaderBackButton } from '@react-navigation/stack'; @@ -50,7 +50,6 @@ const CannedResponsesListView = ({ navigation, route }) => { const [cannedResponses, setCannedResponses] = useState([]); const [cannedResponsesScopeName, setCannedResponsesScopeName] = useState([]); const [departments, setDepartments] = useState([]); - const [refreshing, setRefreshing] = useState(false); // states used by the filter in Header and Dropdown const [isSearching, setIsSearching] = useState(false); @@ -304,17 +303,6 @@ const CannedResponsesListView = ({ navigation, route }) => { ); }; - const onRefresh = () => { - setRefreshing(true); - onChangeText(''); - }; - - useEffect(() => { - if (refreshing) { - setRefreshing(false); - } - }, [cannedResponses]); - const renderContent = () => { if (!cannedResponsesScopeName.length && !loading) { return ( @@ -341,13 +329,12 @@ const CannedResponsesListView = ({ navigation, route }) => { /> )} keyExtractor={item => item._id || item.shortcut} - refreshControl={} ListHeaderComponent={renderFlatListHeader} stickyHeaderIndices={[0]} onEndReached={onEndReached} onEndReachedThreshold={0.5} ItemSeparatorComponent={List.Separator} - ListFooterComponent={loading && !refreshing ? : null} + ListFooterComponent={loading ? : null} /> ); };