|
@@ -12,7 +12,22 @@ Cause of moving View.propTypes to ViewPropTypes in React Naitve 0.44 (https://gi
|
12
|
12
|
`npm install react-native-autoheight-webview@0.2.3 --save` (rn < 0.44)
|
13
|
13
|
|
14
|
14
|
## android
|
15
|
|
-`react-native link react-native-autoheight-webview`
|
|
15
|
+1. `react-native link react-native-autoheight-webview`
|
|
16
|
+2. in MainApplication.java
|
|
17
|
+```javascript
|
|
18
|
+import com.dscj.autoheightwebview.AutoHeightWebViewPackage; // Add this
|
|
19
|
+
|
|
20
|
+public class MainApplication extends Application implements ReactApplication {
|
|
21
|
+ //...
|
|
22
|
+ private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
|
|
23
|
+ //...
|
|
24
|
+ @Override
|
|
25
|
+ protected List<ReactPackage> getPackages() {
|
|
26
|
+ return Arrays.<ReactPackage>asList(
|
|
27
|
+ //...
|
|
28
|
+ new AutoHeightWebViewPackage() // Add this
|
|
29
|
+ //...
|
|
30
|
+```
|
16
|
31
|
|
17
|
32
|
## showcase
|
18
|
33
|
![react-native-autoheight-webview ios](https://media.giphy.com/media/l4FGyhnvWfUgxCfe0/200w.gif)
|
|
@@ -32,7 +47,7 @@ Cause of moving View.propTypes to ViewPropTypes in React Naitve 0.44 (https://gi
|
32
|
47
|
scalesPageToFit={Platform.OS === 'android' ? true : false}
|
33
|
48
|
// baseUrl not work in android 4.3 or below version
|
34
|
49
|
enableBaseUrl={true}
|
35
|
|
- // offset of rn webview margin
|
|
50
|
+ // offset of rn webview margin
|
36
|
51
|
heightOffset={5}
|
37
|
52
|
// default width is the width of screen
|
38
|
53
|
// if there are some text selection issues on iOS, the width should be reduced more than 15 and the marginTop should be added more than 35
|