rename Btn to TabItem

This commit is contained in:
Samuel Newman
2024-11-12 19:42:03 +00:00
parent e38d5400a7
commit b919031e42
+14 -15
View File
@@ -146,7 +146,7 @@ export function BottomBar({navigation}: BottomTabBarProps) {
/> />
) : ( ) : (
<MagnifyingGlass <MagnifyingGlass
testID="bottomBarSearchBtn" testID="bottomBarSearchTabItem"
width={iconWidth + 2} width={iconWidth + 2}
style={[styles.ctrlIcon, pal.text, styles.searchIcon]} style={[styles.ctrlIcon, pal.text, styles.searchIcon]}
/> />
@@ -239,24 +239,24 @@ export function BottomBar({navigation}: BottomTabBarProps) {
}}> }}>
{hasSession ? ( {hasSession ? (
<> <>
<Btn <TabItem
testID="bottomBarHomeBtn" testID="bottomBarHomeTabItem"
renderIcon={renderHomeIcon} renderIcon={renderHomeIcon}
onPress={onPressHome} onPress={onPressHome}
accessibilityRole="tab" accessibilityRole="tab"
accessibilityLabel={_(msg`Home`)} accessibilityLabel={_(msg`Home`)}
accessibilityHint="" accessibilityHint=""
/> />
<Btn <TabItem
testID="bottomBarSearchBtn" testID="bottomBarSearchTabItem"
renderIcon={renderSearchIcon} renderIcon={renderSearchIcon}
onPress={onPressSearch} onPress={onPressSearch}
accessibilityRole="search" accessibilityRole="search"
accessibilityLabel={_(msg`Search`)} accessibilityLabel={_(msg`Search`)}
accessibilityHint="" accessibilityHint=""
/> />
<Btn <TabItem
testID="bottomBarMessagesBtn" testID="bottomBarMessagesTabItem"
renderIcon={renderMessagesIcon} renderIcon={renderMessagesIcon}
onPress={onPressMessages} onPress={onPressMessages}
notificationCount={numUnreadMessages.numUnread} notificationCount={numUnreadMessages.numUnread}
@@ -269,8 +269,8 @@ export function BottomBar({navigation}: BottomTabBarProps) {
: '' : ''
} }
/> />
<Btn <TabItem
testID="bottomBarNotificationsBtn" testID="bottomBarNotificationsTabItem"
renderIcon={renderNotificationsIcon} renderIcon={renderNotificationsIcon}
onPress={onPressNotifications} onPress={onPressNotifications}
notificationCount={numUnreadNotifications} notificationCount={numUnreadNotifications}
@@ -283,8 +283,8 @@ export function BottomBar({navigation}: BottomTabBarProps) {
: _(msg`${numUnreadNotifications} unread items`) : _(msg`${numUnreadNotifications} unread items`)
} }
/> />
<Btn <TabItem
testID="bottomBarProfileBtn" testID="bottomBarProfileTabItem"
renderIcon={renderProfileIcon} renderIcon={renderProfileIcon}
onPress={onPressProfile} onPress={onPressProfile}
onLongPress={onLongPressProfile} onLongPress={onLongPressProfile}
@@ -344,7 +344,7 @@ export function BottomBar({navigation}: BottomTabBarProps) {
) )
} }
interface BtnProps interface TabItemProps
extends Pick< extends Pick<
ComponentProps<typeof PressableScale>, ComponentProps<typeof PressableScale>,
| 'accessible' | 'accessible'
@@ -359,7 +359,7 @@ interface BtnProps
onLongPress?: (event: GestureResponderEvent) => void onLongPress?: (event: GestureResponderEvent) => void
} }
let Btn = ({ function TabItem({
testID, testID,
renderIcon, renderIcon,
notificationCount, notificationCount,
@@ -368,7 +368,7 @@ let Btn = ({
accessible, accessible,
accessibilityHint, accessibilityHint,
accessibilityLabel, accessibilityLabel,
}: BtnProps): React.ReactNode => { }: TabItemProps) {
return ( return (
<PressableScale <PressableScale
testID={testID} testID={testID}
@@ -388,4 +388,3 @@ let Btn = ({
</PressableScale> </PressableScale>
) )
} }
Btn = React.memo(Btn)