我们可以在 React Native 中更改 Swiper 模块的按钮颜色吗?

Can we change button color of Swiper module in React Native?

我使用 React native。 我想使用 react-native-swiper.

的 Swiper

从“react-native-swiper”导入 Swiper;

如您所见,按钮颜色设置为 blue 作为 默认值 以及 size.

我使用这个 Swiper 如下。

<Swiper
  style={{
    width,
    height: 400,
  }}
  buttonWrapperStyle={{
    paddingHorizontal: 20,
  }}
  horizontal
  showsButtons={true}
  showsPagination={true}
  }
>
  {file.map((onepic) => (
    <File
      resizeMode="cover"
      style={{ width, height: 400 }}
      source={{ uri: onepic }}
    ></File>
  ))}
</Swiper>

即使我搜索了很多关于如何更改按钮颜色和大小的方法,也没有找到。

请帮助我。

可以的,有一种叫做buttonWrapperStyle的道具,它不过是一种风格。

您甚至可以使用 nextButtonprevButton 道具

更改特定 left/right 按钮的样式
nextButton={()=><Text style={styles.buttonText}>Next</Text>}

从这里找到更多详细信息https://github.com/leecade/react-native-swiper#control-buttons