From 1b0fbd503e867729e42e85d128fdac4fafa9372d Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Tue, 04 Nov 2025 13:43:08 +0000 Subject: [PATCH] Remove use of `flatten` where possible (#9325) * remove use of flatten where possible * restore flatten where it says it's needed * missing utils alpha --- src/components/Button.tsx | 10 ++++------ src/components/Dialog/index.web.tsx | 8 ++++---- src/components/FeedCard.tsx | 2 +- src/components/IconCircle.tsx | 13 ++----------- src/components/LabelingServiceCard/index.tsx | 2 +- src/components/Link.tsx | 2 +- src/components/Lists.tsx | 4 ++-- src/components/Loader.tsx | 9 ++------- src/components/Loader.web.tsx | 4 ++-- src/components/PolicyUpdateOverlay/Overlay.tsx | 12 ++++++------ src/components/PostControls/index.tsx | 15 ++++++++------- src/components/ProfileCard.tsx | 2 +- src/components/RichText.tsx | 10 +++------- src/components/Tooltip/index.web.tsx | 8 ++++---- src/components/Typography.tsx | 6 +++--- src/components/WelcomeModal.tsx | 6 +++--- src/components/dms/EmojiReactionPicker.web.tsx | 4 ++-- src/components/dms/ReportDialog.tsx | 2 +- src/components/forms/Toggle.tsx | 5 ++--- src/components/icons/TEMPLATE.tsx | 2 +- src/screens/Messages/components/MessageInput.web.tsx | 6 +++--- src/screens/Onboarding/Layout.tsx | 13 ++----------- src/screens/Profile/components/ProfileFeedHeader.tsx | 2 +- src/screens/ProfileList/components/Header.tsx | 2 +- src/screens/StarterPack/StarterPackScreen.tsx | 4 +--- src/screens/VideoFeed/index.tsx | 2 +- src/view/com/util/images/ImageLayoutGrid.tsx | 4 ++-- src/view/icons/Logo.tsx | 5 +++-- 28 file(s) changed, 67 insertion(s)(+), 97 deletion(s)(-) diff --git a/src/components/Button.tsx b/src/components/Button.tsx --- a/src/components/Button.tsx +++ b/src/components/Button.tsx @@ -7,7 +7,6 @@ type NativeSyntheticEvent, Pressable, type PressableProps, type StyleProp, - StyleSheet, type TargetedEvent, type TextProps, type TextStyle, @@ -512,8 +511,6 @@ }), [state, variant, color, size, disabled], ) - const flattenedBaseStyles = flatten([baseStyles, style]) - return ( true} onTouchEnd={stopPropagation} - style={flatten([ + style={[ a.relative, a.rounded_md, a.w_full, @@ -195,7 +195,7 @@ shadowRadius: 30, }, !reduceMotionEnabled && a.zoom_fade_in, style, - ])}> + ]}> {footer} diff --git a/src/components/FeedCard.tsx b/src/components/FeedCard.tsx --- a/src/components/FeedCard.tsx +++ b/src/components/FeedCard.tsx @@ -186,7 +186,7 @@ rt.detectFacetsWithoutResolution() return rt }, [description]) if (!rt) return null - return + return } export function DescriptionPlaceholder() { diff --git a/src/components/IconCircle.tsx b/src/components/IconCircle.tsx --- a/src/components/IconCircle.tsx +++ b/src/components/IconCircle.tsx @@ -2,7 +2,6 @@ import {View} from 'react-native' import { atoms as a, - flatten, type TextStyleProp, useTheme, type ViewStyleProp, @@ -33,17 +32,9 @@ width: size === 'lg' ? 52 : 64, height: size === 'lg' ? 52 : 64, backgroundColor: t.palette.primary_50, }, - flatten(style), + style, ]}> - + ) } diff --git a/src/components/LabelingServiceCard/index.tsx b/src/components/LabelingServiceCard/index.tsx --- a/src/components/LabelingServiceCard/index.tsx +++ b/src/components/LabelingServiceCard/index.tsx @@ -55,7 +55,7 @@ export function Description({value, handle}: {value?: string; handle: string}) { const {_} = useLingui() return value ? ( - + ) : ( diff --git a/src/components/Link.tsx b/src/components/Link.tsx --- a/src/components/Link.tsx +++ b/src/components/Link.tsx @@ -296,7 +296,7 @@ return ( ) { return ( + style={[a.pb_sm, a.text_4xl, a.font_semi_bold, a.leading_tight, style]}> {children} ) @@ -245,7 +238,5 @@ children, style, }: React.PropsWithChildren) { const t = useTheme() - return ( -

{children}

- ) + return

{children}

} diff --git a/src/screens/Profile/components/ProfileFeedHeader.tsx b/src/screens/Profile/components/ProfileFeedHeader.tsx --- a/src/screens/Profile/components/ProfileFeedHeader.tsx +++ b/src/screens/Profile/components/ProfileFeedHeader.tsx @@ -481,7 +481,7 @@ - + {typeof likeCount === 'number' && ( diff --git a/src/screens/ProfileList/components/Header.tsx b/src/screens/ProfileList/components/Header.tsx --- a/src/screens/ProfileList/components/Header.tsx +++ b/src/screens/ProfileList/components/Header.tsx @@ -200,7 +200,7 @@ {descriptionRT ? ( - + ) : null} diff --git a/src/screens/StarterPack/StarterPackScreen.tsx b/src/screens/StarterPack/StarterPackScreen.tsx --- a/src/screens/StarterPack/StarterPackScreen.tsx +++ b/src/screens/StarterPack/StarterPackScreen.tsx @@ -458,9 +458,7 @@ ) : null} {!hasSession || richText || joinedAllTimeCount >= 25 ? ( - {richText ? ( - - ) : null} + {richText ? : null} {!hasSession ? (