简体   繁体   English

您如何直接更改react-native-scrollable-tab-view(Reactive Native)源代码的样式?

[英]How do you directly change style of the source code of react-native-scrollable-tab-view (Reactive Native)?

I'm trying to access the style property 'bottomBorderColor' to change to 'white' but how can I do so? 我正在尝试访问样式属性“ bottomBorderColor”以更改为“ white”,但是我该怎么做呢?

The source code is here -- at the bottom of the page in styles: 源代码在这里-页面底部的样式:

https://github.com/skv-headless/react-native-scrollable-tab-view/blob/master/DefaultTabBar.js#L75 https://github.com/skv-headless/react-native-scrollable-tab-view/blob/master/DefaultTabBar.js#L75

Attempted the following but doesn't work: 尝试了以下操作,但不起作用:

    <ScrollableTabView
      style={{borderBottomColor: 'white'}}
    >
      <Text tabLabel='Tab1'> Testing 1 </Text>
      <Text tabLabel='Tab2'> Testing 2 </Text>
      <Text tabLabel='Tab3'> Testing 3 </Text>
    </ScrollableTabView>

Thank you in advance. 先感谢您。

All exposed properties you CAN modify are listed here props . 您可以修改所有公开的属性这里列出的道具 So the property you are looking could not be passed as a property into component you are using. 因此,您要查找的属性无法作为属性传递到正在使用的组件中。

BUT Why would you want to modify style like that? 但是为什么要这样修改样式? Having inline styles, or even styling your components through JS is not a good idea. 内联样式,甚至通过JS样式化组件都不是一个好主意。 Write a CSS file which would overwrite default styling of the used component instead. 编写一个CSS文件,该文件将覆盖已使用组件的默认样式。 This way styling in your program will be easier to understand and to reason about. 这样,程序中的样式将更易于理解和推理。 And more importantly, it will be easier to change or modify, instead of searching all over in the code base for some styling property objects (since styling is usually found in CSS, LESS or SCSS) 更重要的是,与在代码库中搜索某些样式属性对象相比,更改或修改将更加容易(因为样式通常在CSS,LESS或SCSS中找到)

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

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