@seed-design/stackflow 1.0.5 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,6 +24,11 @@ function useSwipeBack(props) {
24
24
  if (e.target === e.currentTarget) {
25
25
  events.reset();
26
26
  }
27
+ },
28
+ onTransitionEnd: (e) => {
29
+ if (e.target === e.currentTarget) {
30
+ events.reset();
31
+ }
27
32
  }
28
33
  },
29
34
  edgeProps: {
@@ -20,6 +20,11 @@ function useSwipeBack(props) {
20
20
  if (e.target === e.currentTarget) {
21
21
  events.reset();
22
22
  }
23
+ },
24
+ onTransitionEnd: (e) => {
25
+ if (e.target === e.currentTarget) {
26
+ events.reset();
27
+ }
23
28
  }
24
29
  },
25
30
  edgeProps: {
@@ -18,7 +18,7 @@ function useTopActivity() {
18
18
  const transitionState = topActivity?.transitionState ?? "enter-done";
19
19
  const [topEl, setTopEl] = React.useState(null);
20
20
  const activityType = topEl?.dataset["activityType"];
21
- React.useEffect(() => {
21
+ React.useLayoutEffect(() => {
22
22
  if (!topId) return;
23
23
  const el = document.querySelector(`[data-activity-id="${topId}"]`);
24
24
  setTopEl(el);
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { useStack } from '@stackflow/react';
3
- import { useState, useEffect } from 'react';
3
+ import { useState, useLayoutEffect } from 'react';
4
4
 
5
5
  function useTopActivity() {
6
6
  const stack = useStack();
@@ -14,7 +14,7 @@ function useTopActivity() {
14
14
  const transitionState = topActivity?.transitionState ?? "enter-done";
15
15
  const [topEl, setTopEl] = useState(null);
16
16
  const activityType = topEl?.dataset["activityType"];
17
- useEffect(() => {
17
+ useLayoutEffect(() => {
18
18
  if (!topId) return;
19
19
  const el = document.querySelector(`[data-activity-id="${topId}"]`);
20
20
  setTopEl(el);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seed-design/stackflow",
3
- "version": "1.0.5",
3
+ "version": "1.0.9",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/daangn/seed-design.git",
@@ -35,7 +35,7 @@
35
35
  "clsx": "^2.1.1"
36
36
  },
37
37
  "devDependencies": {
38
- "@seed-design/css": "1.0.5",
38
+ "@seed-design/css": "1.0.7",
39
39
  "@stackflow/core": "^1.2.0",
40
40
  "@stackflow/react": "^1.5.1",
41
41
  "@stackflow/react-ui-core": "^1.3.2",
@@ -49,7 +49,7 @@
49
49
  "vite-plugin-dts": "^4.5.3"
50
50
  },
51
51
  "peerDependencies": {
52
- "@seed-design/css": ">=1.0.5",
52
+ "@seed-design/css": ">=1.0.7",
53
53
  "@stackflow/core": ">=1.1.0",
54
54
  "@stackflow/react": ">=1.4.1",
55
55
  "@stackflow/react-ui-core": ">=1.3.2",
@@ -25,6 +25,11 @@ export function useSwipeBack(props: UseSwipeBackProps) {
25
25
  events.reset();
26
26
  }
27
27
  },
28
+ onTransitionEnd: (e) => {
29
+ if (e.target === e.currentTarget) {
30
+ events.reset();
31
+ }
32
+ },
28
33
  } as React.HTMLAttributes<HTMLDivElement>,
29
34
  edgeProps: {
30
35
  tabIndex: -1,
@@ -1,5 +1,5 @@
1
1
  import { useStack } from "@stackflow/react";
2
- import { useEffect, useState } from "react";
2
+ import { useLayoutEffect, useState } from "react";
3
3
 
4
4
  export function useTopActivity() {
5
5
  const stack = useStack();
@@ -17,7 +17,7 @@ export function useTopActivity() {
17
17
  const [topEl, setTopEl] = useState<HTMLElement | null>(null);
18
18
  const activityType = topEl?.dataset["activityType"];
19
19
 
20
- useEffect(() => {
20
+ useLayoutEffect(() => {
21
21
  if (!topId) return;
22
22
 
23
23
  const el = document.querySelector<HTMLElement>(`[data-activity-id="${topId}"]`);