@@ -43,7 +43,7 @@ const NestedTabView = forwardRef<NestedTabViewRef, NestedTabViewProps>(
4343 ( props , ref ) => {
4444 const {
4545 renderHeader,
46- stickyHeight = 0 ,
46+ stickyHeight : initialStickyHeight ,
4747 children,
4848 initialIndex = 0 ,
4949 style,
@@ -85,6 +85,8 @@ const NestedTabView = forwardRef<NestedTabViewRef, NestedTabViewProps>(
8585 const sharedTranslate = useSharedValue ( 0 ) ;
8686 const [ headerHeight , setHeaderHeight ] = useState ( 0 ) ;
8787 const [ tabViewHeight , setTabViewHeight ] = useState ( 0 ) ;
88+ const [ stickyHeight , setStickyHeight ] = useState ( 0 ) ;
89+
8890 const refreshStatus = useSharedValue < RefreshStatus > ( RefreshStatus . Idle ) ;
8991 const isTouching = useSharedValue ( false ) ;
9092
@@ -192,6 +194,17 @@ const NestedTabView = forwardRef<NestedTabViewRef, NestedTabViewProps>(
192194 [ tabViewHeight ]
193195 ) ;
194196
197+ const handleTabBarHeightLayout = useCallback (
198+ ( e : LayoutChangeEvent ) => {
199+ if ( typeof initialStickyHeight === 'number' ) {
200+ setStickyHeight ( initialStickyHeight ) ;
201+ } else {
202+ setStickyHeight ( e . nativeEvent . layout . height ) ;
203+ }
204+ } ,
205+ [ stickyHeight , initialStickyHeight ]
206+ ) ;
207+
195208 const childMinHeight = useMemo ( ( ) => {
196209 return headerHeight + tabViewHeight - stickyHeight ;
197210 } , [ headerHeight , tabViewHeight , stickyHeight ] ) ;
@@ -431,6 +444,7 @@ const NestedTabView = forwardRef<NestedTabViewRef, NestedTabViewProps>(
431444 < TabBar
432445 { ...{ ...tabProps } }
433446 ref = { tabRef }
447+ onLayout = { handleTabBarHeightLayout }
434448 onTabPress = { ( index ) => {
435449 pageRef . current && pageRef . current ?. setPage ( index ) ;
436450 onTabPress && onTabPress ( index ) ;
0 commit comments