【问题标题】:How to change the color of a transparent background image's text in react native?如何在本机反应中更改透明背景图像文本的颜色?
【发布时间】:2021-06-07 22:05:49
【问题描述】:

我有这张图片

quran image

我希望它是这样的

quran image dark

在原生反应中可以做到吗

【问题讨论】:

    标签: reactjs react-native react-native-stylesheet


    【解决方案1】:

    我想出了一种方法来使用 png 图像来做到这一点,你所要做的就是

    <Image style={{ tintColor: "any color",}} />
    

    【讨论】:

      【解决方案2】:

      将其包裹在 View 中并添加背景颜色样式。

      <View style={styles.imageContainer}>
      {...image here}
      </View>
      

      const styles = StyleSheet.create({
          imageContainer: {
              backgroundColor: 'blue'
          }
      })
      

      【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-06-06
      • 1970-01-01
      • 2017-12-01
      • 2012-07-26
      • 1970-01-01
      • 2015-12-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多