Use API instead of prop to show and hide fullscreen player

This commit is contained in:
Stanisław Chmiela 2016-04-01 11:12:50 +02:00
parent 931ea75edd
commit f6ee6a91a3

View File

@ -21,7 +21,8 @@ export default class Video extends Component {
constructor(props, context) { constructor(props, context) {
super(props, context); super(props, context);
this.seek = this.seek.bind(this); this.seek = this.seek.bind(this);
this.goFullscreen = this.goFullscreen.bind(this); this.presentFullscreenPlayer = this.presentFullscreenPlayer.bind(this);
this.dismissFullscreenPlayer = this.dismissFullscreenPlayer.bind(this);
this._assignRoot = this._assignRoot.bind(this); this._assignRoot = this._assignRoot.bind(this);
this._onLoadStart = this._onLoadStart.bind(this); this._onLoadStart = this._onLoadStart.bind(this);
this._onLoad = this._onLoad.bind(this); this._onLoad = this._onLoad.bind(this);
@ -43,10 +44,14 @@ export default class Video extends Component {
this.setNativeProps({ seek: time }); this.setNativeProps({ seek: time });
} }
goFullscreen() { presentFullscreenPlayer() {
this.setNativeProps({ fullscreen: true }); this.setNativeProps({ fullscreen: true });
} }
dismissFullscreenPlayer() {
this.setNativeProps({ fullscreen: false });
}
_assignRoot(component) { _assignRoot(component) {
this._root = component; this._root = component;
} }
@ -207,5 +212,6 @@ const RCTVideo = requireNativeComponent('RCTVideo', Video, {
nativeOnly: { nativeOnly: {
src: true, src: true,
seek: true, seek: true,
fullscreen: true,
}, },
}); });