【问题标题】:SVG background image in React NativeReact Native 中的 SVG 背景图像
【发布时间】:2020-05-26 16:03:10
【问题描述】:

我正在使用 react-native-svg 将 SVG 图像添加到我的 react native 项目中。但是,我正在努力解决如何将该图像设置为组件中的背景图像。我找不到任何资源来解决这个问题。

我尝试了类似的方法,但它只显示了 SVG,里面没有内容。

import Autentificare from '../../../assets/Autentificare.svg';

class Login extends React.Component {
 render() {
<Autentificare>
<View>....</View>
</Autentificare>

【问题讨论】:

    标签: reactjs react-native svg


    【解决方案1】:

    你可以把你的 svg 放在一个绝对位置的容器中

    return (
      <View>
        <View
          style={{ position: "absolute", top: 0, left: 0, right: 0, bottom: 0 }}
        >
          <Autentificare />
        </View>
        <View>...</View>
      </View>
    );
    

    【讨论】:

      猜你喜欢
      • 2019-12-16
      • 2022-01-12
      • 1970-01-01
      • 2022-01-11
      • 2020-06-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-06
      相关资源
      最近更新 更多