'use client'; import React from 'react'; import { StyleSheet, findNodeHandle, type NativeSyntheticEvent, } from 'react-native'; import BottomTabsNativeComponent, { type NativeProps as BottomTabsNativeComponentProps, } from '../../fabric/bottom-tabs/BottomTabsNativeComponent'; import featureFlags from '../../flags'; import type { BottomTabsProps, NativeFocusChangeEvent, } from './BottomTabs.types'; import { bottomTabsDebugLog } from '../../private/logging'; /** * EXPERIMENTAL API, MIGHT CHANGE W/O ANY NOTICE */ function BottomTabs(props: BottomTabsProps) { bottomTabsDebugLog(`BottomTabs render`); const { onNativeFocusChange, experimentalControlNavigationStateInJS = featureFlags.experiment .controlledBottomTabs, ...filteredProps } = props; const componentNodeRef = React.useRef>(null); const componentNodeHandle = React.useRef(-1); React.useEffect(() => { if (componentNodeRef.current != null) { componentNodeHandle.current = findNodeHandle(componentNodeRef.current) ?? -1; } else { componentNodeHandle.current = -1; } }, []); const onNativeFocusChangeCallback = React.useCallback( (event: NativeSyntheticEvent) => { bottomTabsDebugLog( `BottomTabs [${ componentNodeHandle.current ?? -1 }] onNativeFocusChange: ${JSON.stringify(event.nativeEvent)}`, ); onNativeFocusChange?.(event); }, [onNativeFocusChange], ); return ( {filteredProps.children} ); } export default BottomTabs; const styles = StyleSheet.create({ fillParent: { flex: 1, width: '100%', height: '100%', }, });