ArcGIS JS API and React Native?

4433
6
12-11-2017 11:30 AM
deleted-user-1_r2dgYuILKY
Occasional Contributor III

I've developed several web apps using the REST services (maps and geoprocessing tools) on our ArcGIS Server. My company wants to turn some of these into mobile apps. I can't use App Studio for ArcGIS because the vendor we are contracting with has informed us that they won't accept apps developed with App Studio. They are suggesting we use React Native to develop our apps. 

Is anybody using ArcGIS JS and React Native together to create mobile apps? I've seen some examples of basic ESRI maps in React, but I can't find much with React Native. I'm a total noob to mobile app development, so I'm just trying figure out a possible workflow and exactly what I'll need as far as SDKs. 

0 Kudos
6 Replies
EvelynHernandez
Occasional Contributor III

Well one of my coworkers is working on an app we made 2 years ago (mobile ver of a web app) and its still working fine. He have developed the app with pure JAVA in android and the api for mobile. We havent migrated to react native...

0 Kudos
deleted-user-1_r2dgYuILKY
Occasional Contributor III

I'm looking at React Native because it's JavaScript based (which I can work with) and the apps are supposed to work with iOS and Android. 

ThomasSolow
Occasional Contributor III

I've never used React Native so I can't say anything definitive.

My understanding is that you can write JavaScript while using React Native, so some parts of the Esri JS API will probably work, similar to how you can get parts of the API to work in Node.  Other parts may not work, as React Native does not target a browser and parts of the JS API rely on the browser API.

That last part is a problem when it comes to displaying a map and view.  I don't see how React Native could translate the whole JS API view rendering process into something that would make sense to Android/iOS.  So my guess is that this isn't really possible to use the JS API to render a view in react native.

You might have better luck with the ArcGIS Runtime SDKs for Android and iOS.  Here's a repo that looks like it has a proof of concept: GitHub - glazou/react-native-arcgis-sdk-demo: Proof of concept - Use ArcGIS Runtime SDK for Android ... 

deleted-user-1_r2dgYuILKY
Occasional Contributor III

I'm not worried about displaying maps or views. I just want to have our geoprocessing tools accessible in a mobile app. 

0 Kudos
ThomasSolow
Occasional Contributor III

As per Networking · React Native, it looks like React Native implements the fetch API and also allows you to make HTTP requests from JS via XMLHTTPRequests.  So Geoprocessing tools and other networking related things in the JS API may work, though there may be friction in places where the JS API relies on the browser API (browser cookies for example).

I should point out that you don't technically need the JS API to make requests to geoprocessing tools.  All you need to do is send HTTP requests to the proper URL with the proper parameters and wait for the response.  The JS API just provides a wrapper around that process.

It may be less of a headache to pull in a simple promise-based HTTP library (like GitHub - axios/axios: Promise based HTTP client for the browser and node.js) and write your own wrapper around the geoprocessing API.  You can find more information about the Geoprocessing API here: ArcGIS REST API.

deleted-user-1_r2dgYuILKY
Occasional Contributor III

This is very helpful info, thank you!

0 Kudos