React native 需要在圆角按钮上渲染圆角阴影
我需要渲染圆形按钮上的圆形阴影。阴影应该像图像中给定的那样渲染,但我不能像那个样渲染 但它没有正确渲染并显示如下 它看起来像下面 风格将是这样的React native 需要在圆角按钮上渲染圆角阴影,react-native,shadow,react-native-stylesheet,React Native,Shadow,React Native Stylesheet,我需要渲染圆形按钮上的圆形阴影。阴影应该像图像中给定的那样渲染,但我不能像那个样渲染 但它没有正确渲染并显示如下 它看起来像下面 风格将是这样的 const styles = StyleSheet.create({ buttonStyle : { height: 60, width: 60, marginRight: 15, shadowColor: "#4e4f72", shadowOpacity: 0.2, sh
const styles = StyleSheet.create({
buttonStyle : {
height: 60,
width: 60,
marginRight: 15,
shadowColor: "#4e4f72",
shadowOpacity: 0.2,
shadowRadius: 30,
shadowOffset: {
height: 0,
width: 0
},
borderRadius: 30,
elevation: 30,
},
})
视图样式
能否尝试将图像放置在视图中。从图像中删除阴影样式并将其放置到视图中。在我的情况下,这是有效的
<View
style={{
height: 60,
width: 60,
marginRight: 15,
shadowColor: '#4e4f72',
shadowOpacity: 0.2,
shadowRadius: 30,
shadowOffset: {
height: 0,
width: 0,
},
borderRadius: 30,
elevation: 30,
alignItems: 'center',
justifyContent: 'center',
}}
>
<Image style={{ height: 60, width: 60, borderRadius: 30 }} />
</View>
别忘了将require添加回图像组件您可以向我们显示应用buttonStyle对象的视图代码吗?@realarb question edited
<View
style={{
height: 60,
width: 60,
marginRight: 15,
shadowColor: '#4e4f72',
shadowOpacity: 0.2,
shadowRadius: 30,
shadowOffset: {
height: 0,
width: 0,
},
borderRadius: 30,
elevation: 30,
alignItems: 'center',
justifyContent: 'center',
}}
>
<Image style={{ height: 60, width: 60, borderRadius: 30 }} />
</View>