import * as React from 'react';
import { Animated, StyleSheet } from 'react-native';
import AnimatedText from '../../Typography/AnimatedText';
import type { LabelBackgroundProps } from '../types';
const LabelBackground = ({
parentState,
labelProps: {
placeholderStyle,
baseLabelTranslateX,
topPosition,
hasActiveOutline,
label,
backgroundColor,
roundness,
},
labelStyle,
maxFontSizeMultiplier,
}: LabelBackgroundProps) => {
const hasFocus = hasActiveOutline || parentState.value;
const opacity = parentState.labeled.interpolate({
inputRange: [0, 1],
outputRange: [hasFocus ? 1 : 0, 0],
});
const labelTranslationX = {
transform: [
{
translateX: parentState.labeled.interpolate({
inputRange: [0, 1],
outputRange: [-baseLabelTranslateX, 0],
}),
},
],
};
return label
? [
,
{label}
,
]
: null;
};
export default LabelBackground;
const styles = StyleSheet.create({
view: {
position: 'absolute',
top: 6,
left: 10,
width: 12,
},
outlinedLabel: {
position: 'absolute',
left: 18,
paddingHorizontal: 0,
color: 'transparent',
},
});