我怎么知道我在哪个页面(react-native-swiper)?

How do I know which page I am on(react-native-swiper)?

我正在使用 React Native 开发一个小应用程序,并且在我的应用程序中使用“react-native-swiper”。 在这个包“react-native-swiper”中,我怎么知道我现在在哪个页面? 我可以得到一些值来指示我在哪张幻灯片上,例如幻灯片索引吗? 现在在屏幕上,有 2 张幻灯片,每张幻灯片都有相同的图像,位置在幻灯片外偏心。我重叠了 2 张图像。

The problem is that:

在 android 中,当我从幻灯片 1 推到幻灯片 2 时,粉色图像消失,但 iOS 没有。 所以我想根据幻灯片索引来控制它的不透明度。

如何在“react-native-swiper”中获取幻灯片索引?

你可以使用onIndexChanged道具功能Called with the new index when the user swiped 这将为您提供当前幻灯片的索引。