|
@@ -0,0 +1,54 @@
|
|
1
|
+# Contributing to React Native WebView
|
|
2
|
+
|
|
3
|
+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.
|
|
4
|
+
|
|
5
|
+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.
|
|
6
|
+
|
|
7
|
+## How to test changes
|
|
8
|
+
|
|
9
|
+After you fork the repo, clone it to your machine, and make your changes, you'll want to test them in an app.
|
|
10
|
+
|
|
11
|
+In a new `react-native init` project, do this:
|
|
12
|
+
|
|
13
|
+```
|
|
14
|
+$ yarn add ../react-native-webview
|
|
15
|
+$ react-native link react-native-webview
|
|
16
|
+```
|
|
17
|
+
|
|
18
|
+You may run into a problem where the `jest-haste-map` module map says react-native was added twice:
|
|
19
|
+
|
|
20
|
+```
|
|
21
|
+Loading dependency graph...(node:32651) UnhandledPromiseRejectionWarning: Error: jest-haste-map: Haste module naming collision:
|
|
22
|
+ Duplicate module name: react-native
|
|
23
|
+ Paths: /Users/myuser/TestApp/node_modules/react-native/package.json collides with /Users/myuser/TestApp/node_modules/react-native-webview/node_modules/react-native/package.json
|
|
24
|
+```
|
|
25
|
+
|
|
26
|
+Just remove the second path like this:
|
|
27
|
+
|
|
28
|
+```
|
|
29
|
+$ rm -rf ./node_modules/react-native-webview/node_modules/react-native
|
|
30
|
+```
|
|
31
|
+
|
|
32
|
+And then re-run the packager:
|
|
33
|
+
|
|
34
|
+```
|
|
35
|
+$ react-native start --reset-cache
|
|
36
|
+```
|
|
37
|
+
|
|
38
|
+When you make a change, you'll probably need to unlink, remove, re-add, and re-link `react-native-webview`:
|
|
39
|
+
|
|
40
|
+```
|
|
41
|
+$ react-native unlink react-native-webview && yarn remove react-native-webview
|
|
42
|
+$ yarn add ../react-native-webview && react-native link react-native-webview
|
|
43
|
+```
|
|
44
|
+
|
|
45
|
+## Notes
|
|
46
|
+
|
|
47
|
+- We use Flow types. TypeScript types will probably be added at a later date.
|
|
48
|
+- We don't intend to support UIWebView and will remove it soon.
|
|
49
|
+- After pulling this repo and installing all dependencies, you can run flow on iOS and Android-specific files using the commands:
|
|
50
|
+ - `yarn test:ios:flow` for iOS
|
|
51
|
+ - `yarn test:android:flow` for Android
|
|
52
|
+- If you want to add another React Native platform to this repository, you will need to create another `.flowconfig` for it. If your platform is `example`, copy the main flowconfig and rename it to `.flowconfig.example`. Then edit the config to ignore other platforms, and add `.*/*[.]example.js` to the ignore lists of the other platforms. Then add an entry to `package.json` like this:
|
|
53
|
+ - `"test:example:flow": "flow check --flowconfig-name .flowconfig.example"`
|
|
54
|
+- Currently you need to install React Native 0.57 to be able to test these types - `flow check` will not pass against 0.56.
|