From fe0b480ca28903384cb25b4caf06b984204345c5 Mon Sep 17 00:00:00 2001 From: choozn Date: Sat, 7 May 2022 00:54:13 -0700 Subject: [PATCH] Upgrade to custom react-motion to support React 18.x https://github.com/choozn/react-parallax-mouse/issues/23 https://github.com/choozn/react-parallax-mouse/issues/7 --- package.json | 3 +-- src/Child.tsx | 16 ++++++++-------- src/Container.tsx | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index a04aa48..d3f4f28 100644 --- a/package.json +++ b/package.json @@ -23,8 +23,7 @@ "dependencies": { "@types/react": "^17.0.34", "@types/react-dom": "^17.0.11", - "@types/react-motion": "^0.0.32", - "react-motion": "^0.5.2" + "react-motion-prefixed": "^0.6.4" }, "devDependencies": { "babel-core": "^6.26.3", diff --git a/src/Child.tsx b/src/Child.tsx index 4c20706..6826fa9 100644 --- a/src/Child.tsx +++ b/src/Child.tsx @@ -1,15 +1,15 @@ import React from 'react'; -import { SpringHelperConfig } from 'react-motion'; +import { SpringHelperConfig } from 'react-motion-prefixed'; import { Middleware } from './interfaces'; interface Props { - factorX?: number; - factorY?: number; - springConfig?: SpringHelperConfig; - children?: JSX.Element | JSX.Element[]; - className?: string; - updateStyles?: Middleware | React.CSSProperties; - inverted?: boolean; + factorX?: number; + factorY?: number; + springConfig?: SpringHelperConfig; + children?: JSX.Element | JSX.Element[]; + className?: string; + updateStyles?: Middleware | React.CSSProperties; + inverted?: boolean; } const MouseParallaxChild = ({ children }: Props) => <> {children} ; diff --git a/src/Container.tsx b/src/Container.tsx index b1f75a3..d88a0f0 100644 --- a/src/Container.tsx +++ b/src/Container.tsx @@ -1,5 +1,5 @@ import React, { useCallback, useEffect, useState } from 'react'; -import { Motion, spring } from 'react-motion'; +import { Motion, spring } from 'react-motion-prefixed'; interface Props { children: JSX.Element[] | JSX.Element;