|  | 
 |  | 
 | 
												
													
														| 15 |  
 | 15 |  
 | 
												
													
														| 16 |  ## usage
 | 16 |  ## usage
 | 
												
													
														| 17 |  
 | 17 |  
 | 
												
													
														| 18 | -`react-native link react-native-webview`
 |  | 
 | 
												
													
														| 19 | -
 |  | 
 | 
												
													
														| 20 |  ```javascript
 | 18 |  ```javascript
 | 
												
													
														| 21 |  import AutoHeightWebView from 'react-native-autoheight-webview'
 | 19 |  import AutoHeightWebView from 'react-native-autoheight-webview'
 | 
												
													
														|  | 
 | 20 | +
 | 
												
													
														| 22 |  import { Dimensions } from 'react-native'
 | 21 |  import { Dimensions } from 'react-native'
 | 
												
													
														| 23 |  
 | 22 |  
 | 
												
													
														| 24 |  <AutoHeightWebView
 | 23 |  <AutoHeightWebView
 | 
												
													
														| 25 | -    // default width is the width of screen
 |  | 
 | 
												
													
														|  | 
 | 24 | +    // default by screen width,
 | 
												
													
														| 26 |      // 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
 | 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 |      style={{ width: Dimensions.get('window').width - 15, marginTop: 35 }}
 | 26 |      style={{ width: Dimensions.get('window').width - 15, marginTop: 35 }}
 | 
												
													
														| 28 |      customScript={`document.body.style.background = 'lightyellow';`}
 | 27 |      customScript={`document.body.style.background = 'lightyellow';`}
 | 
												
											
												
													
														|  | 
 |  | 
 | 
												
													
														| 35 |          font-size: 16px;
 | 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 |      onSizeUpdated={({size => console.log(size.height)})},
 | 38 |      onSizeUpdated={({size => console.log(size.height)})},
 | 
												
													
														| 40 |      /*
 | 39 |      /*
 | 
												
													
														| 41 | -    use local or remote files
 |  | 
 | 
												
													
														|  | 
 | 40 | +    using local or remote files
 | 
												
													
														| 42 |      to add local files:
 | 41 |      to add local files:
 | 
												
													
														| 43 |      add baseUrl/files... to android/app/src/assets/ on android
 | 42 |      add baseUrl/files... to android/app/src/assets/ on android
 | 
												
													
														| 44 |      add baseUrl/files... to project root on iOS
 | 43 |      add baseUrl/files... to project root on iOS
 | 
												
											
												
													
														|  | 
 |  | 
 | 
												
													
														| 68 |  
 | 67 |  
 | 
												
													
														| 69 |  ## demo
 | 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/".
 |