@vetc-miniapp/ui-react 0.0.7 → 0.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.
package/package.json
CHANGED
|
@@ -27,17 +27,16 @@ export function App({ config, children }) {
|
|
|
27
27
|
const [page, setPage] = useState(null);
|
|
28
28
|
|
|
29
29
|
useEffect(() => {
|
|
30
|
-
console.warn("SDK useEffect fired");
|
|
31
30
|
|
|
32
31
|
if (!config?.pages?.length) return;
|
|
33
32
|
|
|
34
33
|
// 1. Init router từ config
|
|
35
34
|
initRouter(config);
|
|
36
|
-
console.warn(config);
|
|
37
35
|
|
|
38
36
|
// 2. Lấy pathname từ URL WebView
|
|
39
37
|
const rawPath = window.location.path || "/";
|
|
40
38
|
const path = rawPath.replace("/miniapp", "") || "/";
|
|
39
|
+
console.log(rawPath);
|
|
41
40
|
|
|
42
41
|
setCurrentPath(path);
|
|
43
42
|
|
|
@@ -52,17 +51,18 @@ export function App({ config, children }) {
|
|
|
52
51
|
}
|
|
53
52
|
|
|
54
53
|
setPage(current);
|
|
55
|
-
|
|
56
54
|
// 5. Gửi config sang Flutter để dựng native header
|
|
57
55
|
callHost("registerAppConfig", { config });
|
|
58
56
|
}, [config]);
|
|
59
57
|
|
|
60
|
-
console.warn("SDK fired");
|
|
61
58
|
|
|
62
|
-
// Tránh crash nếu chưa có page
|
|
63
59
|
if (!page || !page.Component) {
|
|
64
60
|
console.warn("MiniApp: Page not found for current route");
|
|
65
|
-
|
|
61
|
+
return (
|
|
62
|
+
<>
|
|
63
|
+
<div></div>
|
|
64
|
+
</>
|
|
65
|
+
);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
const Component = page.Component || <div />;
|