Skip to content

Commit

Permalink
fix: react 17 Timeline target
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Fischer committed Apr 8, 2021
1 parent b2d2666 commit dc503e4
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 10 deletions.
Empty file added .eslintrc
Empty file.
2 changes: 1 addition & 1 deletion packages/docz/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"gsap": "^3.2.6",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-gsap": "3.2.0"
"react-gsap": "3.2.1"
},
"devDependencies": {
"@types/react": "^16.8.23",
Expand Down
2 changes: 1 addition & 1 deletion packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"next": "^9.5.1",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-gsap": "3.2.0"
"react-gsap": "3.2.1"
},
"devDependencies": {
"@types/node": "^14.14.22",
Expand Down
2 changes: 1 addition & 1 deletion packages/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"gsap": "^3.2.6",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-gsap": "3.2.0",
"react-gsap": "3.2.1",
"react-router-dom": "^5.1.2",
"react-scripts": "4.0.1",
"react-transition-group": "^4.3.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/playground/src/examples/Transition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ const TransitionItem = ({
paused={true}
playState={
state === 'entering'
? PlayState.reverse
? PlayState.restartReverse
: state === 'exiting'
? PlayState.play
? PlayState.restart
: undefined
}
ease="Back.easeInOut"
Expand Down
2 changes: 1 addition & 1 deletion packages/react-gsap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-gsap",
"version": "3.2.0",
"version": "3.2.1",
"description": "React components for GSAP",
"author": "bitworking",
"license": "MIT",
Expand Down
4 changes: 3 additions & 1 deletion packages/react-gsap/src/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ function isDOMTypeElement(element: any) {

// https://stackoverflow.com/a/39165137
function getReactNode(dom: any, traverseUp = 0) {
const key = Object.keys(dom ?? {}).find(key => key.startsWith('__reactInternalInstance$'));
const key = Object.keys(dom ?? {}).find(
key => key.startsWith('__reactInternalInstance$') || key.startsWith('__reactFiber$')
);

const domFiber = key && dom[key];
if (!domFiber) return null;
Expand Down
6 changes: 3 additions & 3 deletions packages/react-gsap/src/tools/Scroller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,12 @@ class Scroller extends Provider<ScrollerProps, ScrollerState> {

let progress = 0;

if (triggerPosition == TriggerPosition.top) {
if (triggerPosition === TriggerPosition.top) {
const height = entry.boundingClientRect.height;
const top = entry.boundingClientRect.top;
const position = top <= 0 ? -top : 0;
progress = position / height;
} else if (triggerPosition == TriggerPosition.bottom) {
} else if (triggerPosition === TriggerPosition.bottom) {
const height = entry.boundingClientRect.height;
const position = height - Math.max(Math.min(entry.boundingClientRect.top, height), 0);
progress = position / height;
Expand Down Expand Up @@ -168,7 +168,7 @@ class Scroller extends Provider<ScrollerProps, ScrollerState> {
};

getTotalProgress(progresses: number[]) {
const length = progresses.length;
// const length = progresses.length;
return progresses.reduceRight((previousValue, currentValue) => {
if (previousValue) {
return Math.min(currentValue || 1, 1) + previousValue;
Expand Down

0 comments on commit dc503e4

Please sign in to comment.