onAction doesn't get called when Popable disappears.
atitpatel opened this issue · 5 comments
I am trying to change the state variable on the tap of the tooltip component.
Have a look at the code snippet below.
<> <Popable onAction={visible => { setIsSelected(visible); }} content={ <View style={styles.tooltipView}> <Text style={styles.font}>Anything :)</Text> </View> }> <View style={styles.infoIcon}> {isSelected ? ( <Image source={require('assets/images/tool_tip_info_black.png')} /> ) : ( <Image source={require('assets/images/tool_tip_info.png')} /> )} </Pressable> </Popable> </>
I believe visible should provide me the state of the popable. But that doesn't seem to be happening. Kindly help me out.
Hi Atit,
Thanks for sharing this issue.
My guess is that it's not calling props.onAction
here:
const handleHidePopover = useCallback(() => {
setPopoverVisible(false);
// missing props.onAction(false);
}, []);
I'll make an update and let you know when it's up!
Hi again,
The fix has been added to v0.4.1
.
Just upgrade to that version and it should all work fine :)
Good day
Hi @eveningkid thanks for responding so quick.
It still hasn't solved for me though. I have tried and upgraded the version.
To simplify the working, I have tried to show an example here.
As you can see in the example, there are two issues :
- In the console, it always logs
"Visible true"
and it never getsfalse
value. - The state variable
isTrue
is not having the correct value all the time.
Hi Atit,
I looked into it again and it seemed that yesterday's release didn't work properly.
Without making any changes, it worked by publishing it again!
Just tried your example using 0.4.2
and it's now working.
Let me know if this works for you too, ok?
Good day
Awesome!!
It's working fine now. Thanks!