var _jsxFileName='src/js/LottieView.js';var _createClass=function(){function defineProperties(target,props){for(var i=0;i3?_len-3:0),_key=3;_key<_len;_key++){rest[_key-3]=arguments[_key];}var flattened=_reactNative.StyleSheet.flatten(props[propName]);var usesBorder=Object.keys(flattened).some(function(key){return key.startsWith('border');});if(usesBorder){return Error(componentName+' does not allow any border related style properties to be specified. '+"Border styles for this component will behave differently across platforms. If you'd "+'like to render a border around this component, wrap it with a View.');}return _reactNative.ViewPropTypes.style.apply(_reactNative.ViewPropTypes,[props,propName,componentName].concat(rest));};var NotAllowedPropType=function NotAllowedPropType(props,propName,componentName){var value=props[propName];if(value!=null){return Error(componentName+' cannot specify \''+propName+'\'.');}return null;};var propTypes=_extends({},_reactNative.ViewPropTypes,{style:ViewStyleExceptBorderPropType,children:NotAllowedPropType,resizeMode:_propTypes2.default.oneOf(['cover','contain','center']),progress:_propTypes2.default.number,speed:_propTypes2.default.number,loop:_propTypes2.default.bool,enableMergePathsAndroidForKitKatAndAbove:_propTypes2.default.bool,source:_propTypes2.default.oneOfType([_propTypes2.default.object,_propTypes2.default.string]).isRequired});var defaultProps={progress:0,speed:1,loop:true,enableMergePathsAndroidForKitKatAndAbove:false,resizeMode:'contain',style:_reactNative.StyleSheet.absoluteFill};var viewConfig={uiViewClassName:'LottieAnimationView',validAttributes:{progress:true}};var LottieView=function(_React$Component){_inherits(LottieView,_React$Component);function LottieView(props){_classCallCheck(this,LottieView);var _this=_possibleConstructorReturn(this,(LottieView.__proto__||Object.getPrototypeOf(LottieView)).call(this,props));_this.viewConfig=viewConfig;_this.refRoot=_this.refRoot.bind(_this);return _this;}_createClass(LottieView,[{key:'setNativeProps',value:function setNativeProps(props){_reactNative.UIManager.updateView(this.getHandle(),this.viewConfig.uiViewClassName,{progress:props.progress});}},{key:'play',value:function play(startFrame,endFrame){this.runCommand('play',[startFrame,endFrame]);}},{key:'reset',value:function reset(){this.runCommand('reset');}},{key:'runCommand',value:function runCommand(name){var _this2=this;var args=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];return _reactNative.Platform.select({android:function android(){return _reactNative.UIManager.dispatchViewManagerCommand(_this2.getHandle(),_reactNative.UIManager.LottieAnimationView.Commands[name],args);},ios:function ios(){return LottieViewManager[name].apply(LottieViewManager,[_this2.getHandle()].concat(_toConsumableArray(args)));}})();}},{key:'getHandle',value:function getHandle(){return(0,_reactNative.findNodeHandle)(this.root);}},{key:'refRoot',value:function refRoot(root){this.root=root;}},{key:'render',value:function render(){var source=this.props.source;var sourceName=typeof source==='string'?source:undefined;var sourceJson=typeof source==='string'?undefined:JSON.stringify(source);return _react2.default.createElement(NativeLottieView,_extends({ref:this.refRoot},this.props,{source:undefined,sourceName:sourceName,sourceJson:sourceJson,__source:{fileName:_jsxFileName,lineNumber:123}}));}}]);return LottieView;}(_react2.default.Component);LottieView.propTypes=propTypes;LottieView.defaultProps=defaultProps;var AnimatedLottieView=_reactNative.Animated.createAnimatedComponent(LottieView);AnimatedLottieView.prototype.play=function play(){var startFrame=arguments.length>0&&arguments[0]!==undefined?arguments[0]:-1;var endFrame=arguments.length>1&&arguments[1]!==undefined?arguments[1]:-1;if(this.getNode()){return this.getNode().play(startFrame,endFrame);}console.warn('Trying to animate a view on an unmounted component');return null;};AnimatedLottieView.prototype.reset=function pause(){if(this.getNode()){return this.getNode().reset();}console.warn('Trying to animate a view on an unmounted component');return null;};module.exports=AnimatedLottieView;