Bluesky app fork with some witchin' additions 💫

Refactor GrowthHack to always render on iOS with enabled prop (#9723)

Drill down an `enabled` prop to ThreadItemAnchorFollowButtonInner so
that the GrowthHack wrapper is always rendered on iOS, even when the
follow button shouldn't be displayed. The inner component returns null
when disabled, allowing GrowthHack to render its logo without children.

Co-authored-by: Claude <noreply@anthropic.com>

authored by samuel.fm

Claude and committed by
GitHub
6534630d 25a1ed12

+23 -10
+6 -5
src/screens/PostThread/components/ThreadItemAnchor.tsx
··· 381 381 </ProfileHoverCard> 382 382 </View> 383 383 </Link> 384 - {showFollowButton && ( 385 - <View collapsable={false} style={[a.self_center]}> 386 - <ThreadItemAnchorFollowButton did={post.author.did} /> 387 - </View> 388 - )} 384 + <View collapsable={false} style={[a.self_center]}> 385 + <ThreadItemAnchorFollowButton 386 + did={post.author.did} 387 + enabled={showFollowButton} 388 + /> 389 + </View> 389 390 </View> 390 391 <View style={[a.pb_sm]}> 391 392 <LabelsOnMyPost post={post} style={[a.pb_sm]} />
+17 -5
src/screens/PostThread/components/ThreadItemAnchorFollowButton.tsx
··· 19 19 import {IS_IOS} from '#/env' 20 20 import {GrowthHack} from './GrowthHack' 21 21 22 - export function ThreadItemAnchorFollowButton({did}: {did: string}) { 22 + export function ThreadItemAnchorFollowButton({ 23 + did, 24 + enabled = true, 25 + }: { 26 + did: string 27 + enabled?: boolean 28 + }) { 23 29 if (IS_IOS) { 24 30 return ( 25 31 <GrowthHack> 26 - <ThreadItemAnchorFollowButtonInner did={did} /> 32 + <ThreadItemAnchorFollowButtonInner did={did} enabled={enabled} /> 27 33 </GrowthHack> 28 34 ) 29 35 } 30 36 31 - return <ThreadItemAnchorFollowButtonInner did={did} /> 37 + return <ThreadItemAnchorFollowButtonInner did={did} enabled={enabled} /> 32 38 } 33 39 34 - export function ThreadItemAnchorFollowButtonInner({did}: {did: string}) { 40 + export function ThreadItemAnchorFollowButtonInner({ 41 + did, 42 + enabled = true, 43 + }: { 44 + did: string 45 + enabled?: boolean 46 + }) { 35 47 const {data: profile, isLoading} = useProfileQuery({did}) 36 48 37 49 // We will never hit this - the profile will always be cached or loaded above 38 50 // but it keeps the typechecker happy 39 - if (isLoading || !profile) return null 51 + if (!enabled || isLoading || !profile) return null 40 52 41 53 return <PostThreadFollowBtnLoaded profile={profile} /> 42 54 }