Closed shashanksoul closed 7 months ago
Thanks for reporting this. I will review the API a bit more but in the meantime, you can use an Animated.View
instead of a FadingView
, and interpolate the showNavBar
to change between red
and green
.
Thanks for the reply. I updated the HeaderSurfaceComponent with Animated.View as you suggested, and now it’s working.
//To show custom color when user scrolls screen
const HeaderSurface: React.FC<SurfaceComponentProps> = ({showNavBar}) => {
const bgColor = useDerivedValue(() => {
return interpolateColor(
showNavBar.value,
[0, 1],
['#D7D9D8', SURFACE_BG_COLOR],
);
});
const animatedStyle = useAnimatedStyle(() => {
return {
backgroundColor: bgColor.value,
};
});
return (
<Animated.View style={[StyleSheet.absoluteFillObject, animatedStyle]} />
);
};
Description
if we provide the headerStyle with a background property and use the SurfaceComponent property, the SurfaceComponent does not appear even after scrolling.
Reproduction
Please describe the steps required to reproduce the issue, including any relevant code snippets, error messages, or screenshots.
Expected behavior
should change header background color with surface component color
https://github.com/codeherence/react-native-header/assets/46104967/d8f78125-b121-4d65-a778-254e88a5f86f
Actual behavior
seeing same header background color. surface component color does not show up.
https://github.com/codeherence/react-native-header/assets/46104967/e93b3236-98b0-4e17-8ef2-1ebb2a47b9e1
Environment