@0610studio/zs-ui 0.5.2 → 0.5.3
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/build/ui/ZSContainer/index.d.ts +0 -4
- package/build/ui/ZSContainer/index.d.ts.map +1 -1
- package/build/ui/ZSContainer/index.js +20 -10
- package/build/ui/ZSContainer/index.js.map +1 -1
- package/build/ui/ZSContainer/ui/VariantView.d.ts +2 -1
- package/build/ui/ZSContainer/ui/VariantView.d.ts.map +1 -1
- package/build/ui/ZSContainer/ui/VariantView.js +2 -2
- package/build/ui/ZSContainer/ui/VariantView.js.map +1 -1
- package/package.json +30 -4
|
@@ -12,8 +12,6 @@ export type ZSContainerProps = ViewProps & {
|
|
|
12
12
|
rightComponent?: ReactNode;
|
|
13
13
|
showsVerticalScrollIndicator?: boolean;
|
|
14
14
|
loadingComponent?: React.ReactNode;
|
|
15
|
-
keyboardVerticalOffset?: number;
|
|
16
|
-
behavior?: 'padding' | 'height' | 'position';
|
|
17
15
|
automaticallyAdjustKeyboardInsets?: boolean;
|
|
18
16
|
keyboardScrollExtraOffset?: number;
|
|
19
17
|
translucent?: boolean;
|
|
@@ -33,8 +31,6 @@ declare const ZSContainer: React.ForwardRefExoticComponent<ViewProps & {
|
|
|
33
31
|
rightComponent?: ReactNode;
|
|
34
32
|
showsVerticalScrollIndicator?: boolean;
|
|
35
33
|
loadingComponent?: React.ReactNode;
|
|
36
|
-
keyboardVerticalOffset?: number;
|
|
37
|
-
behavior?: "padding" | "height" | "position";
|
|
38
34
|
automaticallyAdjustKeyboardInsets?: boolean;
|
|
39
35
|
keyboardScrollExtraOffset?: number;
|
|
40
36
|
translucent?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/ZSContainer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAgE,MAAM,OAAO,CAAC;AACvG,OAA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AAM,CAAC;yBAC7B,OAAO;mBACb,SAAS;sBACN,SAAS;qBACV,SAAS;mCACK,OAAO;uBACnB,KAAK,CAAC,SAAS;wCACE,OAAO;gCACf,MAAM;kBACpB,OAAO;eACV,CAAC,KAAK,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,KAAK,IAAI;0BAC7C,MAAM;oCAiK5B,CAAC;AAEH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;CAcjB,CAAC;AAEH,eAAe,WAAW,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { useState, useEffect, useImperativeHandle, forwardRef, useRef } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { StatusBar, StyleSheet, ActivityIndicator, Keyboard, View, Platform } from 'react-native';
|
|
3
3
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
4
4
|
import { useTheme } from '../../model/useThemeProvider';
|
|
5
5
|
import VariantView from './ui/VariantView';
|
|
6
|
-
const ZSContainer = forwardRef(function ZSContainer({ backgroundColor, isLoader = false, statusBarColor, barStyle, edges = ['top', 'bottom'], scrollViewDisabled = false, topComponent, bottomComponent, rightComponent, showsVerticalScrollIndicator = true, loadingComponent = <ActivityIndicator />,
|
|
6
|
+
const ZSContainer = forwardRef(function ZSContainer({ backgroundColor, isLoader = false, statusBarColor, barStyle, edges = ['top', 'bottom'], scrollViewDisabled = false, topComponent, bottomComponent, rightComponent, showsVerticalScrollIndicator = true, loadingComponent = <ActivityIndicator />, automaticallyAdjustKeyboardInsets = true, keyboardScrollExtraOffset, translucent, scrollEventThrottle = 100, ...props }, forwardedRef) {
|
|
7
7
|
const { palette, splitBreakpoint, splitRatio, dimensions: { height: windowHeight, width: windowWidth }, isSplitView } = useTheme();
|
|
8
8
|
const [isDelayed, setIsDelayed] = useState(true);
|
|
9
|
+
const [keyboardHeight, setKeyboardHeight] = useState(0);
|
|
9
10
|
const positionRef = useRef(0);
|
|
10
11
|
const scrollViewRef = useRef(null);
|
|
11
12
|
const lastTouchY = useRef(0);
|
|
@@ -18,7 +19,10 @@ const ZSContainer = forwardRef(function ZSContainer({ backgroundColor, isLoader
|
|
|
18
19
|
return () => clearTimeout(timer);
|
|
19
20
|
}, []);
|
|
20
21
|
useEffect(() => {
|
|
21
|
-
const
|
|
22
|
+
const showEvent = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow';
|
|
23
|
+
const hideEvent = Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide';
|
|
24
|
+
const keyboardShowSubscription = Keyboard.addListener(showEvent, (e) => {
|
|
25
|
+
setKeyboardHeight(e.endCoordinates.height);
|
|
22
26
|
if (scrollViewRef.current && keyboardScrollExtraOffset) {
|
|
23
27
|
const screenHeight = windowHeight;
|
|
24
28
|
const keyboardHeight = e.endCoordinates.height;
|
|
@@ -28,16 +32,22 @@ const ZSContainer = forwardRef(function ZSContainer({ backgroundColor, isLoader
|
|
|
28
32
|
const currentScrollPosition = positionRef.current || 0;
|
|
29
33
|
const touchPosition = lastTouchY.current || 0;
|
|
30
34
|
const scrollOffset = touchPosition - availableScreenHeight + keyboardScrollExtraOffset;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
setTimeout(() => {
|
|
36
|
+
scrollViewRef.current?.scrollTo({
|
|
37
|
+
y: currentScrollPosition + scrollOffset,
|
|
38
|
+
animated: true,
|
|
39
|
+
});
|
|
40
|
+
}, 150);
|
|
35
41
|
}
|
|
36
42
|
});
|
|
43
|
+
const keyboardHideSubscription = Keyboard.addListener(hideEvent, () => {
|
|
44
|
+
setKeyboardHeight(0);
|
|
45
|
+
});
|
|
37
46
|
return () => {
|
|
38
47
|
positionRef.current = null;
|
|
39
48
|
lastTouchY.current = null;
|
|
40
49
|
keyboardShowSubscription.remove();
|
|
50
|
+
keyboardHideSubscription.remove();
|
|
41
51
|
};
|
|
42
52
|
}, [keyboardScrollExtraOffset]);
|
|
43
53
|
const handleScroll = (event) => {
|
|
@@ -58,7 +68,7 @@ const ZSContainer = forwardRef(function ZSContainer({ backgroundColor, isLoader
|
|
|
58
68
|
return (<View style={styles.splitContainer}>
|
|
59
69
|
|
|
60
70
|
{/* 메인 컴포넌트 */}
|
|
61
|
-
<VariantView style={props.style} children={props.children} scrollViewRef={scrollViewRef} variantWidth={leftWidth} showsVerticalScrollIndicator={showsVerticalScrollIndicator} automaticallyAdjustKeyboardInsets={automaticallyAdjustKeyboardInsets} scrollViewDisabled={scrollViewDisabled} scrollEventThrottle={scrollEventThrottle} handleScroll={handleScroll} handleTouch={handleTouch}/>
|
|
71
|
+
<VariantView style={props.style} children={props.children} scrollViewRef={scrollViewRef} variantWidth={leftWidth} showsVerticalScrollIndicator={showsVerticalScrollIndicator} automaticallyAdjustKeyboardInsets={automaticallyAdjustKeyboardInsets} scrollViewDisabled={scrollViewDisabled} scrollEventThrottle={scrollEventThrottle} handleScroll={handleScroll} handleTouch={handleTouch} keyboardHeight={keyboardHeight}/>
|
|
62
72
|
|
|
63
73
|
{/* 폴드/태블릿 화면 오른쪽 컴포넌트 */}
|
|
64
74
|
{rightComponent && splitEnabled && (<VariantView style={styles.splitView} children={rightComponent} variantWidth={rightWidth} showsVerticalScrollIndicator={showsVerticalScrollIndicator} automaticallyAdjustKeyboardInsets={automaticallyAdjustKeyboardInsets} scrollViewDisabled={false} scrollEventThrottle={scrollEventThrottle}/>)}
|
|
@@ -69,11 +79,11 @@ const ZSContainer = forwardRef(function ZSContainer({ backgroundColor, isLoader
|
|
|
69
79
|
styles.flex1,
|
|
70
80
|
{ width: '100%' },
|
|
71
81
|
]} edges={edges}>
|
|
72
|
-
{!isDelayed && (<
|
|
82
|
+
{!isDelayed && (<View style={[styles.flex1, { width: '100%' }]}>
|
|
73
83
|
{topComponent && topComponent}
|
|
74
84
|
{renderContent()}
|
|
75
85
|
{!isLoader && bottomComponent && bottomComponent}
|
|
76
|
-
</
|
|
86
|
+
</View>)}
|
|
77
87
|
|
|
78
88
|
{(barStyle || statusBarColor || translucent) && (<StatusBar barStyle={barStyle} backgroundColor={statusBarColor || palette.background.base} translucent={translucent}/>)}
|
|
79
89
|
</SafeAreaView>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/ZSContainer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,QAAQ,EAAE,SAAS,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACvG,OAAO,EAAa,oBAAoB,EAAE,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAuD,QAAQ,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAC;AAC9L,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAyB3C,MAAM,WAAW,GAAG,UAAU,CAAmC,SAAS,WAAW,CACnF,EACE,eAAe,EACf,QAAQ,GAAG,KAAK,EAChB,cAAc,EACd,QAAQ,EACR,KAAK,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,EACzB,kBAAkB,GAAG,KAAK,EAC1B,YAAY,EACZ,eAAe,EACf,cAAc,EACd,4BAA4B,GAAG,IAAI,EACnC,gBAAgB,GAAG,CAAC,iBAAiB,CAAC,AAAD,EAAG,EACxC,sBAAsB,EACtB,QAAQ,EACR,iCAAiC,GAAG,IAAI,EACxC,yBAAyB,EACzB,WAAW,EACX,mBAAmB,GAAG,GAAG,EACzB,GAAG,KAAK,EACT,EACD,YAAY;IAEZ,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,WAAW,EAAE,GAAG,QAAQ,EAAE,CAAC;IACnI,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,Q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QAAQ,CAAC,CACnB,sBAAsB,CAAC,CAAC,sBAAsB,CAAC,CAE/C;UAAA,CAAC,YAAY,IAAI,YAAY,CAC7B;UAAA,CAAC,aAAa,EAAE,CAChB;UAAA,CAAC,CAAC,QAAQ,IAAI,eAAe,IAAI,eAAe,CAClD;QAAA,EAAE,oBAAoB,CAAC,CACxB,CAED;;MAAA,CACE,CAAC,QAAQ,IAAI,cAAc,IAAI,WAAW,CAAC,IAAI,CAC7C,CAAC,SAAS,CACR,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACnB,eAAe,CAAC,CAAC,cAAc,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAC3D,WAAW,CAAC,CAAC,WAAW,CAAC,EACzB,CAEN,CACF;IAAA,EAAE,YAAY,CAAC,CAChB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IACtC,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;IAClB,oBAAoB,EAAE;QACpB,QAAQ,EAAE,CAAC;QACX,UAAU,EAAE,QAAQ;KACrB;IACD,cAAc,EAAE;QACd,IAAI,EAAE,CAAC;QACP,aAAa,EAAE,KAAK;QACpB,KAAK,EAAE,MAAM;KACd;IACD,SAAS,EAAE;QACT,SAAS,EAAE,MAAM;KAClB;CACF,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC","sourcesContent":["import React, { ReactNode, useState, useEffect, useImperativeHandle, forwardRef, useRef } from 'react';\r\nimport { ViewProps, KeyboardAvoidingView, StatusBar, StyleSheet, ActivityIndicator, ScrollView, NativeSyntheticEvent, NativeScrollEvent, Keyboard, View, DimensionValue } from 'react-native';\r\nimport { SafeAreaView } from 'react-native-safe-area-context';\r\nimport { useTheme } from '../../model/useThemeProvider';\r\nimport VariantView from './ui/VariantView';\r\n\r\nexport type ZSContainerProps = ViewProps & {\r\n backgroundColor?: string;\r\n isLoader?: boolean;\r\n statusBarColor?: string;\r\n barStyle?: 'light-content' | 'dark-content';\r\n edges?: Array<'top' | 'right' | 'bottom' | 'left'>;\r\n scrollViewDisabled?: boolean;\r\n topComponent?: ReactNode;\r\n bottomComponent?: ReactNode;\r\n rightComponent?: ReactNode;\r\n showsVerticalScrollIndicator?: boolean;\r\n loadingComponent?: React.ReactNode;\r\n keyboardVerticalOffset?: number;\r\n behavior?: 'padding' | 'height' | 'position';\r\n automaticallyAdjustKeyboardInsets?: boolean;\r\n keyboardScrollExtraOffset?: number;\r\n translucent?: boolean;\r\n onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;\r\n scrollEventThrottle?: number;\r\n};\r\n\r\nexport type ZSContainerRef = ScrollView;\r\n\r\nconst ZSContainer = forwardRef<ZSContainerRef, ZSContainerProps>(function ZSContainer(\r\n {\r\n backgroundColor,\r\n isLoader = false,\r\n statusBarColor,\r\n barStyle,\r\n edges = ['top', 'bottom'],\r\n scrollViewDisabled = false,\r\n topComponent,\r\n bottomComponent,\r\n rightComponent,\r\n showsVerticalScrollIndicator = true,\r\n loadingComponent = <ActivityIndicator />,\r\n keyboardVerticalOffset,\r\n behavior,\r\n automaticallyAdjustKeyboardInsets = true,\r\n keyboardScrollExtraOffset,\r\n translucent,\r\n scrollEventThrottle = 100,\r\n ...props\r\n },\r\n forwardedRef\r\n) {\r\n const { palette, splitBreakpoint, splitRatio, dimensions: { height: windowHeight, width: windowWidth }, isSplitView } = useTheme();\r\n const [isDelayed, setIsDelayed] = useState(true);\r\n const positionRef = useRef<number | null>(0);\r\n const scrollViewRef = useRef<ScrollView>(null);\r\n const lastTouchY = useRef<number | null>(0);\r\n const splitEnabled = !!(isSplitView && (windowWidth >= splitBreakpoint) && rightComponent);\r\n\r\n useImperativeHandle(forwardedRef, () => scrollViewRef.current as ScrollView, []);\r\n\r\n useEffect(() => {\r\n const timer = setTimeout(() => {\r\n setIsDelayed(false);\r\n }, 200);\r\n return () => clearTimeout(timer);\r\n }, []);\r\n\r\n useEffect(() => {\r\n const keyboardShowSubscription = Keyboard.addListener('keyboardDidShow', (e) => {\r\n if (scrollViewRef.current && keyboardScrollExtraOffset) {\r\n const screenHeight = windowHeight;\r\n const keyboardHeight = e.endCoordinates.height;\r\n const safeAreaBottom = 0;\r\n const availableScreenHeight = screenHeight - keyboardHeight - safeAreaBottom;\r\n\r\n // 현재 터치 위치와 스크롤 위치를 기반으로 새로운 스크롤 위치 계산\r\n const currentScrollPosition = positionRef.current || 0;\r\n const touchPosition = lastTouchY.current || 0;\r\n\r\n const scrollOffset = touchPosition - availableScreenHeight + keyboardScrollExtraOffset;\r\n scrollViewRef.current.scrollTo({\r\n y: currentScrollPosition + scrollOffset,\r\n animated: true,\r\n });\r\n }\r\n });\r\n\r\n return () => {\r\n positionRef.current = null;\r\n lastTouchY.current = null;\r\n keyboardShowSubscription.remove();\r\n };\r\n }, [keyboardScrollExtraOffset]);\r\n\r\n const handleScroll = (event: NativeSyntheticEvent<NativeScrollEvent>) => {\r\n if (props.onScroll) props.onScroll(event);\r\n if (keyboardScrollExtraOffset) positionRef.current = event.nativeEvent.contentOffset.y;\r\n };\r\n\r\n const handleTouch = (evt: any) => {\r\n if (keyboardScrollExtraOffset) lastTouchY.current = evt.nativeEvent.pageY;\r\n };\r\n\r\n const renderContent = () => {\r\n if (isLoader) return loadingComponent;\r\n\r\n const leftWidth = (splitEnabled ? `${splitRatio * 100}%` : '100%') as DimensionValue;\r\n const rightWidth = `${(1 - splitRatio) * 100}%` as DimensionValue;\r\n\r\n return (\r\n <View style={styles.splitContainer}>\r\n\r\n {/* 메인 컴포넌트 */}\r\n <VariantView\r\n style={props.style}\r\n children={props.children}\r\n scrollViewRef={scrollViewRef}\r\n variantWidth={leftWidth}\r\n showsVerticalScrollIndicator={showsVerticalScrollIndicator}\r\n automaticallyAdjustKeyboardInsets={automaticallyAdjustKeyboardInsets}\r\n scrollViewDisabled={scrollViewDisabled}\r\n scrollEventThrottle={scrollEventThrottle}\r\n handleScroll={handleScroll}\r\n handleTouch={handleTouch}\r\n />\r\n\r\n {/* 폴드/태블릿 화면 오른쪽 컴포넌트 */}\r\n {rightComponent && splitEnabled && (\r\n <VariantView\r\n style={styles.splitView}\r\n children={rightComponent}\r\n variantWidth={rightWidth}\r\n showsVerticalScrollIndicator={showsVerticalScrollIndicator}\r\n automaticallyAdjustKeyboardInsets={automaticallyAdjustKeyboardInsets}\r\n scrollViewDisabled={false}\r\n scrollEventThrottle={scrollEventThrottle}\r\n />\r\n )}\r\n </View>\r\n );\r\n };\r\n\r\n return (\r\n <SafeAreaView\r\n style={[\r\n { backgroundColor: backgroundColor || palette.background.base },\r\n styles.flex1,\r\n { width: '100%' },\r\n ]}\r\n edges={edges}\r\n >\r\n {!isDelayed && (\r\n <KeyboardAvoidingView\r\n style={[styles.flex1, { width: '100%' }]}\r\n behavior={behavior}\r\n keyboardVerticalOffset={keyboardVerticalOffset}\r\n >\r\n {topComponent && topComponent}\r\n {renderContent()}\r\n {!isLoader && bottomComponent && bottomComponent}\r\n </KeyboardAvoidingView>\r\n )}\r\n\r\n {\r\n (barStyle || statusBarColor || translucent) && (\r\n <StatusBar\r\n barStyle={barStyle}\r\n backgroundColor={statusBarColor || palette.background.base}\r\n translucent={translucent}\r\n />\r\n )\r\n }\r\n </SafeAreaView>\r\n );\r\n});\r\n\r\nexport const styles = StyleSheet.create({\r\n flex1: { flex: 1 },\r\n scrollContainerStyle: {\r\n flexGrow: 1,\r\n alignItems: 'center',\r\n },\r\n splitContainer: {\r\n flex: 1,\r\n flexDirection: 'row',\r\n width: '100%',\r\n },\r\n splitView: {\r\n minHeight: '100%',\r\n },\r\n});\r\n\r\nexport default ZSContainer;\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/ZSContainer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,QAAQ,EAAE,SAAS,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CA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AC,UAAU,CAAC,IAAI,EAAE;YAC/D,MAAM,CAAC,KAAK;YACZ,EAAE,KAAK,EAAE,MAAM,EAAE;SAClB,CAAC,CACF,KAAK,CAAC,CAAC,KAAK,CAAC,CAEb;MAAA,CAAC,CAAC,SAAS,IAAI,CACb,CAAC,IAAI,CACH,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAEzC;UAAA,CAAC,YAAY,IAAI,YAAY,CAC7B;UAAA,CAAC,aAAa,EAAE,CAChB;UAAA,CAAC,CAAC,QAAQ,IAAI,eAAe,IAAI,eAAe,CAClD;QAAA,EAAE,IAAI,CAAC,CACR,CAED;;MAAA,CACE,CAAC,QAAQ,IAAI,cAAc,IAAI,WAAW,CAAC,IAAI,CAC7C,CAAC,SAAS,CACR,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACnB,eAAe,CAAC,CAAC,cAAc,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAC3D,WAAW,CAAC,CAAC,WAAW,CAAC,EACzB,CAEN,CACF;IAAA,EAAE,YAAY,CAAC,CAChB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IACtC,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;IAClB,oBAAoB,EAAE;QACpB,QAAQ,EAAE,CAAC;QACX,UAAU,EAAE,QAAQ;KACrB;IACD,cAAc,EAAE;QACd,IAAI,EAAE,CAAC;QACP,aAAa,EAAE,KAAK;QACpB,KAAK,EAAE,MAAM;KACd;IACD,SAAS,EAAE;QACT,SAAS,EAAE,MAAM;KAClB;CACF,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC","sourcesContent":["import React, { ReactNode, useState, useEffect, useImperativeHandle, forwardRef, useRef } from 'react';\r\nimport { ViewProps, StatusBar, StyleSheet, ActivityIndicator, ScrollView, NativeSyntheticEvent, NativeScrollEvent, Keyboard, View, DimensionValue, Platform } from 'react-native';\r\nimport { SafeAreaView } from 'react-native-safe-area-context';\r\nimport { useTheme } from '../../model/useThemeProvider';\r\nimport VariantView from './ui/VariantView';\r\n\r\nexport type ZSContainerProps = ViewProps & {\r\n backgroundColor?: string;\r\n isLoader?: boolean;\r\n statusBarColor?: string;\r\n barStyle?: 'light-content' | 'dark-content';\r\n edges?: Array<'top' | 'right' | 'bottom' | 'left'>;\r\n scrollViewDisabled?: boolean;\r\n topComponent?: ReactNode;\r\n bottomComponent?: ReactNode;\r\n rightComponent?: ReactNode;\r\n showsVerticalScrollIndicator?: boolean;\r\n loadingComponent?: React.ReactNode;\r\n automaticallyAdjustKeyboardInsets?: boolean;\r\n keyboardScrollExtraOffset?: number;\r\n translucent?: boolean;\r\n onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;\r\n scrollEventThrottle?: number;\r\n};\r\n\r\nexport type ZSContainerRef = ScrollView;\r\n\r\nconst ZSContainer = forwardRef<ZSContainerRef, ZSContainerProps>(function ZSContainer(\r\n {\r\n backgroundColor,\r\n isLoader = false,\r\n statusBarColor,\r\n barStyle,\r\n edges = ['top', 'bottom'],\r\n scrollViewDisabled = false,\r\n topComponent,\r\n bottomComponent,\r\n rightComponent,\r\n showsVerticalScrollIndicator = true,\r\n loadingComponent = <ActivityIndicator />,\r\n automaticallyAdjustKeyboardInsets = true,\r\n keyboardScrollExtraOffset,\r\n translucent,\r\n scrollEventThrottle = 100,\r\n ...props\r\n },\r\n forwardedRef\r\n) {\r\n const { palette, splitBreakpoint, splitRatio, dimensions: { height: windowHeight, width: windowWidth }, isSplitView } = useTheme();\r\n const [isDelayed, setIsDelayed] = useState(true);\r\n const [keyboardHeight, setKeyboardHeight] = useState(0);\r\n const positionRef = useRef<number | null>(0);\r\n const scrollViewRef = useRef<ScrollView>(null);\r\n const lastTouchY = useRef<number | null>(0);\r\n const splitEnabled = !!(isSplitView && (windowWidth >= splitBreakpoint) && rightComponent);\r\n\r\n useImperativeHandle(forwardedRef, () => scrollViewRef.current as ScrollView, []);\r\n\r\n useEffect(() => {\r\n const timer = setTimeout(() => {\r\n setIsDelayed(false);\r\n }, 200);\r\n return () => clearTimeout(timer);\r\n }, []);\r\n\r\n\r\n useEffect(() => {\r\n const showEvent = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow';\r\n const hideEvent = Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide';\r\n\r\n const keyboardShowSubscription = Keyboard.addListener(showEvent, (e) => {\r\n setKeyboardHeight(e.endCoordinates.height);\r\n if (scrollViewRef.current && keyboardScrollExtraOffset) {\r\n const screenHeight = windowHeight;\r\n const keyboardHeight = e.endCoordinates.height;\r\n const safeAreaBottom = 0;\r\n const availableScreenHeight = screenHeight - keyboardHeight - safeAreaBottom;\r\n\r\n // 현재 터치 위치와 스크롤 위치를 기반으로 새로운 스크롤 위치 계산\r\n const currentScrollPosition = positionRef.current || 0;\r\n const touchPosition = lastTouchY.current || 0;\r\n const scrollOffset = touchPosition - availableScreenHeight + keyboardScrollExtraOffset;\r\n\r\n setTimeout(() => {\r\n scrollViewRef.current?.scrollTo({\r\n y: currentScrollPosition + scrollOffset,\r\n animated: true,\r\n });\r\n }, 150);\r\n }\r\n });\r\n\r\n const keyboardHideSubscription = Keyboard.addListener(hideEvent, () => {\r\n setKeyboardHeight(0);\r\n });\r\n\r\n return () => {\r\n positionRef.current = null;\r\n lastTouchY.current = null;\r\n keyboardShowSubscription.remove();\r\n keyboardHideSubscription.remove();\r\n };\r\n }, [keyboardScrollExtraOffset]);\r\n\r\n const handleScroll = (event: NativeSyntheticEvent<NativeScrollEvent>) => {\r\n if (props.onScroll) props.onScroll(event);\r\n if (keyboardScrollExtraOffset) positionRef.current = event.nativeEvent.contentOffset.y;\r\n };\r\n\r\n const handleTouch = (evt: any) => {\r\n if (keyboardScrollExtraOffset) lastTouchY.current = evt.nativeEvent.pageY;\r\n };\r\n\r\n const renderContent = () => {\r\n if (isLoader) return loadingComponent;\r\n\r\n const leftWidth = (splitEnabled ? `${splitRatio * 100}%` : '100%') as DimensionValue;\r\n const rightWidth = `${(1 - splitRatio) * 100}%` as DimensionValue;\r\n\r\n return (\r\n <View style={styles.splitContainer}>\r\n\r\n {/* 메인 컴포넌트 */}\r\n <VariantView\r\n style={props.style}\r\n children={props.children}\r\n scrollViewRef={scrollViewRef}\r\n variantWidth={leftWidth}\r\n showsVerticalScrollIndicator={showsVerticalScrollIndicator}\r\n automaticallyAdjustKeyboardInsets={automaticallyAdjustKeyboardInsets}\r\n scrollViewDisabled={scrollViewDisabled}\r\n scrollEventThrottle={scrollEventThrottle}\r\n handleScroll={handleScroll}\r\n handleTouch={handleTouch}\r\n keyboardHeight={keyboardHeight}\r\n />\r\n\r\n {/* 폴드/태블릿 화면 오른쪽 컴포넌트 */}\r\n {rightComponent && splitEnabled && (\r\n <VariantView\r\n style={styles.splitView}\r\n children={rightComponent}\r\n variantWidth={rightWidth}\r\n showsVerticalScrollIndicator={showsVerticalScrollIndicator}\r\n automaticallyAdjustKeyboardInsets={automaticallyAdjustKeyboardInsets}\r\n scrollViewDisabled={false}\r\n scrollEventThrottle={scrollEventThrottle}\r\n />\r\n )}\r\n </View>\r\n );\r\n };\r\n\r\n return (\r\n <SafeAreaView\r\n style={[\r\n { backgroundColor: backgroundColor || palette.background.base },\r\n styles.flex1,\r\n { width: '100%' },\r\n ]}\r\n edges={edges}\r\n >\r\n {!isDelayed && (\r\n <View\r\n style={[styles.flex1, { width: '100%' }]}\r\n >\r\n {topComponent && topComponent}\r\n {renderContent()}\r\n {!isLoader && bottomComponent && bottomComponent}\r\n </View>\r\n )}\r\n\r\n {\r\n (barStyle || statusBarColor || translucent) && (\r\n <StatusBar\r\n barStyle={barStyle}\r\n backgroundColor={statusBarColor || palette.background.base}\r\n translucent={translucent}\r\n />\r\n )\r\n }\r\n </SafeAreaView>\r\n );\r\n});\r\n\r\nexport const styles = StyleSheet.create({\r\n flex1: { flex: 1 },\r\n scrollContainerStyle: {\r\n flexGrow: 1,\r\n alignItems: 'center',\r\n },\r\n splitContainer: {\r\n flex: 1,\r\n flexDirection: 'row',\r\n width: '100%',\r\n },\r\n splitView: {\r\n minHeight: '100%',\r\n },\r\n});\r\n\r\nexport default ZSContainer;\r\n"]}
|
|
@@ -10,7 +10,8 @@ interface VariantViewProps {
|
|
|
10
10
|
handleScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
11
11
|
handleTouch?: (event: any) => void;
|
|
12
12
|
scrollEventThrottle?: number;
|
|
13
|
+
keyboardHeight?: number;
|
|
13
14
|
}
|
|
14
|
-
export default function VariantView({ children, scrollViewDisabled, style, scrollViewRef, variantWidth, showsVerticalScrollIndicator, automaticallyAdjustKeyboardInsets, handleScroll, handleTouch, scrollEventThrottle }: VariantViewProps): import("react").JSX.Element;
|
|
15
|
+
export default function VariantView({ children, scrollViewDisabled, style, scrollViewRef, variantWidth, showsVerticalScrollIndicator, automaticallyAdjustKeyboardInsets, handleScroll, handleTouch, scrollEventThrottle, keyboardHeight }: VariantViewProps): import("react").JSX.Element;
|
|
15
16
|
export {};
|
|
16
17
|
//# sourceMappingURL=VariantView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VariantView.d.ts","sourceRoot":"","sources":["../../../../src/ui/ZSContainer/ui/VariantView.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,iBAAiB,EAAQ,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/H,UAAU,gBAAgB;
|
|
1
|
+
{"version":3,"file":"VariantView.d.ts","sourceRoot":"","sources":["../../../../src/ui/ZSContainer/ui/VariantView.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,iBAAiB,EAAQ,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/H,UAAU,gBAAgB;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC5B,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAC5C,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,iCAAiC,CAAC,EAAE,OAAO,CAAC;IAC5C,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACxE,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;IACnC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,QAAQ,EAAE,kBAAkB,EAAE,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,4BAA4B,EAAE,iCAAiC,EAAE,YAAY,EAAE,WAAW,EAAE,mBAAmB,EAAE,cAAc,EAAE,EAAE,gBAAgB,+BA0B1P"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { styles } from '..';
|
|
2
2
|
import { ScrollView, View } from 'react-native';
|
|
3
|
-
export default function VariantView({ children, scrollViewDisabled, style, scrollViewRef, variantWidth, showsVerticalScrollIndicator, automaticallyAdjustKeyboardInsets, handleScroll, handleTouch, scrollEventThrottle }) {
|
|
3
|
+
export default function VariantView({ children, scrollViewDisabled, style, scrollViewRef, variantWidth, showsVerticalScrollIndicator, automaticallyAdjustKeyboardInsets, handleScroll, handleTouch, scrollEventThrottle, keyboardHeight }) {
|
|
4
4
|
return (scrollViewDisabled ? (<View style={[style, { width: variantWidth }]}>
|
|
5
5
|
{children}
|
|
6
|
-
</View>) : (<ScrollView ref={scrollViewRef} style={{ width: variantWidth }} contentContainerStyle={styles.scrollContainerStyle} bounces={false} overScrollMode="never" showsVerticalScrollIndicator={showsVerticalScrollIndicator} keyboardShouldPersistTaps="handled" automaticallyAdjustKeyboardInsets={automaticallyAdjustKeyboardInsets} onScroll={handleScroll} onTouchStart={handleTouch} scrollEventThrottle={scrollEventThrottle}>
|
|
6
|
+
</View>) : (<ScrollView ref={scrollViewRef} style={{ width: variantWidth, paddingBottom: keyboardHeight || 0 }} contentContainerStyle={styles.scrollContainerStyle} bounces={false} overScrollMode="never" showsVerticalScrollIndicator={showsVerticalScrollIndicator} keyboardShouldPersistTaps="handled" automaticallyAdjustKeyboardInsets={automaticallyAdjustKeyboardInsets} onScroll={handleScroll} onTouchStart={handleTouch} scrollEventThrottle={scrollEventThrottle}>
|
|
7
7
|
<View style={[styles.splitView, style, { width: '100%' }]}>
|
|
8
8
|
{children}
|
|
9
9
|
</View>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VariantView.js","sourceRoot":"","sources":["../../../../src/ui/ZSContainer/ui/VariantView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,EAAE,UAAU,EAA2C,IAAI,EAAwC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"VariantView.js","sourceRoot":"","sources":["../../../../src/ui/ZSContainer/ui/VariantView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAC5B,OAAO,EAAE,UAAU,EAA2C,IAAI,EAAwC,MAAM,cAAc,CAAC;AAgB/H,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,QAAQ,EAAE,kBAAkB,EAAE,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,4BAA4B,EAAE,iCAAiC,EAAE,YAAY,EAAE,WAAW,EAAE,mBAAmB,EAAE,cAAc,EAAoB;IACzP,OAAO,CACL,kBAAkB,CAAC,CAAC,CAAC,CACnB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC,CAC5C;QAAA,CAAC,QAAQ,CACX;MAAA,EAAE,IAAI,CAAC,CACR,CAAC,CAAC,CAAC,CACF,CAAC,UAAU,CACT,GAAG,CAAC,CAAC,aAAa,CAAC,CACnB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,IAAI,CAAC,EAAE,CAAC,CACnE,qBAAqB,CAAC,CAAC,MAAM,CAAC,oBAAoB,CAAC,CACnD,OAAO,CAAC,CAAC,KAAK,CAAC,CACf,cAAc,CAAC,OAAO,CACtB,4BAA4B,CAAC,CAAC,4BAA4B,CAAC,CAC3D,yBAAyB,CAAC,SAAS,CACnC,iCAAiC,CAAC,CAAC,iCAAiC,CAAC,CACrE,QAAQ,CAAC,CAAC,YAAY,CAAC,CACvB,YAAY,CAAC,CAAC,WAAW,CAAC,CAC1B,mBAAmB,CAAC,CAAC,mBAAmB,CAAC,CAEzC;QAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CACxD;UAAA,CAAC,QAAQ,CACX;QAAA,EAAE,IAAI,CACR;MAAA,EAAE,UAAU,CAAC,CACd,CACF,CAAA;AACH,CAAC","sourcesContent":["import { styles } from '..';\nimport { ScrollView, NativeSyntheticEvent, NativeScrollEvent, View, DimensionValue, StyleProp, ViewStyle } from 'react-native';\n\ninterface VariantViewProps {\n children: React.ReactNode;\n scrollViewDisabled?: boolean;\n style: StyleProp<ViewStyle>;\n scrollViewRef?: React.RefObject<ScrollView>;\n variantWidth?: DimensionValue;\n showsVerticalScrollIndicator?: boolean;\n automaticallyAdjustKeyboardInsets?: boolean;\n handleScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;\n handleTouch?: (event: any) => void;\n scrollEventThrottle?: number;\n keyboardHeight?: number;\n}\n\nexport default function VariantView({ children, scrollViewDisabled, style, scrollViewRef, variantWidth, showsVerticalScrollIndicator, automaticallyAdjustKeyboardInsets, handleScroll, handleTouch, scrollEventThrottle, keyboardHeight }: VariantViewProps) {\n return (\n scrollViewDisabled ? (\n <View style={[style, { width: variantWidth }]}>\n {children}\n </View>\n ) : (\n <ScrollView\n ref={scrollViewRef}\n style={{ width: variantWidth, paddingBottom: keyboardHeight || 0 }}\n contentContainerStyle={styles.scrollContainerStyle}\n bounces={false}\n overScrollMode=\"never\"\n showsVerticalScrollIndicator={showsVerticalScrollIndicator}\n keyboardShouldPersistTaps=\"handled\"\n automaticallyAdjustKeyboardInsets={automaticallyAdjustKeyboardInsets}\n onScroll={handleScroll}\n onTouchStart={handleTouch}\n scrollEventThrottle={scrollEventThrottle}\n >\n <View style={[styles.splitView, style, { width: '100%' }]}>\n {children}\n </View>\n </ScrollView>\n )\n )\n}"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0610studio/zs-ui",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "EXPO ZS-UI",
|
|
6
6
|
"type": "module",
|
|
@@ -49,11 +49,37 @@
|
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@react-native-async-storage/async-storage": "*",
|
|
52
|
-
"expo": "
|
|
52
|
+
"expo": ">=52.0.0",
|
|
53
53
|
"react": "*",
|
|
54
|
-
"react-native": "
|
|
55
|
-
"react-native-reanimated": "
|
|
54
|
+
"react-native": ">=0.76.0",
|
|
55
|
+
"react-native-reanimated": "^3.0.0",
|
|
56
56
|
"react-native-safe-area-context": "*",
|
|
57
57
|
"react-native-svg": "*"
|
|
58
|
+
},
|
|
59
|
+
"peerDependenciesMeta": {
|
|
60
|
+
"@react-native-async-storage/async-storage": {
|
|
61
|
+
"optional": false
|
|
62
|
+
},
|
|
63
|
+
"expo": {
|
|
64
|
+
"optional": false
|
|
65
|
+
},
|
|
66
|
+
"react": {
|
|
67
|
+
"optional": false
|
|
68
|
+
},
|
|
69
|
+
"react-native": {
|
|
70
|
+
"optional": false
|
|
71
|
+
},
|
|
72
|
+
"react-native-reanimated": {
|
|
73
|
+
"optional": false
|
|
74
|
+
},
|
|
75
|
+
"react-native-safe-area-context": {
|
|
76
|
+
"optional": false
|
|
77
|
+
},
|
|
78
|
+
"react-native-svg": {
|
|
79
|
+
"optional": false
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"installConfig": {
|
|
83
|
+
"hoistingLimits": "workspaces"
|
|
58
84
|
}
|
|
59
85
|
}
|