浏览代码

fix iframe issue on iOS; bump version to 0.2.2

iou90 7 年前
父节点
当前提交
c5e633f55e
共有 4 个文件被更改,包括 5 次插入18 次删除
  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 查看文件

@@ -130,18 +130,13 @@ AutoHeightWebView.defaultProps = {
130 130
 
131 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 134
 const BaseScript =
134 135
     `
135 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 137
         var i = 0;
143 138
         function updateHeight() {
144
-            document.title = wrapper.clientHeight;
139
+            document.title = document.body.firstChild.clientHeight;
145 140
             window.location.hash = ++i;
146 141
         }
147 142
         updateHeight();

+ 0
- 1
demo/explorer.js 查看文件

@@ -55,7 +55,6 @@ export default class Explorer extends Component {
55 55
                     alignItems: 'center'
56 56
                 }}>
57 57
                 <AutoHeightWebView
58
-                    enableAnimation
59 58
                     onHeightUpdated={height => this.setState({ height })}
60 59
                     source={{ html: this.state.html }}
61 60
                     customScript={this.state.script} />

+ 2
- 9
demo/ios/demo/Info.plist 查看文件

@@ -41,16 +41,9 @@
41 41
 	<key>NSLocationWhenInUseUsageDescription</key>
42 42
 	<string></string>
43 43
 	<key>NSAppTransportSecurity</key>
44
-	<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
45 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 47
 	</dict>
55 48
 </dict>
56 49
 </plist>

+ 1
- 1
package.json 查看文件

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