I have a button that appear after user have scrolled down enough on a long screen that is contained in a ScrollView, I have some code for it and it works, however the view take a full second to appear and disappear and that's too slow! Is there anyway to make it appear and disappear faster?
const [showBottomButton, setShowBottomButton] = useState(false)
.
const handleScroll = (event) => {
var curY = event.nativeEvent.contentOffset.y;
if (curY>=500 && !showBottomButton){
setShowBottomButton(true)
}else if (curY<500 && showBottomButton){
setShowBottomButton(false)
}
}
.
{showBottomButton ? <View style={{ position: 'absolute', left: 0, bottom: 0, right: 0, height: 70, alignItems: 'center', justifyContent: 'center', backgroundColor: 'white', borderTopWidth: 1, borderColor: '#eeeeee' }}>
<TouchableOpacity onPress={BottomButtonOnpress}>
<View style={styles.BottomButton}
<Text style={styles.MediumText}>Button Text</Text>
</View></TouchableOpacity>
</View> : null}