[FIX] Canned Responses minor fixes (#3400)
* fix onChangeText usedCanned on tablet * removed refreshControl Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
parent
d9dcd2db76
commit
80d14037be
|
@ -274,7 +274,7 @@ class MessageBox extends Component<IMessageBoxProps, IMessageBoxState> {
|
|||
}
|
||||
|
||||
if (isMasterDetail && usedCannedResponse) {
|
||||
this.onChangeText('');
|
||||
this.onChangeText(usedCannedResponse);
|
||||
}
|
||||
|
||||
this.unsubscribeFocus = navigation.addListener('focus', () => {
|
||||
|
|
|
@ -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={<RefreshControl refreshing={refreshing} onRefresh={onRefresh} tintColor={themes[theme].auxiliaryText} />}
|
||||
ListHeaderComponent={renderFlatListHeader}
|
||||
stickyHeaderIndices={[0]}
|
||||
onEndReached={onEndReached}
|
||||
onEndReachedThreshold={0.5}
|
||||
ItemSeparatorComponent={List.Separator}
|
||||
ListFooterComponent={loading && !refreshing ? <ActivityIndicator theme={theme} /> : null}
|
||||
ListFooterComponent={loading ? <ActivityIndicator theme={theme} /> : null}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue