简体   繁体   English

如何在 React Native 中渲染 remote.json lottie 文件? .json 文件在云端

[英]how to render remote .json lottie files in react native? .json files are up on the cloud

for ex: now we do:例如:现在我们做:

const ex = { somejson: require('../something/ex.json }

and then call ex where we want to use it.然后在我们想要使用它的地方调用ex

We have too many.json files that take up significant space and to reduce this, we plan to move our.json files up to the cloud and then render the lottie files remotely.我们有太多占用大量空间的 .json 文件,为了减少这种情况,我们计划将我们的 .json 文件移动到云端,然后远程渲染 lottie 文件。 I tried using dotlottie as well for space optimization but yeah, we decided to go for.json only.我也尝试过使用 dotlottie 进行空间优化,但是,是的,我们决定仅将 go 用于 .json。 Now, how do I render the files remotely?现在,如何远程渲染文件?

you would need to do a HTTP GET request with the FETCH API or Axios for example.例如,您需要使用 FETCH API 或 Axios 执行 HTTP GET 请求。

https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch https://www.npmjs.com/package/axios https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch https://www.npmjs.com/package/axios

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM