Browse Source

Merge pull request #93 from SurpassRabbit/master

add allowsInlineMediaPlayback prop && update size properly on iOS
iou90 5 years ago
parent
commit
f807885e85
No account linked to committer's email address
1 changed files with 6 additions and 3 deletions
  1. 6
    3
      autoHeightWebView/index.ios.js

+ 6
- 3
autoHeightWebView/index.ios.js View File

@@ -43,6 +43,7 @@ export default class AutoHeightWebView extends PureComponent {
43 43
     onLoadStart: PropTypes.func,
44 44
     onLoadEnd: PropTypes.func,
45 45
     onShouldStartLoadWithRequest: PropTypes.func,
46
+    allowsInlineMediaPlayback: PropTypes.bool,
46 47
     // 'web/' by default
47 48
     baseUrl: PropTypes.string,
48 49
     // add baseUrl/files... to project root
@@ -83,8 +84,8 @@ export default class AutoHeightWebView extends PureComponent {
83 84
     const width = props.style ? props.style.width : null;
84 85
     if (isSizeChanged(height, oldHeight, width, oldWidth)) {
85 86
       return {
86
-        height,
87
-        width,
87
+        height: height || oldHeight,
88
+        width: width || oldWidth,
88 89
         isSizeChanged: true
89 90
       };
90 91
     }
@@ -148,7 +149,8 @@ export default class AutoHeightWebView extends PureComponent {
148 149
       enableAnimation,
149 150
       heightOffset,
150 151
       style,
151
-      scrollEnabled
152
+      scrollEnabled,
153
+      allowsInlineMediaPlayback
152 154
     } = this.props;
153 155
     const { source, script } = this.getUpdatedState(this.props, getBaseScript, getIframeBaseScript);
154 156
     return (
@@ -178,6 +180,7 @@ export default class AutoHeightWebView extends PureComponent {
178 180
           injectedJavaScript={script}
179 181
           source={source}
180 182
           onNavigationStateChange={this.handleNavigationStateChange}
183
+          allowsInlineMediaPlayback={allowsInlineMediaPlayback}
181 184
         />
182 185
       </Animated.View>
183 186
     );