First off, thank you for considering contributing to the React Native Community. The community-supported packages are only possible because of amazing people like you.
Secondly, we’d like the contribution experience to be as good as possible. While we are a small all-volunteer team, we are happy to hear feedback about your experience, and if we can make the docs or experience better please let us know.
After you fork the repo, clone it to your machine, and make your changes, you’ll want to test them in an app.
There are two methods of testing:
1) Testing within a clone of webview
2) Testing in a new react-native init
project
$ yarn install
$ yarn start:android
The Android example app will built, the Metro Bundler will launch, and the example app will be installed and started in the Android emulator.
$ cd example/ios
$ pod install
$ cd ../..
$ yarn start:ios
The iOS example app will be built, the Metro bundler will launch, and the example app will be install and started in the Simulator.
$ open example/macos/example.xcodeproj
$ yarn start:macos
The Metro Bundler will now be running in the Terminal for react-native-macos. In XCode select the example-macos
target and Run.
react-native init
projectIn a new react-native init
project, do this:
$ yarn add ../webview
$ react-native link webview
You may run into a problem where the jest-haste-map
module map says react-native was added twice:
Loading dependency graph...(node:32651) UnhandledPromiseRejectionWarning: Error: jest-haste-map: Haste module naming collision:
Duplicate module name: react-native
Paths: /Users/myuser/TestApp/node_modules/react-native/package.json collides with /Users/myuser/TestApp/node_modules/webview/node_modules/react-native/package.json
Just remove the second path like this:
$ rm -rf ./node_modules/webview/node_modules/react-native
And then re-run the packager:
$ react-native start --reset-cache
When you make a change, you’ll probably need to unlink, remove, re-add, and re-link webview
:
$ react-native unlink webview && yarn remove webview
$ yarn add ../webview && react-native link webview
yarn ci