简体   繁体   English

当用户在 React Native Android 中设置暗模式时,如何更改 ScrollView 滚动条的颜色?

[英]How to change the colour of a ScrollView's scrollbar when the user has set dark mode on in React Native Android?

Long story short, if I use a <ScrollView> element while my decide doesn't have dark mode on, the scrollbar is dark grey-ish, however, if the user has dark mode on, it's lighter colour and blends with my app's background.长话短说,如果我使用<ScrollView>元素,而我的决定没有打开暗模式,则滚动条是深灰色的,但是,如果用户打开了暗模式,它的颜色会变浅并与我的应用程序的背景融为一体.

I was wondering if there's a simple way to change the colour of a ScrollView's scrollbar when dark mode in on in Android React Native?我想知道是否有一种简单的方法可以在 Android React Native 中打开暗模式时更改 ScrollView 滚动条的颜色?

you could use the react-native-scrollbar library to set the scrollbar color in your app: Try您可以使用 react-native-scrollbar 库在您的应用程序中设置滚动条颜色:尝试

import { ScrollView } from 'react-native-scrollbar';

<ScrollView
scrollbarColor="#FF0000"
// other props here
>
{/* content goes here */}
</ScrollView>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM