fix incorrect header is showing

This commit is contained in:
ammarahm-ed
2021-04-17 11:27:31 +05:00
parent e1bf97bf68
commit 6b2cf4367a
3 changed files with 7 additions and 3 deletions

View File

@@ -15,7 +15,7 @@ import {
} from '../../assets/images/assets';
import {useTracked} from '../../provider';
import FastImage from 'react-native-fast-image'
export const Placeholder = ({type, w, h, color}) => {
export const Placeholder = React.memo(({type, w, h, color}) => {
const [state, dispatch] = useTracked();
const {colors} = state;
const getSVG = () => {
@@ -43,6 +43,8 @@ export const Placeholder = ({type, w, h, color}) => {
}
};
console.log(type);
return (
<SvgToPngView
color={type === 'notes' ? color || colors.accent : colors.accent}
@@ -52,7 +54,7 @@ export const Placeholder = ({type, w, h, color}) => {
height={h}
/>
);
};
},() => true);
export const SvgToPngView = ({width, height, src, color, img}) => {
const [error, setError] = useState(false);

View File

@@ -20,6 +20,7 @@ export const Header = ({
onPress,
shouldShow = false,
icon,
screen
}) => {
const [state] = useTracked();
const {colors} = state;
@@ -70,7 +71,7 @@ export const Header = ({
color={COLORS_NOTE[title.toLowerCase()] || colors.accent}
w={normalize(150)}
h={normalize(150)}
type={type}
type={screen === "Favorites" ? "favorites" : type}
/>
</View>

View File

@@ -178,6 +178,7 @@ const SimpleList = ({
type={dataType}
index={index}
data={listData}
screen={screen}
/>
);
case 'header':