@@ -26,6 +26,8 @@ import {
2626 type TextInputProps ,
2727 View ,
2828 useWindowDimensions ,
29+ type ViewStyle ,
30+ StyleSheet ,
2931} from 'react-native' ;
3032import { Platform } from 'react-native' ;
3133
@@ -49,13 +51,14 @@ export type InputType = Record<string, RefObject<TextInput>>;
4951
5052const isAndroid = Platform . OS === 'android' ;
5153
52- function Wrapper ( props : PropsWithChildren < { } > ) {
54+ function Wrapper ( props : PropsWithChildren < { } > & { wrapperStyle ?: ViewStyle } ) {
5355 const windowDimensions = useWindowDimensions ( ) ;
5456 const { wrapperRef, setWrapperOffset } = useSmartScrollContext ( ) ;
5557
5658 return (
5759 < View
5860 ref = { wrapperRef }
61+ style = { [ styles . wrapper , props . wrapperStyle ] }
5962 onLayout = { ( { nativeEvent } ) => {
6063 if ( nativeEvent . layout . height !== windowDimensions . height ) {
6164 setWrapperOffset ( windowDimensions . height - nativeEvent . layout . height ) ;
@@ -66,8 +69,15 @@ function Wrapper(props: PropsWithChildren<{}>) {
6669 </ View >
6770 ) ;
6871}
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+ ) {
7181 return (
7282 < SmartScrollProvider >
7383 < Wrapper { ...props } />
@@ -183,15 +193,17 @@ function InsideScrollView(
183193 </ Animated . ScrollView >
184194 ) ;
185195}
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+ } > ) => {
192204 return (
193- < SmartScrollView >
194- < InsideScrollView { ...props } />
205+ < SmartScrollView wrapperStyle = { wrapperStyle } >
206+ < InsideScrollView { ...rest } />
195207 </ SmartScrollView >
196208 ) ;
197209} ;
0 commit comments