/** @jsxImportSource @fluentui-react-native/framework-base */ import * as React from 'react'; import { View } from 'react-native'; import { FocusZone } from '@fluentui-react-native/focus-zone'; import type { UseSlots } from '@fluentui-react-native/framework'; import { compose, mergeProps } from '@fluentui-react-native/framework'; import { stylingSettings } from './TabList.styling'; import type { TabListType, TabListProps } from './TabList.types'; import { tabListName } from './TabList.types'; import { TabListContext } from './TabListContext'; import { useTabList } from './useTabList'; import TabListAnimatedIndicator from '../TabListAnimatedIndicator/TabListAnimatedIndicator'; export const TabList = compose({ displayName: tabListName, ...stylingSettings, slots: { container: FocusZone, stack: View, root: View, }, useRender: (userProps: TabListProps, useSlots: UseSlots) => { // configure props and state for tabs based on user props const tablist = useTabList(userProps); // Grab the styled slots. const Slots = useSlots(userProps); // Return the handler to finish render. return (final: TabListProps, ...children: React.ReactNode[]) => { if (!tablist.state) { return null; } const { disabled, defaultTabbableElement, isCircularNavigation, vertical, ...mergedProps } = mergeProps(tablist.props, final); const { animatedIndicatorStyles, canShowAnimatedIndicator, disabled: tablistDisabledState, layout, selectedKey } = tablist.state; return ( {children} {canShowAnimatedIndicator && ( )} ); }; }, }); export default TabList;