[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) {
|
if (isMasterDetail && usedCannedResponse) {
|
||||||
this.onChangeText('');
|
this.onChangeText(usedCannedResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.unsubscribeFocus = navigation.addListener('focus', () => {
|
this.unsubscribeFocus = navigation.addListener('focus', () => {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import React, { useEffect, useState, useCallback } from 'react';
|
import React, { useEffect, useState, useCallback } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { FlatList, RefreshControl } from 'react-native';
|
import { FlatList } from 'react-native';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||||
import { HeaderBackButton } from '@react-navigation/stack';
|
import { HeaderBackButton } from '@react-navigation/stack';
|
||||||
|
@ -50,7 +50,6 @@ const CannedResponsesListView = ({ navigation, route }) => {
|
||||||
const [cannedResponses, setCannedResponses] = useState([]);
|
const [cannedResponses, setCannedResponses] = useState([]);
|
||||||
const [cannedResponsesScopeName, setCannedResponsesScopeName] = useState([]);
|
const [cannedResponsesScopeName, setCannedResponsesScopeName] = useState([]);
|
||||||
const [departments, setDepartments] = useState([]);
|
const [departments, setDepartments] = useState([]);
|
||||||
const [refreshing, setRefreshing] = useState(false);
|
|
||||||
|
|
||||||
// states used by the filter in Header and Dropdown
|
// states used by the filter in Header and Dropdown
|
||||||
const [isSearching, setIsSearching] = useState(false);
|
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 = () => {
|
const renderContent = () => {
|
||||||
if (!cannedResponsesScopeName.length && !loading) {
|
if (!cannedResponsesScopeName.length && !loading) {
|
||||||
return (
|
return (
|
||||||
|
@ -341,13 +329,12 @@ const CannedResponsesListView = ({ navigation, route }) => {
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
keyExtractor={item => item._id || item.shortcut}
|
keyExtractor={item => item._id || item.shortcut}
|
||||||
refreshControl={<RefreshControl refreshing={refreshing} onRefresh={onRefresh} tintColor={themes[theme].auxiliaryText} />}
|
|
||||||
ListHeaderComponent={renderFlatListHeader}
|
ListHeaderComponent={renderFlatListHeader}
|
||||||
stickyHeaderIndices={[0]}
|
stickyHeaderIndices={[0]}
|
||||||
onEndReached={onEndReached}
|
onEndReached={onEndReached}
|
||||||
onEndReachedThreshold={0.5}
|
onEndReachedThreshold={0.5}
|
||||||
ItemSeparatorComponent={List.Separator}
|
ItemSeparatorComponent={List.Separator}
|
||||||
ListFooterComponent={loading && !refreshing ? <ActivityIndicator theme={theme} /> : null}
|
ListFooterComponent={loading ? <ActivityIndicator theme={theme} /> : null}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue