add onEnd Prop

This commit is contained in:
Mike Wilcox 2015-04-10 23:40:13 -04:00 committed by Brent Vatne
parent a7644bfdbe
commit e6e4d13bc2

View File

@ -28,6 +28,7 @@ var Video = React.createClass({
onLoad: PropTypes.func, onLoad: PropTypes.func,
onError: PropTypes.func, onError: PropTypes.func,
onProgress: PropTypes.func, onProgress: PropTypes.func,
onEnd: PropTypes.func,
}, },
mixins: [NativeMethodsMixin], mixins: [NativeMethodsMixin],
@ -61,6 +62,10 @@ var Video = React.createClass({
this.setNativeProps({seek: parseFloat(time)}); this.setNativeProps({seek: parseFloat(time)});
}, },
_onEnd(event) {
this.props.onEnd && this.props.onEnd(event.nativeEvent);
},
render() { render() {
var style = flattenStyle([styles.base, this.props.style]); var style = flattenStyle([styles.base, this.props.style]);
var source = this.props.source; var source = this.props.source;
@ -89,6 +94,7 @@ var Video = React.createClass({
}, },
onLoad: this._onLoad, onLoad: this._onLoad,
onProgress: this._onProgress, onProgress: this._onProgress,
onEnd: this._onEnd,
}); });
return <RCTVideo {... nativeProps} />; return <RCTVideo {... nativeProps} />;