import { AppIcon } from '@codeleap/styles' import { useTabContext } from './Context' import { memoBy } from '@codeleap/utils' import { TabPropsWithCtx } from './types' import { Touchable } from '../Touchable' import { Icon } from '../Icon' import { Text } from '../Text' import React from 'react' type TabProps = { value: string text?: string icon?: AppIcon disabled?: boolean } const TabMemoized = memoBy((props: TabPropsWithCtx) => { const { value, text, icon, active, setValue, styles, disabled } = props return ( setValue(value)} debugName={`tabs:${value}`} > ) }, ['icon', 'text', 'active', 'styles', 'disabled']) export const Tab = (props: TabProps) => { const { value, setValue, styles } = useTabContext() const active = value === props.value return setValue(value, null)} styles={styles} /> }