Browse Source

fix iframe issue on iOS; bump version to 0.2.2

iou90 7 years ago
parent
commit
c5e633f55e
4 changed files with 5 additions and 18 deletions
  1. 2
    7
      autoHeightWebView/index.ios.js
  2. 0
    1
      demo/explorer.js
  3. 2
    9
      demo/ios/demo/Info.plist
  4. 1
    1
      package.json

+ 2
- 7
autoHeightWebView/index.ios.js View File

130
 
130
 
131
 const ScreenWidth = Dimensions.get('window').width;
131
 const ScreenWidth = Dimensions.get('window').width;
132
 
132
 
133
+// note that it can not get height when there are only text objects in a html body which does not make any sense 
133
 const BaseScript =
134
 const BaseScript =
134
     `
135
     `
135
     ; (function () {
136
     ; (function () {
136
-        var wrapper = document.createElement('div');
137
-        wrapper.id = 'height-wrapper';
138
-        while (document.body.firstChild) {
139
-            wrapper.appendChild(document.body.firstChild);
140
-        }
141
-        document.body.appendChild(wrapper);
142
         var i = 0;
137
         var i = 0;
143
         function updateHeight() {
138
         function updateHeight() {
144
-            document.title = wrapper.clientHeight;
139
+            document.title = document.body.firstChild.clientHeight;
145
             window.location.hash = ++i;
140
             window.location.hash = ++i;
146
         }
141
         }
147
         updateHeight();
142
         updateHeight();

+ 0
- 1
demo/explorer.js View File

55
                     alignItems: 'center'
55
                     alignItems: 'center'
56
                 }}>
56
                 }}>
57
                 <AutoHeightWebView
57
                 <AutoHeightWebView
58
-                    enableAnimation
59
                     onHeightUpdated={height => this.setState({ height })}
58
                     onHeightUpdated={height => this.setState({ height })}
60
                     source={{ html: this.state.html }}
59
                     source={{ html: this.state.html }}
61
                     customScript={this.state.script} />
60
                     customScript={this.state.script} />

+ 2
- 9
demo/ios/demo/Info.plist View File

41
 	<key>NSLocationWhenInUseUsageDescription</key>
41
 	<key>NSLocationWhenInUseUsageDescription</key>
42
 	<string></string>
42
 	<string></string>
43
 	<key>NSAppTransportSecurity</key>
43
 	<key>NSAppTransportSecurity</key>
44
-	<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
45
 	<dict>
44
 	<dict>
46
-		<key>NSExceptionDomains</key>
47
-		<dict>
48
-			<key>localhost</key>
49
-			<dict>
50
-				<key>NSExceptionAllowsInsecureHTTPLoads</key>
51
-				<true/>
52
-			</dict>
53
-		</dict>
45
+		<key>NSAllowsArbitraryLoads</key>
46
+		<true/>
54
 	</dict>
47
 	</dict>
55
 </dict>
48
 </dict>
56
 </plist>
49
 </plist>

+ 1
- 1
package.json View File

1
 {
1
 {
2
   "name": "react-native-autoheight-webview",
2
   "name": "react-native-autoheight-webview",
3
-  "version": "0.2.1",
3
+  "version": "0.2.2",
4
   "description": "An auto height webview for React Native",
4
   "description": "An auto height webview for React Native",
5
   "main": "autoHeightWebView",
5
   "main": "autoHeightWebView",
6
   "files": [
6
   "files": [