| 
				
			 | 
			
			
				@@ -1,6 +1,6 @@ 
			 | 
		
	
		
			
			| 
				1
			 | 
			
				1
			 | 
			
			
				 'use strict'; 
			 | 
		
	
		
			
			| 
				2
			 | 
			
				2
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				3
			 | 
			
				
			 | 
			
			
				-import { Dimensions, Platform } from 'react-native'; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3
			 | 
			
			
				+import { Dimensions } from 'react-native'; 
			 | 
		
	
		
			
			| 
				4
			 | 
			
				4
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				5
			 | 
			
				5
			 | 
			
			
				 const domMutationObserveScript = ` 
			 | 
		
	
		
			
			| 
				6
			 | 
			
				6
			 | 
			
			
				   var MutationObserver = 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -14,6 +14,9 @@ const domMutationObserveScript = ` 
			 | 
		
	
		
			
			| 
				14
			 | 
			
				14
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				15
			 | 
			
				15
			 | 
			
			
				 const updateSizeWithMessage = (element, scalesPageToFit) => 
			 | 
		
	
		
			
			| 
				16
			 | 
			
				16
			 | 
			
			
				   ` 
			 | 
		
	
		
			
			| 
				
			 | 
			
				17
			 | 
			
			
				+  var usingScale = 0; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				18
			 | 
			
			
				+  var scaling = false; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				19
			 | 
			
			
				+  var zoomedin = false; 
			 | 
		
	
		
			
			| 
				17
			 | 
			
				20
			 | 
			
			
				   var lastHeight = 0; 
			 | 
		
	
		
			
			| 
				18
			 | 
			
				21
			 | 
			
			
				   var heightTheSameTimes = 0; 
			 | 
		
	
		
			
			| 
				19
			 | 
			
				22
			 | 
			
			
				   var maxHeightTheSameTimes = 5; 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -21,7 +24,10 @@ const updateSizeWithMessage = (element, scalesPageToFit) => 
			 | 
		
	
		
			
			| 
				21
			 | 
			
				24
			 | 
			
			
				   var forceRefreshTimeout; 
			 | 
		
	
		
			
			| 
				22
			 | 
			
				25
			 | 
			
			
				   var checkPostMessageTimeout; 
			 | 
		
	
		
			
			| 
				23
			 | 
			
				26
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				24
			 | 
			
				
			 | 
			
			
				-  function updateSize(event) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				27
			 | 
			
			
				+  function updateSize() { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				28
			 | 
			
			
				+    if (zoomedin || scaling) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				29
			 | 
			
			
				+      return; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				30
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				25
			 | 
			
				31
			 | 
			
			
				     if ( 
			 | 
		
	
		
			
			| 
				26
			 | 
			
				32
			 | 
			
			
				       !window.hasOwnProperty('ReactNativeWebView') ||  
			 | 
		
	
		
			
			| 
				27
			 | 
			
				33
			 | 
			
			
				       !window.ReactNativeWebView.hasOwnProperty('postMessage') 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -29,14 +35,20 @@ const updateSizeWithMessage = (element, scalesPageToFit) => 
			 | 
		
	
		
			
			| 
				29
			 | 
			
				35
			 | 
			
			
				       checkPostMessageTimeout = setTimeout(updateSize, 200); 
			 | 
		
	
		
			
			| 
				30
			 | 
			
				36
			 | 
			
			
				       return; 
			 | 
		
	
		
			
			| 
				31
			 | 
			
				37
			 | 
			
			
				     } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				38
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				32
			 | 
			
				39
			 | 
			
			
				     clearTimeout(checkPostMessageTimeout); 
			 | 
		
	
		
			
			| 
				33
			 | 
			
				40
			 | 
			
			
				     height = ${element}.offsetHeight || document.documentElement.offsetHeight; 
			 | 
		
	
		
			
			| 
				34
			 | 
			
				41
			 | 
			
			
				     width = ${element}.offsetWidth || document.documentElement.offsetWidth; 
			 | 
		
	
		
			
			| 
				35
			 | 
			
				
			 | 
			
			
				-    var scale = ${scalesPageToFit ? 'screen.width / window.innerWidth' : '1'}; 
			 | 
		
	
		
			
			| 
				36
			 | 
			
				
			 | 
			
			
				-    window.ReactNativeWebView.postMessage(JSON.stringify({ width: Math.min(width, screen.width), height: height * scale })); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				42
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				43
			 | 
			
			
				+    if(!usingScale && window.innerWidth) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				44
			 | 
			
			
				+      usingScale = ${scalesPageToFit ? 'screen.width / window.innerWidth' : '1'}; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				45
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				46
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				47
			 | 
			
			
				+    window.ReactNativeWebView.postMessage(JSON.stringify({ width: Math.min(width, screen.width), height: height * usingScale })); 
			 | 
		
	
		
			
			| 
				37
			 | 
			
				48
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				38
			 | 
			
				49
			 | 
			
			
				     // Make additional height checks (required to fix issues wit twitter embeds) 
			 | 
		
	
		
			
			| 
				39
			 | 
			
				50
			 | 
			
			
				     clearTimeout(forceRefreshTimeout); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				51
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				40
			 | 
			
				52
			 | 
			
			
				     if (lastHeight !== height) { 
			 | 
		
	
		
			
			| 
				41
			 | 
			
				53
			 | 
			
			
				       heightTheSameTimes = 1; 
			 | 
		
	
		
			
			| 
				42
			 | 
			
				54
			 | 
			
			
				     } else { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -67,20 +79,29 @@ const setViewportContent = content => { 
			 | 
		
	
		
			
			| 
				67
			 | 
			
				79
			 | 
			
			
				 }; 
			 | 
		
	
		
			
			| 
				68
			 | 
			
				80
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				69
			 | 
			
				81
			 | 
			
			
				 const detectZoomChanged = ` 
			 | 
		
	
		
			
			| 
				70
			 | 
			
				
			 | 
			
			
				-  var zoomedin = false; 
			 | 
		
	
		
			
			| 
				71
			 | 
			
				82
			 | 
			
			
				   var latestTapStamp = 0; 
			 | 
		
	
		
			
			| 
				72
			 | 
			
				
			 | 
			
			
				-  var lastScale = false; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				83
			 | 
			
			
				+  var lastScale = 1.0; 
			 | 
		
	
		
			
			| 
				73
			 | 
			
				84
			 | 
			
			
				   var doubleTapDelay = 400; 
			 | 
		
	
		
			
			| 
				74
			 | 
			
				85
			 | 
			
			
				   function detectZoomChanged() { 
			 | 
		
	
		
			
			| 
				75
			 | 
			
				
			 | 
			
			
				-    var tempZoomedin = (screen.width / window.innerWidth) > 1; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				86
			 | 
			
			
				+    var tempZoomedin = (screen.width / window.innerWidth) > (usingScale || 1); 
			 | 
		
	
		
			
			| 
				76
			 | 
			
				87
			 | 
			
			
				     tempZoomedin !== zoomedin && window.ReactNativeWebView.postMessage(JSON.stringify({ zoomedin: tempZoomedin })); 
			 | 
		
	
		
			
			| 
				77
			 | 
			
				88
			 | 
			
			
				     zoomedin = tempZoomedin; 
			 | 
		
	
		
			
			| 
				78
			 | 
			
				89
			 | 
			
			
				   } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				90
			 | 
			
			
				+  window.addEventListener('ontouchstart', event => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				91
			 | 
			
			
				+    if (event.touches.length === 2) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				92
			 | 
			
			
				+      scaling = true; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				93
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				94
			 | 
			
			
				+  }) 
			 | 
		
	
		
			
			| 
				79
			 | 
			
				95
			 | 
			
			
				   window.addEventListener('touchend', event => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				96
			 | 
			
			
				+    if(scaling) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				97
			 | 
			
			
				+      scaleing = false; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				98
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				99
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				80
			 | 
			
				100
			 | 
			
			
				     var tempScale = event.scale;  
			 | 
		
	
		
			
			| 
				81
			 | 
			
				101
			 | 
			
			
				     tempScale !== lastScale && detectZoomChanged(); 
			 | 
		
	
		
			
			| 
				82
			 | 
			
				102
			 | 
			
			
				     lastScale = tempScale; 
			 | 
		
	
		
			
			| 
				83
			 | 
			
				103
			 | 
			
			
				     var timeSince = new Date().getTime() - latestTapStamp; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				104
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				84
			 | 
			
				105
			 | 
			
			
				     // double tap    
			 | 
		
	
		
			
			| 
				85
			 | 
			
				106
			 | 
			
			
				     if(timeSince < 600 && timeSince > 0) { 
			 | 
		
	
		
			
			| 
				86
			 | 
			
				107
			 | 
			
			
				       zoomedinTimeOut = setTimeout(() => { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -88,11 +109,12 @@ const detectZoomChanged = ` 
			 | 
		
	
		
			
			| 
				88
			 | 
			
				109
			 | 
			
			
				         detectZoomChanged(); 
			 | 
		
	
		
			
			| 
				89
			 | 
			
				110
			 | 
			
			
				       }, doubleTapDelay); 
			 | 
		
	
		
			
			| 
				90
			 | 
			
				111
			 | 
			
			
				     } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				112
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				91
			 | 
			
				113
			 | 
			
			
				     latestTapStamp = new Date().getTime(); 
			 | 
		
	
		
			
			| 
				92
			 | 
			
				114
			 | 
			
			
				   }); 
			 | 
		
	
		
			
			| 
				93
			 | 
			
				115
			 | 
			
			
				 `; 
			 | 
		
	
		
			
			| 
				94
			 | 
			
				116
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				95
			 | 
			
				
			 | 
			
			
				-const getBaseScript = ({ style, viewportContent, scalesPageToFit, scrollEnabledWithZoomedin }) => 
			 | 
		
	
		
			
			| 
				
			 | 
			
				117
			 | 
			
			
				+const getBaseScript = ({ viewportContent, scalesPageToFit, scrollEnabledWithZoomedin }) => 
			 | 
		
	
		
			
			| 
				96
			 | 
			
				118
			 | 
			
			
				   ` 
			 | 
		
	
		
			
			| 
				97
			 | 
			
				119
			 | 
			
			
				   ; 
			 | 
		
	
		
			
			| 
				98
			 | 
			
				120
			 | 
			
			
				   if (!document.getElementById("rnahw-wrapper")) { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -165,7 +187,7 @@ const getScript = ({ 
			 | 
		
	
		
			
			| 
				165
			 | 
			
				187
			 | 
			
			
				   scalesPageToFit, 
			 | 
		
	
		
			
			| 
				166
			 | 
			
				188
			 | 
			
			
				   scrollEnabledWithZoomedin 
			 | 
		
	
		
			
			| 
				167
			 | 
			
				189
			 | 
			
			
				 }) => { 
			 | 
		
	
		
			
			| 
				168
			 | 
			
				
			 | 
			
			
				-  let script = getBaseScript({ style, viewportContent, scalesPageToFit, scrollEnabledWithZoomedin }); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				190
			 | 
			
			
				+  let script = getBaseScript({ viewportContent, scalesPageToFit, scrollEnabledWithZoomedin }); 
			 | 
		
	
		
			
			| 
				169
			 | 
			
				191
			 | 
			
			
				   script = files && files.length > 0 ? appendFilesToHead({ files, script }) : script; 
			 | 
		
	
		
			
			| 
				170
			 | 
			
				192
			 | 
			
			
				   script = appendStylesToHead({ style: customStyle, script }); 
			 | 
		
	
		
			
			| 
				171
			 | 
			
				193
			 | 
			
			
				   customScript && (script = customScript + script); 
			 |