This project was bootstrapped with Create React Native App.
Add an /android/local.properties file point to the SDK.
I.E. sdk.dir=C\:\\Users\\USERNAME\\AppData\\Local\\Android\\Sdk
You NEED to modify the react-native-maps library, otherwise it won't render anything.
edit ``/node_modules/react-native-maps/lib/android/src/java/.../maps/AirMapView.java` change line 105, changing:
if (!contextHasBug(appContext.getCurrentActivity())) {
superContext = appContext.getCurrentActivity();
} else if (contextHasBug(superContext)) {
to
if (contextHasBug(superContext)) {
Per react-native-maps/react-native-maps#1399
It's since been ejected since CRNA doesn't seem to have a vibration library that doesn't require native implementations.
- Updating to New Releases
- Available Scripts
- Writing and Running Tests
- Environment Variables
- Adding Flow
- Customizing App Display Name and Icon
You should only need to update the global installation of create-react-native-app
very rarely, ideally never.
Updating the react-native-scripts
dependency of your app should be as simple as bumping the version number in package.json
and reinstalling your project's dependencies.
Upgrading to a new version of React Native requires updating the react-native
, react
, and expo
package versions, and setting the correct sdkVersion
in app.json
. See the versioning guide for up-to-date information about package version compatibility.
If Yarn was installed when the project was initialized, then dependencies will have been installed via Yarn, and you should probably use it to run these commands as well. Unlike dependency installation, command running syntax is identical for Yarn and NPM at the time of this writing.
This will start the process of "ejecting" from Create React Native App's build scripts. You'll be asked a couple of questions about how you'd like to build your project.
Warning: Running eject is a permanent action (aside from whatever version control system you use). An ejected app will require you to have an Xcode and/or Android Studio environment set up.
You can edit app.json
to include configuration keys under the expo
key.
To change your app's display name, set the expo.name
key in app.json
to an appropriate string.
To set an app icon, set the expo.icon
key in app.json
to be either a local path or a URL. It's recommended that you use a 512x512 png file with transparency.
This project is set up to use jest for tests. You can configure whatever testing strategy you like, but jest works out of the box. Create test files in directories called __tests__
or with the .test
extension to have the files loaded by jest. See the the template project for an example test. The jest documentation is also a wonderful resource, as is the React Native testing tutorial.
You can configure some of Create React Native App's behavior using environment variables.
When starting your project, you'll see something like this for your project URL:
exp://192.168.0.2:19000
The "manifest" at that URL tells the Expo app how to retrieve and load your app's JavaScript bundle, so even if you load it in the app via a URL like exp://localhost:19000
, the Expo client app will still try to retrieve your app at the IP address that the start script provides.
In some cases, this is less than ideal. This might be the case if you need to run your project inside of a virtual machine and you have to access the packager via a different IP address than the one which prints by default. In order to override the IP address or hostname that is detected by Create React Native App, you can specify your own hostname via the REACT_NATIVE_PACKAGER_HOSTNAME
environment variable:
Mac and Linux:
REACT_NATIVE_PACKAGER_HOSTNAME='my-custom-ip-address-or-hostname' npm start
Windows:
set REACT_NATIVE_PACKAGER_HOSTNAME='my-custom-ip-address-or-hostname'
npm start
The above example would cause the development server to listen on exp://my-custom-ip-address-or-hostname:19000
.
Flow is a static type checker that helps you write code with fewer bugs. Check out this introduction to using static types in JavaScript if you are new to this concept.
React Native works with Flow out of the box, as long as your Flow version matches the one used in the version of React Native.
To add a local dependency to the correct Flow version to a Create React Native App project, follow these steps:
- Find the Flow
[version]
at the bottom of the included .flowconfig - Run
npm install --save-dev flow-bin@x.y.z
(oryarn add --dev flow-bin@x.y.z
), wherex.y.z
is the .flowconfig version number. - Add
"flow": "flow"
to thescripts
section of yourpackage.json
. - Add
// @flow
to any files you want to type check (for example, toApp.js
).
Now you can run npm run flow
(or yarn flow
) to check the files for type errors.
You can optionally use a plugin for your IDE or editor for a better integrated experience.
To learn more about Flow, check out its documentation.