0
点赞
收藏
分享

微信扫一扫

react-native image 属性

蓝哆啦呀 2021-09-25 阅读 164
日记本

tintColor#

为所有非透明的像素指定一个颜色。

 <Image
                  style={{
                    width: s(25),
                    height: s(25),
                    tintColor: colors.grey60,
                  }}
                  source={images.crossMedium}
                />

非常有用的一个属性

背景相关(background)

backfaceVisibility 改元素背面面向屏幕时是否可见,做动画的时候可能会用到,

ios效果

android效果

componentWillMount() {
  const { flipAnimation } = this.state;

  if (Platform.OS === 'android') {
    Animated.sequence([
      Animated.timing(flipAnimation, {
        toValue: 180,
        duration: 1,
        useNativeDriver: true,
      }),
      Animated.timing(flipAnimation, {
        toValue: 0,
        duration: 1,
        useNativeDriver: true,
      }),
    ]).start();
  }
}
举报

相关推荐

0 条评论