@ahnseungchan/webviewkit 1.0.7 → 1.0.8

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.
@@ -13,31 +13,21 @@ export const useStackRouter = () => {
13
13
  return context;
14
14
  };
15
15
  const StackRouter = ({ maxWidth = "600px", Activities = [], initialActivity, ActivitysLayout, }) => {
16
- // 실제 URL과 동기화된 초기 경로 설정
17
- const getInitialPath = () => {
18
- const currentUrlPath = window.location.pathname;
19
- // Activities에서 현재 URL에 해당하는 액티비티가 있는지 확인
20
- const matchingActivity = Activities.find((a) => a.path === currentUrlPath);
21
- return matchingActivity ? currentUrlPath : initialActivity.path;
22
- };
23
- const [currentPath, setCurrentPath] = useState(getInitialPath());
16
+ const [currentPath, setCurrentPath] = useState(history.getCurrentState().path);
24
17
  const [currentState, setCurrentState] = useState(history.getCurrentState());
25
18
  const [isTransitioning, setIsTransitioning] = useState(false);
26
19
  const [direction, setDirection] = useState(Direction.FORWARD);
27
20
  const [visiblePages, setVisiblePages] = useState([]);
28
- // 초기 페이지 설정 - 실제 URL 기반으로 동기화
21
+ // initialize visible pages
29
22
  useEffect(() => {
30
- const initialPath = getInitialPath();
31
- const initialActivityForPath = Activities.find((a) => a.path === initialPath) || initialActivity;
32
23
  setVisiblePages([
33
24
  {
34
- path: initialPath,
35
- element: initialActivityForPath.element,
25
+ path: initialActivity.path,
26
+ element: initialActivity.element,
36
27
  isEntering: true,
37
28
  },
38
29
  ]);
39
- setCurrentPath(initialPath);
40
- }, [initialActivity, Activities]);
30
+ }, [initialActivity]);
41
31
  // listen to history changes
42
32
  useEffect(() => {
43
33
  const removeListener = history.addListener((state) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahnseungchan/webviewkit",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Core WebView functionality for stack-based navigation",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",