react-native-animated-header-flat-list
Version:
A React Native FlatList component with an animated collapsible header, featuring parallax effects, smooth title transitions, sticky component support, and customizable styles. Built with TypeScript and separate background/content layers in header.
20 lines (18 loc) • 558 B
text/typescript
import { type StyleProp, type TextStyle } from 'react-native';
export const getFontSizeFromStyle = (textStyle: StyleProp<TextStyle>) => {
if (!textStyle) return undefined;
if (Array.isArray(textStyle)) {
for (const styleItem of textStyle.toReversed()) {
if (
styleItem &&
typeof styleItem === 'object' &&
'fontSize' in styleItem
) {
return styleItem.fontSize;
}
}
} else if (typeof textStyle === 'object' && 'fontSize' in textStyle) {
return textStyle.fontSize;
}
return undefined;
};