在反应本机中单击按钮时刷卡

Swipe card when button clicks in react native

我目前正在使用 React Native 构建像 tinder 这样的移动应用程序,我使用本机基础包中的 Deck Swiper,但我没有找到关于如何在单击按钮时刷卡的解决方案。

这个 link 是我一直在使用的原生基础的 Deck Swiper 组件:http://nativebase.io/docs/v0.5.13/components#deckSwiper

关于如何通过点击按钮刷卡有什么建议或想法吗?

首先,您需要保存DeckSwiper组件的引用:

<DeckSwiper ref={(deck) => this.deck = deck}>

稍后,您可以使用this.deck.swipeRight()this.deck.swipeLeft