小编Sau*_*aul的帖子

React-native-svg 中的 LinearGradient 不起作用

我正在尝试在我的 React Native 项目中使用 SVG。这是我的组件的代码:

<Svg xmlns="http://www.w3.org/2000/svg" width="100%" height="507" viewBox="0 0 375 507" style={{position:'absolute', bottom:0}}>

  <Defs>

     <ClipPath id="a">
        <Rect class="a" fill='#fff' stroke='#707070' width="375" height="507" transform="translate(0 160)" d="M0 0h375v507H0z"/>
    </ClipPath>

    <LinearGradient id="b" clipPath='url(#a)' x1="0.5" x2="-0.031" y2="1.477" gradientUnits="objectBoundingBox">
        <Stop offset="0" stopColor="rgb(76,209,149)"  />
        <Stop offset="1" stopColor="rgb(170,221,100)"  />
    </LinearGradient>

  </Defs>

    <G class="b" transform="translate(0 -160)">
        <Circle class="c" cx="334.249" cy="334.249" r="334.249" transform="translate(-146.354 164.646)"  fill='url(#b)' />
    </G>

</Svg>
Run Code Online (Sandbox Code Playgroud)

我得到的输出是:

https://i.stack.imgur.com/mGaBg.png

svg react-native react-native-svg

7
推荐指数
1
解决办法
2万
查看次数

无法在React-native中从Firebase Firestore获取数据

我正在尝试从Firestore获取数据,但是看不到数据。我正在构建一个本机应用程序。我正在使用react-native-firebase。

我还尝试了react-native-firebase文档中的Transactions方法。但是没有任何效果。

这是我的代码:

firebase.firestore().collection('users').doc(uid)
          .get()
          .then((doc)=>{ 
                  console.log(doc)
                  console.log(doc.data().shoppinglist)   
          })
          .catch(e => console.log(e));
Run Code Online (Sandbox Code Playgroud)

控制台记录.get()给了我一个承诺。

我得到这样的承诺:

Promise {_40: 0, _65: 0, _55: null, _72: null}
_40: 0
_55: null
_65: 0
_72: null
Run Code Online (Sandbox Code Playgroud)

但是.then()不会执行为两个console.log()不会记录任何内容。

请帮我在这里。Firebase相当新。

firebase react-native google-cloud-firestore react-native-firebase

5
推荐指数
1
解决办法
943
查看次数