ddf7ec593371fc2577f42c5c4653300d.json 15 KB
{"ast":null,"code":"var _interopRequireDefault=require(\"@babel/runtime/helpers/interopRequireDefault\");Object.defineProperty(exports,\"__esModule\",{value:true});exports.createTransitioningComponent=createTransitioningComponent;exports.Transition=exports.Transitioning=void 0;var _objectWithoutProperties2=_interopRequireDefault(require(\"@babel/runtime/helpers/objectWithoutProperties\"));var _classCallCheck2=_interopRequireDefault(require(\"@babel/runtime/helpers/classCallCheck\"));var _createClass2=_interopRequireDefault(require(\"@babel/runtime/helpers/createClass\"));var _possibleConstructorReturn2=_interopRequireDefault(require(\"@babel/runtime/helpers/possibleConstructorReturn\"));var _getPrototypeOf5=_interopRequireDefault(require(\"@babel/runtime/helpers/getPrototypeOf\"));var _inherits2=_interopRequireDefault(require(\"@babel/runtime/helpers/inherits\"));var _extends2=_interopRequireDefault(require(\"@babel/runtime/helpers/extends\"));var _react=_interopRequireDefault(require(\"react\"));var _View=_interopRequireDefault(require(\"react-native-web/dist/exports/View\"));var _findNodeHandle=_interopRequireDefault(require(\"react-native-web/dist/exports/findNodeHandle\"));var _ReanimatedModule=_interopRequireDefault(require(\"./ReanimatedModule\"));var TransitioningContext=_react.default.createContext();function configFromProps(type,props){var config={type:type};if('durationMs'in props){config.durationMs=props.durationMs;}if('interpolation'in props){config.interpolation=props.interpolation;}if('type'in props){config.animation=props.type;}if('delayMs'in props){config.delayMs=props.delayMs;}if('propagation'in props){config.propagation=props.propagation;}return config;}function wrapTransitioningContext(Comp){return function(props){return _react.default.createElement(TransitioningContext.Consumer,null,function(context){return _react.default.createElement(Comp,(0,_extends2.default)({context:context},props));});};}var In=function(_React$Component){(0,_inherits2.default)(In,_React$Component);function In(){(0,_classCallCheck2.default)(this,In);return(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf5.default)(In).apply(this,arguments));}(0,_createClass2.default)(In,[{key:\"componentDidMount\",value:function componentDidMount(){this.props.context.push(configFromProps('in',this.props));}},{key:\"render\",value:function render(){return this.props.children||null;}}]);return In;}(_react.default.Component);var Change=function(_React$Component2){(0,_inherits2.default)(Change,_React$Component2);function Change(){(0,_classCallCheck2.default)(this,Change);return(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf5.default)(Change).apply(this,arguments));}(0,_createClass2.default)(Change,[{key:\"componentDidMount\",value:function componentDidMount(){this.props.context.push(configFromProps('change',this.props));}},{key:\"render\",value:function render(){return this.props.children||null;}}]);return Change;}(_react.default.Component);var Out=function(_React$Component3){(0,_inherits2.default)(Out,_React$Component3);function Out(){(0,_classCallCheck2.default)(this,Out);return(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf5.default)(Out).apply(this,arguments));}(0,_createClass2.default)(Out,[{key:\"componentDidMount\",value:function componentDidMount(){this.props.context.push(configFromProps('out',this.props));}},{key:\"render\",value:function render(){return this.props.children||null;}}]);return Out;}(_react.default.Component);var Together=function(_React$Component4){(0,_inherits2.default)(Together,_React$Component4);function Together(){var _getPrototypeOf2;var _this;(0,_classCallCheck2.default)(this,Together);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=(0,_possibleConstructorReturn2.default)(this,(_getPrototypeOf2=(0,_getPrototypeOf5.default)(Together)).call.apply(_getPrototypeOf2,[this].concat(args)));_this.transitions=[];return _this;}(0,_createClass2.default)(Together,[{key:\"componentDidMount\",value:function componentDidMount(){var config=configFromProps('group',this.props);config.transitions=this.transitions;this.props.context.push(config);}},{key:\"render\",value:function render(){return _react.default.createElement(TransitioningContext.Provider,{value:this.transitions},this.props.children);}}]);return Together;}(_react.default.Component);var Sequence=function(_React$Component5){(0,_inherits2.default)(Sequence,_React$Component5);function Sequence(){var _getPrototypeOf3;var _this2;(0,_classCallCheck2.default)(this,Sequence);for(var _len2=arguments.length,args=new Array(_len2),_key2=0;_key2<_len2;_key2++){args[_key2]=arguments[_key2];}_this2=(0,_possibleConstructorReturn2.default)(this,(_getPrototypeOf3=(0,_getPrototypeOf5.default)(Sequence)).call.apply(_getPrototypeOf3,[this].concat(args)));_this2.transitions=[];return _this2;}(0,_createClass2.default)(Sequence,[{key:\"componentDidMount\",value:function componentDidMount(){var config=configFromProps('group',this.props);config.sequence=true;config.transitions=this.transitions;this.props.context.push(config);}},{key:\"render\",value:function render(){return _react.default.createElement(TransitioningContext.Provider,{value:this.transitions},this.props.children);}}]);return Sequence;}(_react.default.Component);function createTransitioningComponent(Component){var Wrapped=function(_React$Component6){(0,_inherits2.default)(Wrapped,_React$Component6);function Wrapped(){var _getPrototypeOf4;var _this3;(0,_classCallCheck2.default)(this,Wrapped);for(var _len3=arguments.length,args=new Array(_len3),_key3=0;_key3<_len3;_key3++){args[_key3]=arguments[_key3];}_this3=(0,_possibleConstructorReturn2.default)(this,(_getPrototypeOf4=(0,_getPrototypeOf5.default)(Wrapped)).call.apply(_getPrototypeOf4,[this].concat(args)));_this3.propTypes=Component.propTypes;_this3.transitions=[];_this3.viewRef=_react.default.createRef();return _this3;}(0,_createClass2.default)(Wrapped,[{key:\"componentDidMount\",value:function componentDidMount(){if(this.props.animateMount){this.animateNextTransition();}}},{key:\"setNativeProps\",value:function setNativeProps(props){this.viewRef.current.setNativeProps(props);}},{key:\"animateNextTransition\",value:function animateNextTransition(){var viewTag=(0,_findNodeHandle.default)(this.viewRef.current);_ReanimatedModule.default.animateNextTransition(viewTag,{transitions:this.transitions});}},{key:\"render\",value:function render(){var _this$props=this.props,transition=_this$props.transition,rest=(0,_objectWithoutProperties2.default)(_this$props,[\"transition\"]);return _react.default.createElement(_react.default.Fragment,null,_react.default.createElement(TransitioningContext.Provider,{value:this.transitions},transition),_react.default.createElement(Component,(0,_extends2.default)({},rest,{ref:this.viewRef,collapsable:false})));}}]);return Wrapped;}(_react.default.Component);return Wrapped;}var Transitioning={View:createTransitioningComponent(_View.default)};exports.Transitioning=Transitioning;var Transition={Sequence:wrapTransitioningContext(Sequence),Together:wrapTransitioningContext(Together),In:wrapTransitioningContext(In),Out:wrapTransitioningContext(Out),Change:wrapTransitioningContext(Change)};exports.Transition=Transition;","map":{"version":3,"sources":["C:/Users/bluej/Desktop/2_2/searchGuide/searchGuide/node_modules/react-native-reanimated/src/Transitioning.js"],"names":["TransitioningContext","React","createContext","configFromProps","type","props","config","durationMs","interpolation","animation","delayMs","propagation","wrapTransitioningContext","Comp","context","In","push","children","Component","Change","Out","Together","transitions","Sequence","sequence","createTransitioningComponent","Wrapped","propTypes","viewRef","createRef","animateMount","animateNextTransition","current","setNativeProps","viewTag","ReanimatedModule","transition","rest","Transitioning","View","Transition"],"mappings":"w5BAAA,oD,oLAEA,4EAEA,GAAMA,CAAAA,oBAAoB,CAAGC,eAAMC,aAAN,EAA7B,CAEA,QAASC,CAAAA,eAAT,CAAyBC,IAAzB,CAA+BC,KAA/B,CAAsC,CACpC,GAAMC,CAAAA,MAAM,CAAG,CAAEF,IAAI,CAAJA,IAAF,CAAf,CACA,GAAI,cAAgBC,CAAAA,KAApB,CAA2B,CACzBC,MAAM,CAACC,UAAP,CAAoBF,KAAK,CAACE,UAA1B,CACD,CACD,GAAI,iBAAmBF,CAAAA,KAAvB,CAA8B,CAC5BC,MAAM,CAACE,aAAP,CAAuBH,KAAK,CAACG,aAA7B,CACD,CACD,GAAI,QAAUH,CAAAA,KAAd,CAAqB,CACnBC,MAAM,CAACG,SAAP,CAAmBJ,KAAK,CAACD,IAAzB,CACD,CACD,GAAI,WAAaC,CAAAA,KAAjB,CAAwB,CACtBC,MAAM,CAACI,OAAP,CAAiBL,KAAK,CAACK,OAAvB,CACD,CACD,GAAI,eAAiBL,CAAAA,KAArB,CAA4B,CAC1BC,MAAM,CAACK,WAAP,CAAqBN,KAAK,CAACM,WAA3B,CACD,CACD,MAAOL,CAAAA,MAAP,CACD,CAQD,QAASM,CAAAA,wBAAT,CAAkCC,IAAlC,CAAwC,CACtC,MAAO,UAAAR,KAAK,CAAI,CACd,MACE,8BAAC,oBAAD,CAAsB,QAAtB,MACG,SAAAS,OAAO,QAAI,8BAAC,IAAD,wBAAM,O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AOQ,CAAAA,OAAP,CACD,CAED,GAAMY,CAAAA,aAAa,CAAG,CACpBC,IAAI,CAAEd,4BAA4B,CAACc,aAAD,CADd,CAAtB,C,oCAIA,GAAMC,CAAAA,UAAU,CAAG,CACjBjB,QAAQ,CAAEX,wBAAwB,CAACW,QAAD,CADjB,CAEjBF,QAAQ,CAAET,wBAAwB,CAACS,QAAD,CAFjB,CAGjBN,EAAE,CAAEH,wBAAwB,CAACG,EAAD,CAHX,CAIjBK,GAAG,CAAER,wBAAwB,CAACQ,GAAD,CAJZ,CAKjBD,MAAM,CAAEP,wBAAwB,CAACO,MAAD,CALf,CAAnB,C","sourcesContent":["import React from 'react';\nimport { View, findNodeHandle } from 'react-native';\nimport ReanimatedModule from './ReanimatedModule';\n\nconst TransitioningContext = React.createContext();\n\nfunction configFromProps(type, props) {\n  const config = { type };\n  if ('durationMs' in props) {\n    config.durationMs = props.durationMs;\n  }\n  if ('interpolation' in props) {\n    config.interpolation = props.interpolation;\n  }\n  if ('type' in props) {\n    config.animation = props.type;\n  }\n  if ('delayMs' in props) {\n    config.delayMs = props.delayMs;\n  }\n  if ('propagation' in props) {\n    config.propagation = props.propagation;\n  }\n  return config;\n}\n\n/**\n * The below wrapper is used to support legacy context API with Context.Consumer\n * render prop. We need it as we want to access `context` from within\n * `componentDidMount` callback. If we decided to drop support for older\n * react native we could rewrite it using hooks or `static contextType` API.\n */\nfunction wrapTransitioningContext(Comp) {\n  return props => {\n    return (\n      <TransitioningContext.Consumer>\n        {context => <Comp context={context} {...props} />}\n      </TransitioningContext.Consumer>\n    );\n  };\n}\n\nclass In extends React.Component {\n  componentDidMount() {\n    this.props.context.push(configFromProps('in', this.props));\n  }\n  render() {\n    return this.props.children || null;\n  }\n}\n\nclass Change extends React.Component {\n  componentDidMount() {\n    this.props.context.push(configFromProps('change', this.props));\n  }\n  render() {\n    return this.props.children || null;\n  }\n}\n\nclass Out extends React.Component {\n  componentDidMount() {\n    this.props.context.push(configFromProps('out', this.props));\n  }\n  render() {\n    return this.props.children || null;\n  }\n}\n\nclass Together extends React.Component {\n  transitions = [];\n  componentDidMount() {\n    const config = configFromProps('group', this.props);\n    config.transitions = this.transitions;\n    this.props.context.push(config);\n  }\n  render() {\n    return (\n      <TransitioningContext.Provider value={this.transitions}>\n        {this.props.children}\n      </TransitioningContext.Provider>\n    );\n  }\n}\n\nclass Sequence extends React.Component {\n  transitions = [];\n  componentDidMount() {\n    const config = configFromProps('group', this.props);\n    config.sequence = true;\n    config.transitions = this.transitions;\n    this.props.context.push(config);\n  }\n  render() {\n    return (\n      <TransitioningContext.Provider value={this.transitions}>\n        {this.props.children}\n      </TransitioningContext.Provider>\n    );\n  }\n}\n\nfunction createTransitioningComponent(Component) {\n  class Wrapped extends React.Component {\n    propTypes = Component.propTypes;\n    transitions = [];\n    viewRef = React.createRef();\n\n    componentDidMount() {\n      if (this.props.animateMount) {\n        this.animateNextTransition();\n      }\n    }\n\n    setNativeProps(props) {\n      this.viewRef.current.setNativeProps(props);\n    }\n\n    animateNextTransition() {\n      const viewTag = findNodeHandle(this.viewRef.current);\n      ReanimatedModule.animateNextTransition(viewTag, {\n        transitions: this.transitions,\n      });\n    }\n\n    render() {\n      const { transition, ...rest } = this.props;\n      return (\n        <React.Fragment>\n          <TransitioningContext.Provider value={this.transitions}>\n            {transition}\n          </TransitioningContext.Provider>\n          <Component {...rest} ref={this.viewRef} collapsable={false} />\n        </React.Fragment>\n      );\n    }\n  }\n  return Wrapped;\n}\n\nconst Transitioning = {\n  View: createTransitioningComponent(View),\n};\n\nconst Transition = {\n  Sequence: wrapTransitioningContext(Sequence),\n  Together: wrapTransitioningContext(Together),\n  In: wrapTransitioningContext(In),\n  Out: wrapTransitioningContext(Out),\n  Change: wrapTransitioningContext(Change),\n};\n\nexport { Transitioning, Transition, createTransitioningComponent };\n"]},"metadata":{},"sourceType":"script"}