fix crash in search

This commit is contained in:
ammarahm-ed
2021-02-08 14:06:57 +05:00
parent 0608b13180
commit 2cb095e3a8
2 changed files with 10 additions and 9 deletions

View File

@@ -70,14 +70,14 @@ export const HeaderTitle = () => {
style={{
opacity: DDS.isLargeTablet() ? 1 : opacity,
}}>
<Heading color={headerTextState.color}>
<Heading color={headerTextState?.color}>
<Heading color={colors.accent}>
{headerTextState.heading.slice(0, 1) === '#' ? '#' : null}
{headerTextState?.heading.slice(0, 1) === '#' ? '#' : null}
</Heading>
{headerTextState.heading.slice(0, 1) === '#'
? headerTextState.heading.slice(1)
: headerTextState.heading}
{headerTextState?.heading.slice(0, 1) === '#'
? headerTextState?.heading.slice(1)
: headerTextState?.heading}
</Heading>
</Animated.View>
);

View File

@@ -307,6 +307,7 @@ const ListEmptyComponent = ({loading = true, placeholderData}) => {
const {height} = useWindowDimensions();
const onHeaderStateChange = (event) => {
if (!event) return;
setHeaderTextState(event);
};
useEffect(() => {
@@ -350,16 +351,16 @@ const ListEmptyComponent = ({loading = true, placeholderData}) => {
fontSize={SIZE.md}
accentColor="bg"
accentText={
COLORS_NOTE[headerTextState.heading.toLowerCase()]
? headerTextState.heading.toLowerCase()
COLORS_NOTE[headerTextState?.heading?.toLowerCase()]
? headerTextState.heading?.toLowerCase()
: 'accent'
}
/>
) : loading ? (
<ActivityIndicator
color={
COLORS_NOTE[headerTextState.heading.toLowerCase()]
? COLORS_NOTE[headerTextState.heading.toLowerCase()]
COLORS_NOTE[headerTextState?.heading?.toLowerCase()]
? COLORS_NOTE[headerTextState?.heading?.toLowerCase()]
: colors.accent
}
/>