File tree Expand file tree Collapse file tree 7 files changed +44
-23
lines changed Expand file tree Collapse file tree 7 files changed +44
-23
lines changed Original file line number Diff line number Diff line change 6767 "typescript" : " ^4.2.4"
6868 },
6969 "peerDependencies" : {
70+ "@types/react" : " *" ,
71+ "@types/react-native" : " *" ,
7072 "react" : " *" ,
7173 "react-native" : " *" ,
7274 "react-native-gesture-handler" : " >=1.10.1" ,
7375 "react-native-reanimated" : " >=2.2.0"
7476 },
77+ "peerDependenciesMeta" : {
78+ "@types/react-native" : {
79+ "optional" : true
80+ },
81+ "@types/react" : {
82+ "optional" : true
83+ }
84+ },
7585 "react-native-builder-bob" : {
7686 "source" : " src" ,
7787 "output" : " lib" ,
Original file line number Diff line number Diff line change @@ -283,9 +283,9 @@ export interface BottomSheetProps
283283 footerComponent ?: React . FC < BottomSheetFooterProps > ;
284284 /**
285285 * A scrollable node or normal view.
286- * @type React.ReactNode[] | React.ReactNode
286+ * @type (() => React.ReactElement) | React.ReactNode[] | React.ReactNode
287287 */
288- children : ( ( ) => React . ReactNode ) | React . ReactNode [ ] | React . ReactNode ;
288+ children : ( ( ) => React . ReactElement ) | React . ReactNode [ ] | React . ReactNode ;
289289 //#endregion
290290
291291 //#region private
Original file line number Diff line number Diff line change 1- import type { ReactNode } from 'react' ;
1+ import type { ReactElement , ReactNode } from 'react' ;
22import { ViewStyle } from 'react-native' ;
33import type Animated from 'react-native-reanimated' ;
44
@@ -31,7 +31,7 @@ export interface BottomSheetDefaultFooterProps extends BottomSheetFooterProps {
3131 /**
3232 * Component to be placed in the footer.
3333 *
34- * @type {ReactNode | ReactNode[] }
34+ * @type {ReactNode | ReactNode[] | (() => ReactElement) }
3535 */
36- children ?: ReactNode | ReactNode [ ] ;
36+ children ?: ReactNode | ReactNode [ ] | ( ( ) => ReactElement ) ;
3737}
Original file line number Diff line number Diff line change @@ -142,30 +142,36 @@ const BottomSheetModalComponent = forwardRef<
142142 }
143143 bottomSheetRef . current ?. snapToPosition ( ...args ) ;
144144 } , [ ] ) ;
145- const handleExpand = useCallback ( ( ...args ) => {
145+ const handleExpand = useCallback < BottomSheetMethods [ 'expand' ] > ( ( ...args ) => {
146146 if ( minimized . current ) {
147147 return ;
148148 }
149149 bottomSheetRef . current ?. expand ( ...args ) ;
150150 } , [ ] ) ;
151- const handleCollapse = useCallback ( ( ...args ) => {
152- if ( minimized . current ) {
153- return ;
154- }
155- bottomSheetRef . current ?. collapse ( ...args ) ;
156- } , [ ] ) ;
157- const handleClose = useCallback ( ( ...args ) => {
151+ const handleCollapse = useCallback < BottomSheetMethods [ 'collapse' ] > (
152+ ( ...args ) => {
153+ if ( minimized . current ) {
154+ return ;
155+ }
156+ bottomSheetRef . current ?. collapse ( ...args ) ;
157+ } ,
158+ [ ]
159+ ) ;
160+ const handleClose = useCallback < BottomSheetMethods [ 'close' ] > ( ( ...args ) => {
158161 if ( minimized . current ) {
159162 return ;
160163 }
161164 bottomSheetRef . current ?. close ( ...args ) ;
162165 } , [ ] ) ;
163- const handleForceClose = useCallback ( ( ...args ) => {
164- if ( minimized . current ) {
165- return ;
166- }
167- bottomSheetRef . current ?. forceClose ( ...args ) ;
168- } , [ ] ) ;
166+ const handleForceClose = useCallback < BottomSheetMethods [ 'forceClose' ] > (
167+ ( ...args ) => {
168+ if ( minimized . current ) {
169+ return ;
170+ }
171+ bottomSheetRef . current ?. forceClose ( ...args ) ;
172+ } ,
173+ [ ]
174+ ) ;
169175 //#endregion
170176
171177 //#region bottom sheet modal methods
Original file line number Diff line number Diff line change @@ -44,10 +44,10 @@ export interface BottomSheetModalProps
4444
4545 /**
4646 * A scrollable node or normal view.
47- * @type React.ReactNode[] | React.ReactNode
47+ * @type React.ReactNode[] | React.ReactNode | (({ data: any }?) => React.ReactElement)
4848 */
4949 children :
50- | ( ( { data : any } ?) => React . ReactNode )
50+ | ( ( { data : any } ?) => React . ReactElement )
5151 | React . ReactNode [ ]
5252 | React . ReactNode ;
5353}
Original file line number Diff line number Diff line change @@ -39,13 +39,18 @@ export const useBottomSheetDynamicSnapPoints = (
3939 ) ;
4040 } , [ ] ) ;
4141
42+ type HandleContentLayoutProps = {
43+ nativeEvent : {
44+ layout : { height : number } ;
45+ } ;
46+ } ;
4247 // callbacks
4348 const handleContentLayout = useCallback (
4449 ( {
4550 nativeEvent : {
4651 layout : { height } ,
4752 } ,
48- } ) => {
53+ } : HandleContentLayoutProps ) => {
4954 animatedContentHeight . value = height ;
5055 } ,
5156 [ animatedContentHeight ]
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ type Callback = (...args: any[]) => any;
88export const useStableCallback = ( callback : Callback ) => {
99 const callbackRef = useRef < Callback > ( ) ;
1010 const memoCallback = useCallback (
11- ( ...args ) => callbackRef . current && callbackRef . current ( ...args ) ,
11+ ( ...args : any ) => callbackRef . current && callbackRef . current ( ...args ) ,
1212 [ ]
1313 ) ;
1414 useEffect ( ( ) => {
You can’t perform that action at this time.
0 commit comments