简体   繁体   中英

react-native: Reference external JS file

I am very new to React Native. For the app that I am building, I need to use a JavaScript API. The API documentation says to use this in an HTML file:

<link rel="stylesheet" href="https://js.arcgis.com/4.4/esri/css/main.css">
<script src="https://js.arcgis.com/4.4/"></script>

Is it possible to reference these in React Native?

If I understood your question right, I don't see a reason why you shouldn't. As arcgis doesn't have a module registered, you can have the CDN reference in the higher level of your application. When you have a CDN referenced in your app, it is on the client-side, which means the browser will download the file, on the other hand, a module will be maintained on the server. You can read more about it here

If you are looking for an alternative, I have found ArcGIS Runtime SDK for React Native

您可以在这里尝试使用它的nodearcgis作为react native

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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