add dragHandleRef: To allow for a ref to be passed in to be used as the Drag Handle
Allows for a dragHandleRef to be passed in to be used as the drag handle
Only works on Web
Hi @tabishmahfuz1
Thank you for contributing to this repository. I have some thoughts on your inputs though.
- Make sure your contribution passes the rules defined in https://github.com/3DJakob/react-tinder-card/blob/master/CONTRIBUTING.md. You need to implement this to the native side as well.
- From what I can tell this is an unnecessary addition. You can just add
useRefto theTinderCardor any element inside to achieve the same effect or am I missing something? If I am please explain.
Hey @3DJakob , on the 2nd point, The userRef on TinderCard would give us only the ref to the card itself to call the API methods, right?
What I needed here was to only allow the card to be dragged by a specific ref inside the card. So basically I didn't want to whole card to listen to mouseDown or mouseDrag but just one part of the card, e.g. the header of the card in my case.
Does that make it clear? Let me know if you want me to explain further. Happy to do it if I couldn't explain it clearly :)
Ok! Thank you for that explanation that makes sense! I guess this could be good when using ScrollViews inside a card. What do you think about updating the documentation to something like this?
### `dragHandleRef`
- optional
- type: `React.Ref<API>`
React Ref to a component that should be acting as a handle for swiping the card instead of using the whole card.
Also if you want an easy way of testing this on mobile as well I suggest you simply clone the https://github.com/3DJakob/react-native-tinder-card-demo repo.
Will update the doc. Your version surely makes more sense.
And also thanks for the example repo :) Will try to get this done too
The documentation is automatically generated from index.d.ts, add the property there and then run npx ts-readme-generator, that will update readme.md automatically 🚀
@LinusU Thanks man. Will do.
@3DJakob The swipe gestures are not responding in the android app. The buttons are working though. So, I can't test this until that's fixed. This is the same issue here, I guess #77
Just FYI, I had to update the expo-sdk to even get it running.
Saw this here: https://stackoverflow.com/questions/58314694/pan-responder-simply-not-working-on-android
This seems to fix the drag issue if we do set the AnimatedView style property flex: 1 but then just messes up the whole card layout.