We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
So I have a chart and I need to click the chart to create the tooltip but I need the tooltip to stay in the chart, is there a way to do it ?
The other question is related to how to handle the state outside the chart I need to use the selected X and Y outside the component, how can I do it?
Thanks
The text was updated successfully, but these errors were encountered:
You can be a little more creative with it. You can call the useChartPressedState anywhere and pass it into a child component of yours.
useChartPressedState
Then you can use an effect to enable another state to check the active flag, and hide it whenever you want:
const { state, isActive } = useChartPressedState(DEFAULT_STATE) const [showToolTip, setShowToolTip] = useState(false) useEffect(() => { if (isActive) { setShowToolTip(true) } }, [isActive]) return ( <View> <MyChart chartPressedState={state} showToolTip={showToolTip} /> <Button onPress={() => setShowToolTip(false)}>Hide Tooltip</Button> </View> )
Sorry, something went wrong.
@owattenmaker Thank you that's very helpful, any ideas about handling the state outside the chart ?
@Acarvajal904 I'm not quite sure what you mean by that. In my example it already has the chart pressed state outside of the chart component.
If you're talking about reading the shared values from state, then yes it's possible, it's just a react-native-reanimated SharedValue (https://docs.swmansion.com/react-native-reanimated/docs/2.x/fundamentals/shared-values/ & https://docs.swmansion.com/react-native-reanimated/docs/core/useSharedValue/)
react-native-reanimated
SharedValue
Hopefully that helps
No branches or pull requests
Question
So I have a chart and I need to click the chart to create the tooltip but I need the tooltip to stay in the chart, is there a way to do it ?
The other question is related to how to handle the state outside the chart
I need to use the selected X and Y outside the component, how can I do it?
Thanks
The text was updated successfully, but these errors were encountered: