diff --git a/src/components/FAB/AnimatedFAB.tsx b/src/components/FAB/AnimatedFAB.tsx index 6c5fedbb22..4cd05fda1d 100644 --- a/src/components/FAB/AnimatedFAB.tsx +++ b/src/components/FAB/AnimatedFAB.tsx @@ -17,6 +17,7 @@ import { StyleSheet, View, ViewStyle, + Text, } from 'react-native'; import color from 'color'; @@ -231,7 +232,7 @@ const AnimatedFAB = ({ const isAnimatedFromRight = animateFrom === 'right'; const isIconStatic = iconMode === 'static'; const { isRTL } = I18nManager; - const labelRef = React.useRef(null); + const labelRef = React.useRef(null); const { current: visibility } = React.useRef( new Animated.Value(visible ? 1 : 0) ); diff --git a/src/components/Typography/AnimatedText.tsx b/src/components/Typography/AnimatedText.tsx index 6fe65a49ab..bab41a617c 100644 --- a/src/components/Typography/AnimatedText.tsx +++ b/src/components/Typography/AnimatedText.tsx @@ -5,6 +5,7 @@ import { StyleProp, StyleSheet, TextStyle, + Text, } from 'react-native'; import type { VariantProp } from './types'; @@ -40,57 +41,59 @@ type Props = React.ComponentPropsWithRef & { * * @extends Text props https://reactnative.dev/docs/text#props */ -const AnimatedText = forwardRef(function AnimatedText( - { style, theme: themeOverrides, variant, ...rest }: Props, - ref -) { - const theme = useInternalTheme(themeOverrides); - const writingDirection = I18nManager.getConstants().isRTL ? 'rtl' : 'ltr'; +const AnimatedText = forwardRef>( + function AnimatedText( + { style, theme: themeOverrides, variant, ...rest }, + ref + ) { + const theme = useInternalTheme(themeOverrides); + const writingDirection = I18nManager.getConstants().isRTL ? 'rtl' : 'ltr'; - if (theme.isV3 && variant) { - const font = theme.fonts[variant]; - if (typeof font !== 'object') { - throw new Error( - `Variant ${variant} was not provided properly. Valid variants are ${Object.keys( - theme.fonts - ).join(', ')}.` + if (theme.isV3 && variant) { + const font = theme.fonts[variant]; + if (typeof font !== 'object') { + throw new Error( + `Variant ${variant} was not provided properly. Valid variants are ${Object.keys( + theme.fonts + ).join(', ')}.` + ); + } + + return ( + + ); + } else { + const font = !theme.isV3 ? theme.fonts.regular : theme.fonts.bodyMedium; + const textStyle = { + ...font, + color: theme.isV3 ? theme.colors.onSurface : theme.colors.text, + }; + return ( + ); } - - return ( - - ); - } else { - const font = !theme.isV3 ? theme.fonts.regular : theme.fonts.bodyMedium; - const textStyle = { - ...font, - color: theme.isV3 ? theme.colors.onSurface : theme.colors.text, - }; - return ( - - ); } -}); +); const styles = StyleSheet.create({ text: {