Skip to content

Commit

Permalink
fix pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
SzymczakJ committed Dec 20, 2023
1 parent 920efa8 commit dbfb60a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/components/TabSelector/TabIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ type TabIconProps = {
/** Icon to display on tab */
icon?: (props: SrcProps) => React.ReactNode;

/** Animated opacity value while the label is inactive state */
/** Animated opacity value while the icon is in inactive state */
inactiveOpacity?: number | Animated.AnimatedInterpolation<number>;

/** Animated opacity value while the label is in active state */
/** Animated opacity value while the icon is in active state */
activeOpacity?: number | Animated.AnimatedInterpolation<number>;
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/TabSelector/TabLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type TabLabelProps = {
/** Title of the tab */
title?: string;

/** Animated opacity value while the label is inactive state */
/** Animated opacity value while the label is in inactive state */
inactiveOpacity?: number | Animated.AnimatedInterpolation<number>;

/** Animated opacity value while the label is in active state */
Expand Down
6 changes: 3 additions & 3 deletions src/components/TabSelector/TabSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ function TabSelector({state, navigation, onTabPress = () => {}, position}: TabSe
const activeOpacity = getOpacity(position, state.routes.length, index, true, affectedAnimatedTabs);
const inactiveOpacity = getOpacity(position, state.routes.length, index, false, affectedAnimatedTabs);
const backgroundColor = getBackgroundColor(state.routes.length, index, affectedAnimatedTabs);
const isFocused = index === state.index;
const isActive = index === state.index;
const {icon, title} = getIconAndTitle(route.name, translate);

const onPress = () => {
if (isFocused) {
if (isActive) {
return;
}

Expand Down Expand Up @@ -132,7 +132,7 @@ function TabSelector({state, navigation, onTabPress = () => {}, position}: TabSe
activeOpacity={activeOpacity}
inactiveOpacity={inactiveOpacity}
backgroundColor={backgroundColor}
isFocused={isFocused}
isActive={isActive}
/>
);
})}
Expand Down
18 changes: 9 additions & 9 deletions src/components/TabSelector/TabSelectorItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ type TabSelectorItemProps = {
/** Animated background color value for the tab button */
backgroundColor?: string | Animated.AnimatedInterpolation<string>;

/** Animated opacity value while the label is inactive state */
/** Animated opacity value while the tab is in inactive state */
inactiveOpacity?: number | Animated.AnimatedInterpolation<number>;

/** Animated opacity value while the label is in active state */
/** Animated opacity value while the tab is in active state */
activeOpacity?: number | Animated.AnimatedInterpolation<number>;

/** Whether this tab is active */
isFocused?: boolean;
isActive?: boolean;
};

function TabSelectorItem({icon, title = '', onPress = () => {}, backgroundColor = '', activeOpacity = 0, inactiveOpacity = 1, isFocused = false}: TabSelectorItemProps) {
function TabSelectorItem({icon, title = '', onPress = () => {}, backgroundColor = '', activeOpacity = 0, inactiveOpacity = 1, isActive = false}: TabSelectorItemProps) {
const styles = useThemeStyles();
return (
<PressableWithFeedback
Expand All @@ -39,16 +39,16 @@ function TabSelectorItem({icon, title = '', onPress = () => {}, backgroundColor
onPress={onPress}
>
{({hovered}) => (
<Animated.View style={[styles.tabSelectorButton, StyleSheet.absoluteFill, styles.tabBackground(hovered, isFocused, backgroundColor)]}>
<Animated.View style={[styles.tabSelectorButton, StyleSheet.absoluteFill, styles.tabBackground(hovered, isActive, backgroundColor)]}>
<TabIcon
icon={icon}
activeOpacity={styles.tabOpacity(hovered, isFocused, activeOpacity, inactiveOpacity).opacity}
inactiveOpacity={styles.tabOpacity(hovered, isFocused, inactiveOpacity, activeOpacity).opacity}
activeOpacity={styles.tabOpacity(hovered, isActive, activeOpacity, inactiveOpacity).opacity}
inactiveOpacity={styles.tabOpacity(hovered, isActive, inactiveOpacity, activeOpacity).opacity}
/>
<TabLabel
title={title}
activeOpacity={styles.tabOpacity(hovered, isFocused, activeOpacity, inactiveOpacity).opacity}
inactiveOpacity={styles.tabOpacity(hovered, isFocused, inactiveOpacity, activeOpacity).opacity}
activeOpacity={styles.tabOpacity(hovered, isActive, activeOpacity, inactiveOpacity).opacity}
inactiveOpacity={styles.tabOpacity(hovered, isActive, inactiveOpacity, activeOpacity).opacity}
/>
</Animated.View>
)}
Expand Down

0 comments on commit dbfb60a

Please sign in to comment.