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

mqxuamgl  于 2023-03-24  发布在  React
关注(0)|答案(2)|浏览(123)

我使用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>

即使我已经搜索了很多如何改变按钮的颜色和大小,但没有找到。
请帮帮我。

wbgh16ku

wbgh16ku1#

是的,你可以,有一个叫做buttonWrapperStyle的 prop ,它只不过是一种风格。
您甚至可以使用nextButtonprevButton prop 更改特定左/右按钮的样式

nextButton={()=><Text style={styles.buttonText}>Next</Text>}

更多详情请访问https://github.com/leecade/react-native-swiper#control-buttons

iqih9akk

iqih9akk2#

你只要加上

style={{'--swiper-navigation-color': 'blue'}}

相关问题