React Native:径向渐变背景
React Native: Radial Gradient Background
是否有一个包或其他方法可以为其中一个视图提供简单的,比方说蓝色到蓝色,径向渐变背景?
我试过react-native-radial-gradient,但好像已经过时了。
也许你可以使用 RadialGradient from my 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>
}
/>
)
是否有一个包或其他方法可以为其中一个视图提供简单的,比方说蓝色到蓝色,径向渐变背景?
我试过react-native-radial-gradient,但好像已经过时了。
也许你可以使用 RadialGradient from my 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>
}
/>
)