@react-spring/parallax
Advanced tools
Comparing version 9.0.0-rc.1 to 9.0.0-rc.2
@@ -1,2 +0,2 @@ | ||
import React, { CSSProperties } from 'react'; | ||
import { MemoExoticComponent, ForwardRefExoticComponent, RefAttributes, CSSProperties, ComponentPropsWithoutRef } from 'react'; | ||
import { Controller, SpringConfig } from '@react-spring/web/index.cjs.js'; | ||
@@ -22,3 +22,3 @@ | ||
} | ||
declare type ViewProps = React.ComponentPropsWithoutRef<'div'>; | ||
declare type ViewProps = ComponentPropsWithoutRef<'div'>; | ||
interface ParallaxLayerProps extends ViewProps { | ||
@@ -33,3 +33,3 @@ horizontal?: boolean; | ||
} | ||
declare const ParallaxLayer: React.MemoExoticComponent<React.ForwardRefExoticComponent<ParallaxLayerProps & React.RefAttributes<IParallaxLayer>>>; | ||
declare const ParallaxLayer: MemoExoticComponent<ForwardRefExoticComponent<ParallaxLayerProps & RefAttributes<IParallaxLayer>>>; | ||
declare type ConfigProp = SpringConfig | ((key: string) => SpringConfig); | ||
@@ -44,4 +44,4 @@ interface ParallaxProps extends ViewProps { | ||
} | ||
declare const Parallax: React.MemoExoticComponent<React.ForwardRefExoticComponent<ParallaxProps & React.RefAttributes<IParallax>>>; | ||
declare const Parallax: MemoExoticComponent<ForwardRefExoticComponent<ParallaxProps & RefAttributes<IParallax>>>; | ||
export { IParallax, IParallaxLayer, Parallax, ParallaxLayer, ParallaxLayerProps, ParallaxProps }; |
@@ -10,3 +10,2 @@ 'use strict'; | ||
var React = require('react'); | ||
var React__default = _interopDefault(React); | ||
var web = require('@react-spring/web/index.cjs.js'); | ||
@@ -17,3 +16,3 @@ var useMemoOne = require('use-memo-one'); | ||
var ParentContext = React__default.createContext(null); | ||
var ParentContext = React.createContext(null); | ||
@@ -26,3 +25,3 @@ function getScrollType(horizontal) { | ||
var START_TRANSLATE = 'translate(0px,0px)'; | ||
var ParallaxLayer = React__default.memo(React__default.forwardRef(function (_ref, ref) { | ||
var ParallaxLayer = React.memo(React.forwardRef(function (_ref, ref) { | ||
var _extends2; | ||
@@ -79,3 +78,3 @@ | ||
}, []); | ||
React__default.useImperativeHandle(ref, function () { | ||
React.useImperativeHandle(ref, function () { | ||
return layer; | ||
@@ -99,3 +98,3 @@ }); // Register the layer with our parent. | ||
}); | ||
return /*#__PURE__*/React__default.createElement(web.a.div, _extends({}, rest, { | ||
return /*#__PURE__*/React.createElement(web.a.div, _extends({}, rest, { | ||
style: _extends((_extends2 = { | ||
@@ -109,3 +108,3 @@ position: 'absolute', | ||
})); | ||
var Parallax = React__default.memo(React__default.forwardRef(function (props, ref) { | ||
var Parallax = React.memo(React.forwardRef(function (props, ref) { | ||
var _extends3; | ||
@@ -172,3 +171,3 @@ | ||
}, [config]); | ||
React__default.useImperativeHandle(ref, function () { | ||
React.useImperativeHandle(ref, function () { | ||
return state; | ||
@@ -253,3 +252,3 @@ }); | ||
var overflow = enabled ? 'scroll' : 'hidden'; | ||
return /*#__PURE__*/React__default.createElement(web.a.div, _extends({}, rest, { | ||
return /*#__PURE__*/React.createElement(web.a.div, _extends({}, rest, { | ||
ref: containerRef, | ||
@@ -271,3 +270,3 @@ onScroll: onScroll, | ||
}, rest.style) | ||
}), ready && /*#__PURE__*/React__default.createElement(web.a.div, { | ||
}), ready && /*#__PURE__*/React.createElement(web.a.div, { | ||
ref: contentRef, | ||
@@ -278,3 +277,3 @@ style: _extends((_extends3 = { | ||
}, _extends3[horizontal ? 'height' : 'width'] = '100%', _extends3[horizontal ? 'width' : 'height'] = state.space * pages, _extends3.WebkitTransform = START_TRANSLATE, _extends3.msTransform = START_TRANSLATE, _extends3.transform = START_TRANSLATE_3D, _extends3), props.innerStyle) | ||
}, /*#__PURE__*/React__default.createElement(ParentContext.Provider, { | ||
}, /*#__PURE__*/React.createElement(ParentContext.Provider, { | ||
value: state | ||
@@ -281,0 +280,0 @@ }, rest.children))); |
@@ -1,2 +0,2 @@ | ||
import React, { CSSProperties } from 'react'; | ||
import { MemoExoticComponent, ForwardRefExoticComponent, RefAttributes, CSSProperties, ComponentPropsWithoutRef } from 'react'; | ||
import { Controller, SpringConfig } from '@react-spring/web'; | ||
@@ -22,3 +22,3 @@ | ||
} | ||
declare type ViewProps = React.ComponentPropsWithoutRef<'div'>; | ||
declare type ViewProps = ComponentPropsWithoutRef<'div'>; | ||
interface ParallaxLayerProps extends ViewProps { | ||
@@ -33,3 +33,3 @@ horizontal?: boolean; | ||
} | ||
declare const ParallaxLayer: React.MemoExoticComponent<React.ForwardRefExoticComponent<ParallaxLayerProps & React.RefAttributes<IParallaxLayer>>>; | ||
declare const ParallaxLayer: MemoExoticComponent<ForwardRefExoticComponent<ParallaxLayerProps & RefAttributes<IParallaxLayer>>>; | ||
declare type ConfigProp = SpringConfig | ((key: string) => SpringConfig); | ||
@@ -44,4 +44,4 @@ interface ParallaxProps extends ViewProps { | ||
} | ||
declare const Parallax: React.MemoExoticComponent<React.ForwardRefExoticComponent<ParallaxProps & React.RefAttributes<IParallax>>>; | ||
declare const Parallax: MemoExoticComponent<ForwardRefExoticComponent<ParallaxProps & RefAttributes<IParallax>>>; | ||
export { IParallax, IParallaxLayer, Parallax, ParallaxLayer, ParallaxLayerProps, ParallaxProps }; |
20
index.js
import _extends from '@babel/runtime/helpers/esm/extends'; | ||
import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/esm/objectWithoutPropertiesLoose'; | ||
import React, { useContext, useState, useEffect, useRef } from 'react'; | ||
import { createContext, memo, forwardRef, useContext, useImperativeHandle, createElement, useState, useEffect, useRef } from 'react'; | ||
import { Controller, a, config } from '@react-spring/web'; | ||
@@ -9,3 +9,3 @@ import { useMemoOne } from 'use-memo-one'; | ||
const ParentContext = React.createContext(null); | ||
const ParentContext = createContext(null); | ||
@@ -18,3 +18,3 @@ function getScrollType(horizontal) { | ||
const START_TRANSLATE = 'translate(0px,0px)'; | ||
const ParallaxLayer = React.memo(React.forwardRef((_ref, ref) => { | ||
const ParallaxLayer = memo(forwardRef((_ref, ref) => { | ||
let { | ||
@@ -60,3 +60,3 @@ horizontal, | ||
}), []); | ||
React.useImperativeHandle(ref, () => layer); // Register the layer with our parent. | ||
useImperativeHandle(ref, () => layer); // Register the layer with our parent. | ||
@@ -74,3 +74,3 @@ useOnce(() => { | ||
const translate3d = ctrl.springs.translate.to(horizontal ? x => "translate3d(" + x + "px,0,0)" : y => "translate3d(0," + y + "px,0)"); | ||
return /*#__PURE__*/React.createElement(a.div, _extends({}, rest, { | ||
return /*#__PURE__*/createElement(a.div, _extends({}, rest, { | ||
style: _extends({ | ||
@@ -89,3 +89,3 @@ position: 'absolute', | ||
})); | ||
const Parallax = React.memo(React.forwardRef((props, ref) => { | ||
const Parallax = memo(forwardRef((props, ref) => { | ||
const [ready, setReady] = useState(false); | ||
@@ -138,3 +138,3 @@ | ||
}, [config$1]); | ||
React.useImperativeHandle(ref, () => state); | ||
useImperativeHandle(ref, () => state); | ||
const containerRef = useRef(); | ||
@@ -212,3 +212,3 @@ const contentRef = useRef(); | ||
const overflow = enabled ? 'scroll' : 'hidden'; | ||
return /*#__PURE__*/React.createElement(a.div, _extends({}, rest, { | ||
return /*#__PURE__*/createElement(a.div, _extends({}, rest, { | ||
ref: containerRef, | ||
@@ -230,3 +230,3 @@ onScroll: onScroll, | ||
}, rest.style) | ||
}), ready && /*#__PURE__*/React.createElement(a.div, { | ||
}), ready && /*#__PURE__*/createElement(a.div, { | ||
ref: contentRef, | ||
@@ -242,3 +242,3 @@ style: _extends({ | ||
}, props.innerStyle) | ||
}, /*#__PURE__*/React.createElement(ParentContext.Provider, { | ||
}, /*#__PURE__*/createElement(ParentContext.Provider, { | ||
value: state | ||
@@ -245,0 +245,0 @@ }, rest.children))); |
{ | ||
"name": "@react-spring/parallax", | ||
"version": "9.0.0-rc.1", | ||
"version": "9.0.0-rc.2", | ||
"description": "Cross-platform animation engine for React", | ||
@@ -31,4 +31,4 @@ "keywords": [ | ||
"@babel/runtime": "^7.3.1", | ||
"@react-spring/shared": "^9.0.0-rc.1", | ||
"@react-spring/web": "^9.0.0-rc.1", | ||
"@react-spring/shared": "9.0.0-rc.2", | ||
"@react-spring/web": "9.0.0-rc.2", | ||
"use-memo-one": "^1.1.0" | ||
@@ -35,0 +35,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
48182
796
+ Added@alloc/types@1.3.0(transitive)
+ Added@react-spring/animated@9.0.0-rc.2(transitive)
+ Added@react-spring/core@9.0.0-rc.2(transitive)
+ Added@react-spring/shared@9.0.0-rc.2(transitive)
+ Added@react-spring/web@9.0.0-rc.2(transitive)
+ Addedfluids@0.1.10(transitive)
+ Addedreact-dom@19.0.0(transitive)
+ Addedreact-layout-effect@1.0.5(transitive)
+ Addedscheduler@0.25.0(transitive)
+ Addedtslib@1.14.1(transitive)
- Removed@react-spring/animated@9.7.5(transitive)
- Removed@react-spring/core@9.7.5(transitive)
- Removed@react-spring/rafz@9.7.5(transitive)
- Removed@react-spring/shared@9.7.5(transitive)
- Removed@react-spring/types@9.7.5(transitive)
- Removed@react-spring/web@9.7.5(transitive)
- Removedreact-dom@18.3.1(transitive)
- Removedscheduler@0.23.2(transitive)
Updated@react-spring/web@9.0.0-rc.2