Export property from Objective-C to React

This commit is contained in:
Stanisław Chmiela 2016-03-31 20:36:39 +02:00
parent 5244a5b797
commit 8ebfa6e4db
2 changed files with 7 additions and 0 deletions

View File

@ -43,6 +43,7 @@ RCT_EXPORT_VIEW_PROPERTY(volume, float);
RCT_EXPORT_VIEW_PROPERTY(rate, float); RCT_EXPORT_VIEW_PROPERTY(rate, float);
RCT_EXPORT_VIEW_PROPERTY(seek, float); RCT_EXPORT_VIEW_PROPERTY(seek, float);
RCT_EXPORT_VIEW_PROPERTY(currentTime, float); RCT_EXPORT_VIEW_PROPERTY(currentTime, float);
RCT_EXPORT_VIEW_PROPERTY(fullscreen, BOOL);
- (NSDictionary *)constantsToExport - (NSDictionary *)constantsToExport
{ {

View File

@ -21,6 +21,7 @@ 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._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);
@ -38,6 +39,10 @@ export default class Video extends Component {
this.setNativeProps({ seek: time }); this.setNativeProps({ seek: time });
} }
goFullscreen() {
this.setNativeProps({ fullscreen: true });
}
_assignRoot(component) { _assignRoot(component) {
this._root = component; this._root = component;
} }
@ -134,6 +139,7 @@ Video.propTypes = {
/* Native only */ /* Native only */
src: PropTypes.object, src: PropTypes.object,
seek: PropTypes.number, seek: PropTypes.number,
fullscreen: PropTypes.bool,
/* Wrapper component */ /* Wrapper component */
source: PropTypes.object, source: PropTypes.object,