@coze-arch/cli 0.0.12 → 0.0.13
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.
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useEffect, ReactNode } from 'react';
|
|
2
|
+
import { Platform } from 'react-native';
|
|
3
|
+
|
|
4
|
+
const STYLE_ID = 'coze-pretty-scrollbar';
|
|
5
|
+
|
|
6
|
+
function WebOnlyPrettyScrollbar({ children }: { children: ReactNode }) {
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (Platform.OS === 'web') {
|
|
9
|
+
let style = document.getElementById(STYLE_ID);
|
|
10
|
+
if (!style) {
|
|
11
|
+
style = document.createElement('style');
|
|
12
|
+
style.id = STYLE_ID;
|
|
13
|
+
style.textContent = `
|
|
14
|
+
::-webkit-scrollbar {
|
|
15
|
+
width: 4px;
|
|
16
|
+
height: 4px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
::-webkit-scrollbar-track {
|
|
20
|
+
background: transparent;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
::-webkit-scrollbar-thumb {
|
|
24
|
+
background: rgba(0, 0, 0, 0.2);
|
|
25
|
+
border-radius: 2px;
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
document.head.appendChild(style);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return () => {
|
|
32
|
+
const existingStyle = document.getElementById(STYLE_ID);
|
|
33
|
+
if (existingStyle) {
|
|
34
|
+
existingStyle.remove();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}, []);
|
|
39
|
+
|
|
40
|
+
return <>{children}</>
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { WebOnlyPrettyScrollbar }
|
|
@@ -2,17 +2,20 @@ import { AuthProvider } from '@/contexts/AuthContext';
|
|
|
2
2
|
import { type ReactNode } from 'react';
|
|
3
3
|
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
4
4
|
import { WebOnlyColorSchemeUpdater } from './ColorSchemeUpdater';
|
|
5
|
+
import { WebOnlyPrettyScrollbar } from './PrettyScrollbar'
|
|
5
6
|
import { HeroUINativeProvider } from '@/heroui';
|
|
6
7
|
|
|
7
8
|
function Provider({ children }: { children: ReactNode }) {
|
|
8
9
|
return <WebOnlyColorSchemeUpdater>
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
<WebOnlyPrettyScrollbar>
|
|
11
|
+
<AuthProvider>
|
|
12
|
+
<GestureHandlerRootView style={{ flex: 1 }}>
|
|
13
|
+
<HeroUINativeProvider>
|
|
14
|
+
{children}
|
|
15
|
+
</HeroUINativeProvider>
|
|
16
|
+
</GestureHandlerRootView>
|
|
17
|
+
</AuthProvider>
|
|
18
|
+
</WebOnlyPrettyScrollbar>
|
|
16
19
|
</WebOnlyColorSchemeUpdater>
|
|
17
20
|
}
|
|
18
21
|
|