|
@@ -15,14 +15,13 @@ Read [README_old](./README_old.md) for earlier version guide.
|
15
|
15
|
|
16
|
16
|
## usage
|
17
|
17
|
|
18
|
|
-`react-native link react-native-webview`
|
19
|
|
-
|
20
|
18
|
```javascript
|
21
|
19
|
import AutoHeightWebView from 'react-native-autoheight-webview'
|
|
20
|
+
|
22
|
21
|
import { Dimensions } from 'react-native'
|
23
|
22
|
|
24
|
23
|
<AutoHeightWebView
|
25
|
|
- // default width is the width of screen
|
|
24
|
+ // default by screen width,
|
26
|
25
|
// 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
|
27
|
26
|
style={{ width: Dimensions.get('window').width - 15, marginTop: 35 }}
|
28
|
27
|
customScript={`document.body.style.background = 'lightyellow';`}
|
|
@@ -35,10 +34,10 @@ import { Dimensions } from 'react-native'
|
35
|
34
|
font-size: 16px;
|
36
|
35
|
}
|
37
|
36
|
`}
|
38
|
|
- // either height or width updated will trigger this
|
|
37
|
+ // either height or width updated will trigger onSizeUpdated
|
39
|
38
|
onSizeUpdated={({size => console.log(size.height)})},
|
40
|
39
|
/*
|
41
|
|
- use local or remote files
|
|
40
|
+ using local or remote files
|
42
|
41
|
to add local files:
|
43
|
42
|
add baseUrl/files... to android/app/src/assets/ on android
|
44
|
43
|
add baseUrl/files... to project root on iOS
|
|
@@ -68,5 +67,5 @@ import { Dimensions } from 'react-native'
|
68
|
67
|
|
69
|
68
|
## demo
|
70
|
69
|
|
71
|
|
-You may have to use yarn to install the dependencies of the demo and remove "demo/node_modules/react-native-autoheight-webview/demo" manually, cause of installing a local package with npm will create symlink, but there is no supporting of React Native to symlink (https://github.com/facebook/watchman/issues/105).
|
72
|
|
-For android, you may have to copy the "C:\Users\UserName\.android\debug.keystore" to "demo/android/app/".
|
|
70
|
+You may have to use yarn to install the dependencies of the demo and remove "demo/node_modules/react-native-autoheight-webview/demo" manually, cause of installing a local package with npm will create symlink, but there is no supporting of React Native to symlink (https://github.com/facebook/watchman/issues/105) and "yarn install" ignores "files" from local dependencies (https://github.com/yarnpkg/yarn/issues/2822).
|
|
71
|
+For android, you may have to copy the "Users\UserName\.android\debug.keystore" to "demo/android/app/".
|