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

Create useCard custom hook #5

Open
ajenkins opened this issue Dec 19, 2019 · 0 comments
Open

Create useCard custom hook #5

ajenkins opened this issue Dec 19, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@ajenkins
Copy link
Owner

Rather than using the getNextCardData prop, you could instead use a custom hook, maybe called useCard that returns similar information about the card. This is how I imagine it being used:

function MySwiper() {
  const { swipeDirection } = useCard();
  return (
    <DynamicSwiper>
      <View>
        <Text>You swiped to the {swipeDirection}</Text>
      </View>
    </DynamicSwiper>
  );
}
@ajenkins ajenkins added the enhancement New feature or request label Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant