-
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 #26022 from allroundexperts/fix-25428
- Loading branch information
Showing
6 changed files
with
170 additions
and
24 deletions.
There are no files selected for viewing
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,47 @@ | ||
import {StyleSheet, View, Animated} from 'react-native'; | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Icon from '../Icon'; | ||
import themeColors from '../../styles/themes/default'; | ||
|
||
const propTypes = { | ||
/** Icon to display on tab */ | ||
icon: PropTypes.func, | ||
|
||
/** Animated opacity value while the label is inactive state */ | ||
inactiveOpacity: PropTypes.number, | ||
|
||
/** Animated opacity value while the label is in active state */ | ||
activeOpacity: PropTypes.number, | ||
}; | ||
|
||
const defaultProps = { | ||
icon: '', | ||
inactiveOpacity: 1, | ||
activeOpacity: 0, | ||
}; | ||
|
||
function TabIcon({icon, activeOpacity, inactiveOpacity}) { | ||
return ( | ||
<View> | ||
<Animated.View style={{opacity: inactiveOpacity}}> | ||
<Icon | ||
src={icon} | ||
fill={themeColors.icon} | ||
/> | ||
</Animated.View> | ||
<Animated.View style={[StyleSheet.absoluteFill, {opacity: activeOpacity}]}> | ||
<Icon | ||
src={icon} | ||
fill={themeColors.iconMenu} | ||
/> | ||
</Animated.View> | ||
</View> | ||
); | ||
} | ||
|
||
TabIcon.propTypes = propTypes; | ||
TabIcon.defaultProps = defaultProps; | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import {StyleSheet, View, Text, Animated} from 'react-native'; | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import styles from '../../styles/styles'; | ||
|
||
const propTypes = { | ||
/** Title of the tab */ | ||
title: PropTypes.string, | ||
|
||
/** Animated opacity value while the label is inactive state */ | ||
inactiveOpacity: PropTypes.number, | ||
|
||
/** Animated opacity value while the label is in active state */ | ||
activeOpacity: PropTypes.number, | ||
}; | ||
|
||
const defaultProps = { | ||
title: '', | ||
inactiveOpacity: 1, | ||
activeOpacity: 0, | ||
}; | ||
|
||
function TabLabel({title, activeOpacity, inactiveOpacity}) { | ||
return ( | ||
<View> | ||
<Animated.View style={[{opacity: activeOpacity}]}> | ||
<Text style={styles.tabText(true)}>{title}</Text> | ||
</Animated.View> | ||
<Animated.View style={[StyleSheet.absoluteFill, {opacity: inactiveOpacity}]}> | ||
<Text style={styles.tabText(false)}>{title}</Text> | ||
</Animated.View> | ||
</View> | ||
); | ||
} | ||
|
||
TabLabel.propTypes = propTypes; | ||
TabLabel.defaultProps = defaultProps; | ||
TabLabel.displayName = 'TabLabel'; | ||
|
||
export default TabLabel; |
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
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