gpt4 book ai didi

react-native - react 原生 : Radial Gradient Background

转载 作者:行者123 更新时间:2023-12-05 00:59:25 29 4
gpt4 key购买 nike

对于其中一个 View ,是否有一个包或另一种方法来获得一个简单的,比如蓝色到蓝色的径向渐变背景?

我试过 react-native-radial-gradient ,但好像已经过时了。

最佳答案

也许你可以使用 RadialGradient来 self 的react-native-image-filter-kit包裹。请注意,react-native-image-filter-kit 的渐变最初设计为与其他图像混合的基元,而您的情况一开始并未考虑在内。

import { Image } from 'react-native'
import {
RadialGradient,
ImageBackgroundPlaceholder
} from 'react-native-image-filter-kit'

const imageStyle = { width: 320, height: 320 }

const gradient = (
<RadialGradient
colors={['red', '#00ff00', 'blue']}
stops={[0, 0.5, 1]}
image={
<ImageBackgroundPlaceholder style={imageStyle}>
/* your content here */
</ImageBackgroundPlaceholder>
}
/>
)

result

关于react-native - react 原生 : Radial Gradient Background,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53604241/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com