This project was bootstrapped with Create React Native App. The most recent version of this guide is available here.
- Table of Contents
- Getting Started
- Build Instructions
- Additional Build and Test Options
- Writing and Running Tests
- Circle-CI integration
- Deployment
- Troubleshooting
Be sure you're familiar with the Getting Started guide within the React Native documentation.
Install the following tools:
node
viabrew
watchman
viabrew
brew install watchman
- nvm
react-native-cli
vianpm
- be sure to install it globally.npm install -g react-native-cli
- Java SE Development Kit (JDK) 8 or newer
- Xcode
- Android Studio
- Cocoapods
These instructions are current as of the following releases:
- macOS 12.0.1 (Monterey)
- Xcode 13.4.1
- nvm 0.39.1
- node v14.17.6
- npm 6.14.15
- Cocoapods 1.11.2
Use nvm
to install Node.js
:
nvm install v14.17.6
The font assets used by the ndau wallet app are specified in the .npmrc
file in the ndau-wallet-rn
folder. As these are licensed fonts they are not included here. Contact a member of the core team to get the access token you will need.
@fortawesome:registry=https://npm.fontawesome.com/
//npm.fontawesome.com/:_authToken=YOUR_TOKEN_HERE
Replace YOUR_TOKEN_HERE
with the FontAwesomePro token. The text above is correct - @fortawesome
is not a typo.
Now npm install:
npm install
Set up iOS and Android projects with the correct node_module
libraries:
react-native link
// Or, due to autolinking, link and unlink commands have been removed in React Native 0.69. So I try instead: npx react-native-asset
Re-run npm install
and load all assets:
npm install
npm run load-assets
With npm
running, load all required iOS pods. In a separate Terminal shell:
npm start
Leave it running and return to the original shell:
Run once for the first time:
bundle install
cd ios
pod install
Build the wallet app and run it in the iOS Simulator:
cd ..
npx react-native run-ios --simulator='iPhone 11'
Runs your app in development mode.
Sometimes you may need to reset or clear the React Native packager's cache. To do so, you can pass the --reset-cache
flag to the start script:
npm start --reset-cache
# or
yarn start --reset-cache
Runs the jest test runner on your tests.
Like npm start
, but also attempts to open your app in the iOS Simulator if you're on a Mac and have it installed.
Like npm start
, but also attempts to open your app on a connected Android device or emulator. Requires an installation of Android build tools (see React Native docs for detailed setup). We also recommend installing Genymotion as your Android emulator. Once you've finished setting up the native build environment, there are two options for making the right copy of adb
available to Create React Native App:
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.
This project has been configured through CircleCI's GitHub integration to run tests on every commit. To view or change those settings, you may visit this repo's CircleCI page. If you log in with your GitHub account, and you have appropriate privleges you will be able to change the build settings.
To run the CircleCI tests locally, you can execute the script ./.circleci/local.sh
. It will install the CircleCI CLI tool, if you don't already have it.
- Use this link to create the APK
If you're on a Mac, there are a few errors that users sometimes see when attempting to npm run ios
:
- "non-zero exit code: 107"
- "You may need to install Xcode" but it is already installed
- and others
There are a few steps you may want to take to troubleshoot these kinds of errors:
- Make sure Xcode is installed and open it to accept the license agreement if it prompts you. You can install it from the Mac App Store.
- Open Xcode's Preferences, the Locations tab, and make sure that the
Command Line Tools
menu option is set to something. Sometimes when the CLI tools are first installed by Homebrew this option is left blank, which can prevent Apple utilities from finding the simulator. Make sure to re-runnpm/yarn run ios
after doing so. - If that doesn't work, open the Simulator, and under the app menu select
Reset Contents and Settings...
. After that has finished, quit the Simulator, and re-runnpm/yarn run ios
.
Updates:
npm dependency updates (audit) componentWillMount => componentDidMount RNCNetInfo -- deprecated API Can't perform a React state update on an unmounted component -- to fix, cancel all subscriptions and asynchronous tasks in "a useEffect cleanup function" in RecoveryWordInput (at SetupGetRecoveryPhrase.js:401)