mirror of
https://github.com/status-im/react-native.git
synced 2025-01-28 18:25:06 +00:00
4ca949b46e
Summary: For iPhones with small screen sizes (e.g: iPhone 5s), inside the `<WKWebView/>` component, videos will play in fullscreen mode. In this diff, I introduce a prop called `allowsInlineMediaPlayback` that when set to true, will allow videos to play inline. **Note:** For videos to play inline, the HTML video element must also have a `playsinline` attribute on it. Reviewed By: shergin Differential Revision: D6379770 fbshipit-source-id: a0130720ffede6c24a90cad0c97a75b657d77017
35 lines
887 B
JavaScript
35 lines
887 B
JavaScript
/**
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
* @flow
|
|
* @providesModule WKWebView
|
|
*/
|
|
|
|
const React = require('react');
|
|
|
|
const requireNativeComponent = require('requireNativeComponent');
|
|
|
|
const RCTWKWebView = requireNativeComponent('RCTWKWebView');
|
|
|
|
type RCTWKWebViewProps = {
|
|
allowsInlineMediaPlayback?: boolean,
|
|
};
|
|
|
|
class WKWebView extends React.Component<RCTWKWebViewProps> {
|
|
componentWillReceiveProps(nextProps: RCTWKWebViewProps) {
|
|
if (this.props.allowsInlineMediaPlayback !== nextProps.allowsInlineMediaPlayback) {
|
|
console.error('Changes to property allowsInlineMediaPlayback do nothing after the initial render.');
|
|
}
|
|
}
|
|
|
|
render() {
|
|
return <RCTWKWebView {...this.props}/>;
|
|
}
|
|
}
|
|
|
|
module.exports = WKWebView;
|