简体   繁体   中英

How i can remove react-native button shadow?

I am trying to figure out 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). 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;" at all there is multi way to approach this i personal use elevation: 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

以下代码将删除按钮阴影

style = {{ elevation: 0 }}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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