Skip to content
New issue

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

How onGestureStart, onGestureEnd and onPointSelected work?! #81

Open
ziziele opened this issue Jun 29, 2023 · 1 comment
Open

How onGestureStart, onGestureEnd and onPointSelected work?! #81

ziziele opened this issue Jun 29, 2023 · 1 comment
Labels
question Further information is requested

Comments

@ziziele
Copy link

ziziele commented Jun 29, 2023

Could someone please edit the documentation or explain how to make it work?

I spent 3 days and still can't figure it out. The person who made this package is not cool.

const Test = ({ setPriceTitle }) => {
  const currentPrice = 0;

  const onGestureStart = useCallback(() => {
    hapticFeedback("impactLight");
  }, []);

  const onGestureEnd = useCallback(() => {
    setPriceTitle(currentPrice);
  }, [currentPrice, setPriceTitle]);

  const onPointSelected = useCallback((p) => {
    setPriceTitle(p);
  }, []);

  return (
    <LineGraph
      points={somePoints}
      color={someColors}
      style={someStyles}
      animated={true}
      onGestureStart={onGestureStart}
      onPointSelected={onPointSelected}
      onGestureEnd={onGestureEnd}
    />
  );
};

export default Test;
@michaelpomogajko
Copy link

What exactly is not clear? onPointSelected takes a callback and passes the current point. From there you can set it via state and do whatever you want

@Montchy Montchy added the question Further information is requested label Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants