-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from gis-tools/develop
Develop
- Loading branch information
Showing
9 changed files
with
289 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,55 @@ | ||
# Create ESRI React App | ||
### Create ESRI React App | ||
|
||
Goal of Create ESRI React App is to connect ESRI and React application with minimal effort by using **create-react-app** to create react application and **esri-loader** to add the ArcGIS JS API to React app. | ||
Prerequisite for this application is Create React App already instaled in your developmant envirement. If that is not the case run | ||
Goal of Create ESRI React App is to connect ESRI and React application with minimal effort by using **[create-react-app](https://github.com/facebookincubator/create-react-app)** to create react application and **[esri-loader](https://github.com/Esri/esri-loader)** to add the ArcGIS JS API to React app. | ||
A prerequisite for this application is Create React App already installed in your development environment. If Create React App is not installed on your system run: | ||
|
||
```$xslt | ||
``` | ||
npm install -g create-react-app | ||
``` | ||
|
||
|
||
### How to install Create ESRI React App | ||
To install Create ESRI React App application run | ||
```$xslt | ||
To install Create ESRI React App application run: | ||
``` | ||
$ npm install create-esri-react-app -g | ||
- or - | ||
$ yarn global add create-esri-react-app | ||
``` | ||
|
||
### How to create new ESRI React App | ||
To create ESRI React application run | ||
```$xslt | ||
To create ESRI React application run: | ||
``` | ||
$ create-esri-react-app app_name | ||
``` | ||
``` | ||
|
||
It will create a directory called `app_name` inside the current folder.<br> | ||
Inside that directory, it will generate the initial project structure and install the transitive dependencies: | ||
|
||
``` | ||
app_name | ||
├── README.md | ||
├── node_modules | ||
├── package.json | ||
├── .gitignore | ||
├── public | ||
│ └── favicon.ico | ||
│ └── index.html | ||
│ └── manifest.json | ||
└── src | ||
└── App.css | ||
└── App.js | ||
└── App.test.js | ||
└── index.css | ||
└── index.js | ||
└── logo.svg | ||
└── registerServiceWorker.js | ||
``` | ||
|
||
### Information's related to Create React App | ||
Create React apps with no build configuration. | ||
|
||
* [Getting Started](#getting-started) – How to create a new app. | ||
* [User Guide](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md) – How to develop apps bootstrapped with Create React App. | ||
|
||
Create React App works on macOS, Windows, and Linux.<br> | ||
If something doesn’t work please [file an issue](https://github.com/facebookincubator/create-react-app/issues/new). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React, {Component} from 'react'; | ||
import './App.css'; | ||
import * as esriLoader from 'esri-loader'; | ||
|
||
if (!esriLoader.isLoaded()) { | ||
esriLoader.bootstrap((err) => { | ||
if (err) { | ||
console.error(err); | ||
} else { | ||
createMap(); | ||
} | ||
}, { | ||
// url: 'https://js.arcgis.com/4.4/' // Here you can change API version | ||
}); | ||
} else { | ||
createMap(); | ||
} | ||
|
||
function createMap() { | ||
esriLoader.dojoRequire([ | ||
"esri/Map", | ||
"esri/views/MapView" | ||
], function(Map, MapView){ | ||
let map = new Map({ | ||
basemap: "gray-vector" | ||
}); | ||
window.map = map; | ||
let view = new MapView({ | ||
map: map, | ||
container: "mapNode", | ||
basemap: 'gray-vector', | ||
center: [-100, 30], | ||
zoom: 3 | ||
}); | ||
}); | ||
} | ||
|
||
class App extends Component { | ||
render() { | ||
return ( | ||
<div className="App"> | ||
<div className="App-header"> | ||
<h1>Welcome to ESRI React App</h1> | ||
</div> | ||
<div id="mapNode" /> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,41 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no" /> | ||
<meta name="author" content="Bojan Zivkovic"> | ||
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"> | ||
<link rel="stylesheet" href="https://js.arcgis.com/3.21/dijit/themes/claro/claro.css"> | ||
<link rel="stylesheet" href="https://js.arcgis.com/3.21/esri/css/esri.css"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<meta name="theme-color" content="#000000"> | ||
<meta name="author" content="Bojan Zivkovic"> | ||
<link rel="preload stylesheet" href="https://js.arcgis.com/3.21/esri/css/main.css"> | ||
<!-- | ||
manifest.json provides metadata used when your web app is added to the | ||
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/ | ||
--> | ||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json"> | ||
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"> | ||
<!-- | ||
Notice the use of %PUBLIC_URL% in the tags above. | ||
It will be replaced with the URL of the `public` folder during the build. | ||
Only files inside the `public` folder can be referenced from the HTML. | ||
<!-- | ||
Notice the use of %PUBLIC_URL% in the tag above. | ||
It will be replaced with the URL of the `public` folder during the build. | ||
Only files inside the `public` folder can be referenced from the HTML. | ||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will | ||
work correctly both with client-side routing and a non-root public URL. | ||
Learn how to configure a non-root public URL by running `npm run build`. | ||
--> | ||
<title>Esri React App</title> | ||
</head> | ||
<body> | ||
<noscript> | ||
You need to enable JavaScript to run this app. | ||
</noscript> | ||
<div id="root"></div> | ||
<!-- | ||
This HTML file is a template. | ||
If you open it directly in the browser, you will see an empty page. | ||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will | ||
work correctly both with client-side routing and a non-root public URL. | ||
Learn how to configure a non-root public URL by running `npm run build`. | ||
--> | ||
<title>Esri React App</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<!-- | ||
This HTML file is a template. | ||
If you open it directly in the browser, you will see an empty page. | ||
You can add webfonts, meta tags, or analytics to this file. | ||
The build step will place the bundled scripts into the <body> tag. | ||
You can add webfonts, meta tags, or analytics to this file. | ||
The build step will place the bundled scripts into the <body> tag. | ||
To begin the development, run `npm start`. | ||
To create a production bundle, use `npm run build`. | ||
--> | ||
</body> | ||
To begin the development, run `npm start` or `yarn start`. | ||
To create a production bundle, use `npm run build` or `yarn build`. | ||
--> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<meta name="theme-color" content="#000000"> | ||
<meta name="author" content="Bojan Zivkovic"> | ||
<link rel="preload stylesheet" href="https://js.arcgis.com/4.4/esri/css/main.css"> | ||
<!-- | ||
manifest.json provides metadata used when your web app is added to the | ||
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/ | ||
--> | ||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json"> | ||
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"> | ||
<!-- | ||
Notice the use of %PUBLIC_URL% in the tags above. | ||
It will be replaced with the URL of the `public` folder during the build. | ||
Only files inside the `public` folder can be referenced from the HTML. | ||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will | ||
work correctly both with client-side routing and a non-root public URL. | ||
Learn how to configure a non-root public URL by running `npm run build`. | ||
--> | ||
<title>Esri React App</title> | ||
</head> | ||
<body> | ||
<noscript> | ||
You need to enable JavaScript to run this app. | ||
</noscript> | ||
<div id="root"></div> | ||
<!-- | ||
This HTML file is a template. | ||
If you open it directly in the browser, you will see an empty page. | ||
You can add webfonts, meta tags, or analytics to this file. | ||
The build step will place the bundled scripts into the <body> tag. | ||
To begin the development, run `npm start` or `yarn start`. | ||
To create a production bundle, use `npm run build` or `yarn build`. | ||
--> | ||
</body> | ||
</html> |
Oops, something went wrong.