TouchableOpacity border radius breaks background color on Android - React Native

 ̄綄美尐妖づ 提交于 2019-12-14 03:08:51

问题


I have a button that's styled as a TouchableOpacity.

On iOS this button has a white background and round corners, but in Android the background color doesn't get applied when there's a border-radius, it does when I take it out. border-radius also doesn't appear to have any effect regardless of whether there's a background color or not in Android.

I know I can use some conditional based on the platform, but I'd like to know if it's possible to have the same between the two platforms with the same code.

export const SomeButton = styled.TouchableOpacity`
  flex: 1;
  border-radius: 4
  background: white;
`

回答1:


I had exactly the same problem. I had to roll back the react-native to 0.60.5



来源:https://stackoverflow.com/questions/58421150/touchableopacity-border-radius-breaks-background-color-on-android-react-native

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!