简体   繁体   English

我如何删除react-native按钮阴影?

[英]How i can remove react-native button shadow?

I am trying to figure out React Native. 我想弄清楚React Native。 When I created button I see unexpected bottom shadow. 当我创建按钮时,我看到意外的底部阴影。 How can i prevented? 我怎么能阻止? (Gray color) (灰色)

在此输入图像描述

Code: 码:

<Button 
    title="LOGIN"
    color='#f2a743'
/>

我成功地删除了elevation: 0的阴影elevation: 0按钮的样式为elevation: 0

I don't think thats possible. 我认为不可能。 If you don't need a button elevation (shadow), you may create your own react-native button using using Touchables(TochableOpacity, TochableHighlight, TouchableWithoutFeedback). 如果您不需要按钮高程(阴影),则可以使用Touchables(TochableOpacity,TochableHighlight,TouchableWithoutFeedback)创建自己的react-native按钮。 And it's not a big deal. 这不是什么大不了的事。

Please refer to the docs . 请参阅文档

renderButton = () => { 
  return ( 
    <TouchableOpacity onPress={this._onPressButton}> 
      <ImageBackground style={styles.button} source={require('./myButton.png')} >
      <Text>Press me</Text>
      </ImageBackground>
    </TouchableOpacity>
  );
}

关于使用css删除阴影怎么样?

style="box-shadow: 0px 0px 0p;"

you can't use style="box-shadow: 0px 0px 0p;" 你不能使用style =“box-shadow:0px 0px 0p;” at all there is multi way to approach this i personal use elevation: 0 总之有多种方法来处理这个个人使用高程:0

if you use router-flux for navigation pls consider that icons appear with shadow just on android but no shadow exist for ios version by default 如果您使用router-flux进行导航,请考虑图标仅在android上显示阴影,但默认情况下ios版本不存在阴影

以下代码将删除按钮阴影

style = {{ elevation: 0 }}

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

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