Various fixes

- Call super in removeFromSuperview
- setRate has to come at the end of modifiers
- Switch to requireNativeComponent
This commit is contained in:
Brent Vatne 2015-06-24 21:26:36 -07:00
parent 44b17119dd
commit a435efe3d0
2 changed files with 11 additions and 11 deletions

View File

@ -325,7 +325,6 @@ static NSString *const statusKeyPath = @"status";
- (void)applyModifiers
{
/* volume must be set to 0 if muted is YES, or the video freezes playback */
if (_muted) {
[_player setVolume:0];
[_player setMuted:YES];
@ -334,11 +333,10 @@ static NSString *const statusKeyPath = @"status";
[_player setMuted:NO];
}
[_player setRate:_rate];
[self setResizeMode:_resizeMode];
[self setRepeat:_repeat];
[self setPaused:_paused];
[_player setRate:_rate];
}
- (void)setRepeat:(BOOL)repeat {
@ -382,6 +380,8 @@ static NSString *const statusKeyPath = @"status";
_eventDispatcher = nil;
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super removeFromSuperview];
}
@end

View File

@ -1,8 +1,8 @@
var React = require('react-native');
var NativeModules = require('NativeModules');
var { requireNativeComponent, } = React;
var ReactNativeViewAttributes = require('ReactNativeViewAttributes');
var NativeModules = require('NativeModules');
var StyleSheet = require('StyleSheet');
var createReactIOSNativeComponentClass = require('createReactNativeComponentClass');
var PropTypes = require('ReactPropTypes');
var StyleSheetPropType = require('StyleSheetPropType');
var VideoResizeMode = require('./VideoResizeMode');
@ -14,6 +14,11 @@ var deepDiffer = require('deepDiffer');
var Video = React.createClass({
propTypes: {
/* Native only */
src: PropTypes.object,
seek: PropTypes.number,
/* Wrapper component */
style: StyleSheetPropType(VideoStylePropTypes),
source: PropTypes.object,
resizeMode: PropTypes.string,
@ -103,12 +108,7 @@ var Video = React.createClass({
},
});
var RCTVideo = createReactIOSNativeComponentClass({
validAttributes: merge(ReactNativeViewAttributes.UIView,
{src: {diff: deepDiffer}, resizeMode: true, repeat: true,
seek: true, paused: true, muted: true, volume: true, rate: true}),
uiViewClassName: 'RCTVideo',
});
var RCTVideo = requireNativeComponent('RCTVideo', Video);
var styles = StyleSheet.create({
base: {