| 
				
			 | 
			
			
				@@ -23,6 +23,36 @@ import Immutable from 'immutable'; 
			 | 
		
	
		
			
			| 
				23
			 | 
			
				23
			 | 
			
			
				 const RCTAutoHeightWebView = requireNativeComponent('RCTAutoHeightWebView', AutoHeightWebView, { nativeOnly: { messagingEnabled: PropTypes.bool } }); 
			 | 
		
	
		
			
			| 
				24
			 | 
			
				24
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				25
			 | 
			
				25
			 | 
			
			
				 export default class AutoHeightWebView extends PureComponent { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				26
			 | 
			
			
				+    static propTypes = { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				27
			 | 
			
			
				+        source: WebView.propTypes.source, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				28
			 | 
			
			
				+        onHeightUpdated: PropTypes.func, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				29
			 | 
			
			
				+        customScript: PropTypes.string, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				30
			 | 
			
			
				+        enableAnimation: PropTypes.bool, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				31
			 | 
			
			
				+        // if set to true may cause some layout issues (smaller font size) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				32
			 | 
			
			
				+        scalesPageToFit: PropTypes.bool, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				33
			 | 
			
			
				+        // only works on enable animation 
			 | 
		
	
		
			
			| 
				
			 | 
			
				34
			 | 
			
			
				+        animationDuration: PropTypes.number, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				35
			 | 
			
			
				+        // offset of rn webview margin 
			 | 
		
	
		
			
			| 
				
			 | 
			
				36
			 | 
			
			
				+        heightOffset: PropTypes.number, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				37
			 | 
			
			
				+        // baseUrl not work in android 4.3 or below version 
			 | 
		
	
		
			
			| 
				
			 | 
			
				38
			 | 
			
			
				+        enableBaseUrl: PropTypes.bool, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				39
			 | 
			
			
				+        style: ViewPropTypes.style, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				40
			 | 
			
			
				+        // works if set enableBaseUrl to true; add web/files... to android/app/src/assets/ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				41
			 | 
			
			
				+        files: PropTypes.arrayOf(PropTypes.shape({ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				42
			 | 
			
			
				+            href: PropTypes.string, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				43
			 | 
			
			
				+            type: PropTypes.string, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				44
			 | 
			
			
				+            rel: PropTypes.string 
			 | 
		
	
		
			
			| 
				
			 | 
			
				45
			 | 
			
			
				+        })) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				46
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				47
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				48
			 | 
			
			
				+    static defaultProps = { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				49
			 | 
			
			
				+        scalesPageToFit: false, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				50
			 | 
			
			
				+        enableBaseUrl: false, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				51
			 | 
			
			
				+        enableAnimation: true, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				52
			 | 
			
			
				+        animationDuration: 555, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				53
			 | 
			
			
				+        heightOffset: 20 
			 | 
		
	
		
			
			| 
				
			 | 
			
				54
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				55
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				26
			 | 
			
				56
			 | 
			
			
				     constructor(props) { 
			 | 
		
	
		
			
			| 
				27
			 | 
			
				57
			 | 
			
			
				         super(props); 
			 | 
		
	
		
			
			| 
				28
			 | 
			
				58
			 | 
			
			
				         this.onMessage = this.onMessage.bind(this); 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -165,7 +195,7 @@ export default class AutoHeightWebView extends PureComponent { 
			 | 
		
	
		
			
			| 
				165
			 | 
			
				195
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				166
			 | 
			
				196
			 | 
			
			
				     render() { 
			 | 
		
	
		
			
			| 
				167
			 | 
			
				197
			 | 
			
			
				         const { height, script, isChangingSource, heightOffset } = this.state; 
			 | 
		
	
		
			
			| 
				168
			 | 
			
				
			 | 
			
			
				-        const { enableAnimation, source, customScript, style, enableBaseUrl } = this.props; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				198
			 | 
			
			
				+        const { scalesPageToFit, enableAnimation, source, customScript, style, enableBaseUrl } = this.props; 
			 | 
		
	
		
			
			| 
				169
			 | 
			
				199
			 | 
			
			
				         let webViewSource = source; 
			 | 
		
	
		
			
			| 
				170
			 | 
			
				200
			 | 
			
			
				         if (enableBaseUrl) { 
			 | 
		
	
		
			
			| 
				171
			 | 
			
				201
			 | 
			
			
				             webViewSource = Object.assign({}, source, { baseUrl: 'file:///android_asset/web/' }); 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -182,7 +212,7 @@ export default class AutoHeightWebView extends PureComponent { 
			 | 
		
	
		
			
			| 
				182
			 | 
			
				212
			 | 
			
			
				                             style={Styles.webView} 
			 | 
		
	
		
			
			| 
				183
			 | 
			
				213
			 | 
			
			
				                             javaScriptEnabled={true} 
			 | 
		
	
		
			
			| 
				184
			 | 
			
				214
			 | 
			
			
				                             injectedJavaScript={script + customScript} 
			 | 
		
	
		
			
			| 
				185
			 | 
			
				
			 | 
			
			
				-                            scrollEnabled={false} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				215
			 | 
			
			
				+                            scalesPageToFit={scalesPageToFit} 
			 | 
		
	
		
			
			| 
				186
			 | 
			
				216
			 | 
			
			
				                             source={webViewSource} 
			 | 
		
	
		
			
			| 
				187
			 | 
			
				217
			 | 
			
			
				                             onMessage={this.onMessage} 
			 | 
		
	
		
			
			| 
				188
			 | 
			
				218
			 | 
			
			
				                             messagingEnabled={true} 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -194,33 +224,6 @@ export default class AutoHeightWebView extends PureComponent { 
			 | 
		
	
		
			
			| 
				194
			 | 
			
				224
			 | 
			
			
				     } 
			 | 
		
	
		
			
			| 
				195
			 | 
			
				225
			 | 
			
			
				 } 
			 | 
		
	
		
			
			| 
				196
			 | 
			
				226
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				197
			 | 
			
				
			 | 
			
			
				-AutoHeightWebView.propTypes = { 
			 | 
		
	
		
			
			| 
				198
			 | 
			
				
			 | 
			
			
				-    source: WebView.propTypes.source, 
			 | 
		
	
		
			
			| 
				199
			 | 
			
				
			 | 
			
			
				-    onHeightUpdated: PropTypes.func, 
			 | 
		
	
		
			
			| 
				200
			 | 
			
				
			 | 
			
			
				-    customScript: PropTypes.string, 
			 | 
		
	
		
			
			| 
				201
			 | 
			
				
			 | 
			
			
				-    enableAnimation: PropTypes.bool, 
			 | 
		
	
		
			
			| 
				202
			 | 
			
				
			 | 
			
			
				-    // only works on enable animation 
			 | 
		
	
		
			
			| 
				203
			 | 
			
				
			 | 
			
			
				-    animationDuration: PropTypes.number, 
			 | 
		
	
		
			
			| 
				204
			 | 
			
				
			 | 
			
			
				-    // offset of rn webview margin 
			 | 
		
	
		
			
			| 
				205
			 | 
			
				
			 | 
			
			
				-    heightOffset: PropTypes.number, 
			 | 
		
	
		
			
			| 
				206
			 | 
			
				
			 | 
			
			
				-    // baseUrl not work in android 4.3 or below version 
			 | 
		
	
		
			
			| 
				207
			 | 
			
				
			 | 
			
			
				-    enableBaseUrl: PropTypes.bool, 
			 | 
		
	
		
			
			| 
				208
			 | 
			
				
			 | 
			
			
				-    style: ViewPropTypes.style, 
			 | 
		
	
		
			
			| 
				209
			 | 
			
				
			 | 
			
			
				-    // works if set enableBaseUrl to true; add web/files... to android/app/src/assets/ 
			 | 
		
	
		
			
			| 
				210
			 | 
			
				
			 | 
			
			
				-    files: PropTypes.arrayOf(PropTypes.shape({ 
			 | 
		
	
		
			
			| 
				211
			 | 
			
				
			 | 
			
			
				-        href: PropTypes.string, 
			 | 
		
	
		
			
			| 
				212
			 | 
			
				
			 | 
			
			
				-        type: PropTypes.string, 
			 | 
		
	
		
			
			| 
				213
			 | 
			
				
			 | 
			
			
				-        rel: PropTypes.string 
			 | 
		
	
		
			
			| 
				214
			 | 
			
				
			 | 
			
			
				-    })) 
			 | 
		
	
		
			
			| 
				215
			 | 
			
				
			 | 
			
			
				-} 
			 | 
		
	
		
			
			| 
				216
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				217
			 | 
			
				
			 | 
			
			
				-AutoHeightWebView.defaultProps = { 
			 | 
		
	
		
			
			| 
				218
			 | 
			
				
			 | 
			
			
				-    enableAnimation: true, 
			 | 
		
	
		
			
			| 
				219
			 | 
			
				
			 | 
			
			
				-    animationDuration: 555, 
			 | 
		
	
		
			
			| 
				220
			 | 
			
				
			 | 
			
			
				-    enableBaseUrl: false, 
			 | 
		
	
		
			
			| 
				221
			 | 
			
				
			 | 
			
			
				-    heightOffset: 20 
			 | 
		
	
		
			
			| 
				222
			 | 
			
				
			 | 
			
			
				-} 
			 | 
		
	
		
			
			| 
				223
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				224
			 | 
			
				227
			 | 
			
			
				 const ScreenWidth = Dimensions.get('window').width; 
			 | 
		
	
		
			
			| 
				225
			 | 
			
				228
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				226
			 | 
			
				229
			 | 
			
			
				 const IsBelowKitKat = Platform.Version < 19; 
			 |