@@ -26,6 +26,8 @@ import {
26
26
type TextInputProps ,
27
27
View ,
28
28
useWindowDimensions ,
29
+ type ViewStyle ,
30
+ StyleSheet ,
29
31
} from 'react-native' ;
30
32
import { Platform } from 'react-native' ;
31
33
@@ -49,13 +51,14 @@ export type InputType = Record<string, RefObject<TextInput>>;
49
51
50
52
const isAndroid = Platform . OS === 'android' ;
51
53
52
- function Wrapper ( props : PropsWithChildren < { } > ) {
54
+ function Wrapper ( props : PropsWithChildren < { } > & { wrapperStyle ?: ViewStyle } ) {
53
55
const windowDimensions = useWindowDimensions ( ) ;
54
56
const { wrapperRef, setWrapperOffset } = useSmartScrollContext ( ) ;
55
57
56
58
return (
57
59
< View
58
60
ref = { wrapperRef }
61
+ style = { [ styles . wrapper , props . wrapperStyle ] }
59
62
onLayout = { ( { nativeEvent } ) => {
60
63
if ( nativeEvent . layout . height !== windowDimensions . height ) {
61
64
setWrapperOffset ( windowDimensions . height - nativeEvent . layout . height ) ;
@@ -66,8 +69,15 @@ function Wrapper(props: PropsWithChildren<{}>) {
66
69
</ View >
67
70
) ;
68
71
}
69
-
70
- export default function SmartScrollView ( props : PropsWithChildren < { } > ) {
72
+ const styles = StyleSheet . create ( {
73
+ wrapper : {
74
+ flex : 1 ,
75
+ } ,
76
+ } ) ;
77
+
78
+ export default function SmartScrollView (
79
+ props : PropsWithChildren < { } > & { wrapperStyle ?: ViewStyle }
80
+ ) {
71
81
return (
72
82
< SmartScrollProvider >
73
83
< Wrapper { ...props } />
@@ -183,15 +193,17 @@ function InsideScrollView(
183
193
</ Animated . ScrollView >
184
194
) ;
185
195
}
186
- export const ScrollView = (
187
- props : PropsWithChildren < {
188
- scrollViewProps ?: AnimatedScrollViewProps ;
189
- additionalPadding ?: number ;
190
- } >
191
- ) => {
196
+ export const ScrollView = ( {
197
+ wrapperStyle,
198
+ ...rest
199
+ } : PropsWithChildren < {
200
+ scrollViewProps ?: AnimatedScrollViewProps ;
201
+ additionalPadding ?: number ;
202
+ wrapperStyle ?: ViewStyle ;
203
+ } > ) => {
192
204
return (
193
- < SmartScrollView >
194
- < InsideScrollView { ...props } />
205
+ < SmartScrollView wrapperStyle = { wrapperStyle } >
206
+ < InsideScrollView { ...rest } />
195
207
</ SmartScrollView >
196
208
) ;
197
209
} ;
0 commit comments