-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33084 from software-mansion-labs/@szymczak/25089
- Loading branch information
Showing
6 changed files
with
102 additions
and
136 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React from 'react'; | ||
import {Animated, StyleSheet, View} from 'react-native'; | ||
import Icon, {SrcProps} from '@components/Icon'; | ||
import useTheme from '@hooks/useTheme'; | ||
|
||
type TabIconProps = { | ||
/** Icon to display on tab */ | ||
icon?: (props: SrcProps) => React.ReactNode; | ||
|
||
/** Animated opacity value while the icon is in inactive state */ | ||
inactiveOpacity?: number | Animated.AnimatedInterpolation<number>; | ||
|
||
/** Animated opacity value while the icon is in active state */ | ||
activeOpacity?: number | Animated.AnimatedInterpolation<number>; | ||
}; | ||
|
||
function TabIcon({icon, activeOpacity = 0, inactiveOpacity = 1}: TabIconProps) { | ||
const theme = useTheme(); | ||
return ( | ||
<View> | ||
{icon && ( | ||
<> | ||
<Animated.View style={{opacity: inactiveOpacity}}> | ||
<Icon | ||
src={icon} | ||
fill={theme.icon} | ||
/> | ||
</Animated.View> | ||
<Animated.View style={[StyleSheet.absoluteFill, {opacity: activeOpacity}]}> | ||
<Icon | ||
src={icon} | ||
fill={theme.iconMenu} | ||
/> | ||
</Animated.View> | ||
</> | ||
)} | ||
</View> | ||
); | ||
} | ||
|
||
TabIcon.displayName = 'TabIcon'; | ||
|
||
export default TabIcon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.