Skip to content

Commit 25d82da

Browse files
refactor(mobile): git sheets use uniwind platform variants instead of className ternaries
Re-lands ec28eef, which was reverted by #13169 because Uniwind 1.11.0 dropped the platform guard past the first utility of each @media ios/ android block. That compiler bug is fixed by the patched pipeline on this stack (uniwind media-query fix + compiled-output tests + real-bundle verification). Styling divergence moves from Platform.OS ternaries over className strings to ios:/android: class variants; behavior branching stays in JS.
1 parent 343aa08 commit 25d82da

5 files changed

Lines changed: 57 additions & 222 deletions

File tree

‎apps/mobile/src/features/threads/git/GitBranchesSheet.tsx‎

Lines changed: 18 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export function GitBranchesSheet(_props: GitBranchesSheetProps) {
6363
return (
6464
<View
6565
collapsable={false}
66-
className={Platform.OS === "android" ? "bg-sheet" : "flex-1 bg-sheet"}
66+
className="bg-sheet ios:flex-1"
6767
style={Platform.OS === "android" ? { maxHeight: windowHeight * 0.92 } : undefined}
6868
>
6969
{Platform.OS === "android" ? (
@@ -83,39 +83,27 @@ export function GitBranchesSheet(_props: GitBranchesSheetProps) {
8383
) : null}
8484
<MaterialScreenContent fitToContents>
8585
<ScrollView
86-
className={Platform.OS === "android" ? "shrink grow-0" : "flex-1"}
86+
className="android:shrink android:grow-0 ios:flex-1"
8787
keyboardShouldPersistTaps="handled"
8888
showsVerticalScrollIndicator={false}
8989
contentInset={{ bottom: Math.max(insets.bottom, 18) + 18 }}
90-
contentContainerClassName={Platform.OS === "android" ? "gap-2 p-2" : "gap-4 px-5 pt-2"}
90+
contentContainerClassName="android:gap-2 android:p-2 ios:gap-4 ios:px-5 ios:pt-2"
9191
contentContainerStyle={
9292
Platform.OS === "android"
9393
? { paddingBottom: Math.max(insets.bottom, 18) + 18 }
9494
: undefined
9595
}
9696
>
97-
<View
98-
className={
99-
Platform.OS === "android"
100-
? "gap-3 rounded-[20px] bg-card p-4"
101-
: "gap-2 rounded-[18px] border border-border bg-card px-4 py-4"
102-
}
103-
>
104-
<Text
105-
className={
106-
Platform.OS === "android"
107-
? "text-foreground text-base font-t3-medium"
108-
: "text-foreground-secondary text-2xs font-t3-bold tracking-[1px] uppercase"
109-
}
110-
>
97+
<View className="bg-card android:gap-3 android:rounded-[20px] android:p-4 ios:gap-2 ios:rounded-[18px] ios:border ios:border-border ios:px-4 ios:py-4">
98+
<Text className="android:text-foreground android:text-base android:font-t3-medium ios:text-foreground-secondary ios:text-2xs ios:font-t3-bold ios:tracking-[1px] ios:uppercase">
11199
New branch
112100
</Text>
113101
<TextInput
114102
value={newBranchName}
115103
onChangeText={setNewBranchName}
116104
placeholder="feature/mobile-polish"
117105
accessibilityLabel="New branch name"
118-
className={Platform.OS === "android" ? "rounded-xl bg-sheet-solid" : "rounded-[18px]"}
106+
className="android:rounded-xl android:bg-sheet-solid ios:rounded-[18px]"
119107
/>
120108
<SheetActionButton
121109
icon="plus"
@@ -133,20 +121,8 @@ export function GitBranchesSheet(_props: GitBranchesSheetProps) {
133121
/>
134122
</View>
135123

136-
<View
137-
className={
138-
Platform.OS === "android"
139-
? "gap-3 rounded-[20px] bg-card p-4"
140-
: "gap-2 rounded-[18px] border border-border bg-card px-4 py-4"
141-
}
142-
>
143-
<Text
144-
className={
145-
Platform.OS === "android"
146-
? "text-foreground text-base font-t3-medium"
147-
: "text-foreground-secondary text-2xs font-t3-bold tracking-[1px] uppercase"
148-
}
149-
>
124+
<View className="bg-card android:gap-3 android:rounded-[20px] android:p-4 ios:gap-2 ios:rounded-[18px] ios:border ios:border-border ios:px-4 ios:py-4">
125+
<Text className="android:text-foreground android:text-base android:font-t3-medium ios:text-foreground-secondary ios:text-2xs ios:font-t3-bold ios:tracking-[1px] ios:uppercase">
150126
New worktree
151127
</Text>
152128
{Platform.OS === "android" ? (
@@ -157,7 +133,7 @@ export function GitBranchesSheet(_props: GitBranchesSheetProps) {
157133
onChangeText={setWorktreeBaseBranch}
158134
placeholder="main"
159135
accessibilityLabel="Worktree base branch"
160-
className={Platform.OS === "android" ? "rounded-xl bg-sheet-solid" : "rounded-[18px]"}
136+
className="android:rounded-xl android:bg-sheet-solid ios:rounded-[18px]"
161137
/>
162138
{Platform.OS === "android" ? (
163139
<Text className="text-foreground-secondary text-sm">New branch</Text>
@@ -167,7 +143,7 @@ export function GitBranchesSheet(_props: GitBranchesSheetProps) {
167143
onChangeText={setWorktreeBranchName}
168144
placeholder="feature/mobile-thread"
169145
accessibilityLabel="Worktree branch name"
170-
className={Platform.OS === "android" ? "rounded-xl bg-sheet-solid" : "rounded-[18px]"}
146+
className="android:rounded-xl android:bg-sheet-solid ios:rounded-[18px]"
171147
/>
172148
<SheetActionButton
173149
icon="square.split.2x1"
@@ -193,32 +169,16 @@ export function GitBranchesSheet(_props: GitBranchesSheetProps) {
193169
</View>
194170

195171
<View className="gap-2">
196-
<Text
197-
className={
198-
Platform.OS === "android"
199-
? "px-4 pb-1 pt-3 text-foreground-secondary text-sm font-t3-medium"
200-
: "text-foreground-secondary text-2xs font-t3-bold tracking-[1px] uppercase"
201-
}
202-
>
172+
<Text className="text-foreground-secondary android:px-4 android:pb-1 android:pt-3 android:text-sm android:font-t3-medium ios:text-2xs ios:font-t3-bold ios:tracking-[1px] ios:uppercase">
203173
Existing branches
204174
</Text>
205175
{branchesLoading ? (
206-
<Text
207-
className={cn(
208-
"text-foreground-secondary text-sm font-medium",
209-
Platform.OS === "android" && "px-4",
210-
)}
211-
>
176+
<Text className="text-foreground-secondary text-sm font-medium android:px-4">
212177
Loading branches...
213178
</Text>
214179
) : null}
215180
{!branchesLoading && availableBranches.length === 0 ? (
216-
<Text
217-
className={cn(
218-
"text-foreground-secondary text-sm font-medium",
219-
Platform.OS === "android" && "px-4",
220-
)}
221-
>
181+
<Text className="text-foreground-secondary text-sm font-medium android:px-4">
222182
No local branches found.
223183
</Text>
224184
) : null}
@@ -236,16 +196,10 @@ export function GitBranchesSheet(_props: GitBranchesSheetProps) {
236196
<Pressable
237197
key={branch.name}
238198
className={cn(
239-
"gap-1 px-4 py-3 disabled:opacity-[0.45]",
240-
Platform.OS === "android"
241-
? cn(
242-
"rounded-[20px] active:bg-subtle",
243-
branch.current ? "bg-secondary" : "bg-card",
244-
)
245-
: cn(
246-
"rounded-[18px] border",
247-
branch.current ? "border-subtle-strong" : "border-border",
248-
),
199+
"gap-1 px-4 py-3 disabled:opacity-[0.45] android:rounded-[20px] android:active:bg-subtle ios:rounded-[18px] ios:border",
200+
branch.current
201+
? "android:bg-secondary ios:border-subtle-strong"
202+
: "android:bg-card ios:border-border",
249203
)}
250204
accessibilityRole="button"
251205
accessibilityState={{ selected: branch.current, disabled: busy || disabled }}
@@ -259,12 +213,7 @@ export function GitBranchesSheet(_props: GitBranchesSheetProps) {
259213
{Platform.OS !== "android" ? (
260214
<View className="absolute inset-0 rounded-[18px] bg-card" />
261215
) : null}
262-
<Text
263-
className={cn(
264-
"text-foreground text-base",
265-
Platform.OS === "android" ? "font-t3-medium" : "font-t3-bold",
266-
)}
267-
>
216+
<Text className="text-foreground text-base android:font-t3-medium ios:font-t3-bold">
268217
{branch.name}
269218
</Text>
270219
<Text className="text-foreground-secondary text-xs font-medium">{subtitle}</Text>

‎apps/mobile/src/features/threads/git/GitCommitSheet.tsx‎

Lines changed: 22 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {
7272
return (
7373
<View
7474
collapsable={false}
75-
className={Platform.OS === "android" ? "bg-sheet" : "flex-1 bg-sheet"}
75+
className="bg-sheet ios:flex-1"
7676
style={Platform.OS === "android" ? { maxHeight: windowHeight * 0.92 } : undefined}
7777
>
7878
{Platform.OS === "android" ? (
@@ -92,35 +92,21 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {
9292
) : null}
9393
<MaterialScreenContent fitToContents>
9494
<ScrollView
95-
className={Platform.OS === "android" ? "shrink grow-0" : "flex-1"}
95+
className="android:shrink android:grow-0 ios:flex-1"
9696
keyboardShouldPersistTaps="handled"
9797
showsVerticalScrollIndicator={false}
9898
contentInset={{ bottom: Math.max(insets.bottom, 18) + 18 }}
99-
contentContainerClassName={Platform.OS === "android" ? "gap-2 p-2" : "gap-4 px-5 pt-2"}
99+
contentContainerClassName="android:gap-2 android:p-2 ios:gap-4 ios:px-5 ios:pt-2"
100100
contentContainerStyle={
101101
Platform.OS === "android"
102102
? { paddingBottom: Math.max(insets.bottom, 18) + 18 }
103103
: undefined
104104
}
105105
>
106-
<View
107-
className={cn(
108-
"gap-3 bg-card p-4",
109-
Platform.OS === "android" ? "rounded-[20px]" : "rounded-[22px] border border-border",
110-
)}
111-
>
112-
<View
113-
className={
114-
Platform.OS === "android" ? "gap-1" : "flex-row items-center justify-between gap-3"
115-
}
116-
>
106+
<View className="gap-3 bg-card p-4 android:rounded-[20px] ios:rounded-[22px] ios:border ios:border-border">
107+
<View className="android:gap-1 ios:flex-row ios:items-center ios:justify-between ios:gap-3">
117108
<Text className="text-foreground-muted text-sm font-medium">Branch</Text>
118-
<Text
119-
className={cn(
120-
"text-foreground text-base",
121-
Platform.OS === "android" ? "font-t3-medium" : "font-t3-bold",
122-
)}
123-
>
109+
<Text className="text-foreground text-base android:font-t3-medium ios:font-t3-bold">
124110
{gitStatus.data?.refName ?? "(detached HEAD)"}
125111
</Text>
126112
</View>
@@ -131,20 +117,10 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {
131117
) : null}
132118
</View>
133119

134-
<View
135-
className={cn(
136-
"gap-3 bg-card p-4",
137-
Platform.OS === "android" ? "rounded-[20px]" : "rounded-[22px] border border-border",
138-
)}
139-
>
120+
<View className="gap-3 bg-card p-4 android:rounded-[20px] ios:rounded-[22px] ios:border ios:border-border">
140121
<View className="flex-row items-center justify-between gap-3">
141122
<View className="gap-1">
142-
<Text
143-
className={cn(
144-
"text-foreground text-base",
145-
Platform.OS === "android" ? "font-t3-medium" : "font-t3-bold",
146-
)}
147-
>
123+
<Text className="text-foreground text-base android:font-t3-medium ios:font-t3-bold">
148124
Files
149125
</Text>
150126
<Text className="text-foreground-muted text-xs leading-normal">
@@ -154,39 +130,19 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {
154130
<View className="flex-row items-center gap-2">
155131
{!allSelected && isEditingFiles ? (
156132
<Pressable
157-
className={
158-
Platform.OS === "android"
159-
? "min-h-12 justify-center rounded-full px-3 active:bg-subtle"
160-
: "bg-subtle rounded-full px-3 py-2"
161-
}
133+
className="rounded-full px-3 android:min-h-12 android:justify-center android:active:bg-subtle ios:bg-subtle ios:py-2"
162134
onPress={() => setExcludedFiles(new Set())}
163135
>
164-
<Text
165-
className={
166-
Platform.OS === "android"
167-
? "text-primary-text text-sm font-t3-medium"
168-
: "text-foreground text-2xs font-t3-bold uppercase"
169-
}
170-
>
136+
<Text className="android:text-primary-text android:text-sm android:font-t3-medium ios:text-foreground ios:text-2xs ios:font-t3-bold ios:uppercase">
171137
Reset
172138
</Text>
173139
</Pressable>
174140
) : null}
175141
<Pressable
176-
className={
177-
Platform.OS === "android"
178-
? "min-h-12 justify-center rounded-full px-3 active:bg-subtle"
179-
: "bg-subtle rounded-full px-3 py-2"
180-
}
142+
className="rounded-full px-3 android:min-h-12 android:justify-center android:active:bg-subtle ios:bg-subtle ios:py-2"
181143
onPress={() => setIsEditingFiles((current) => !current)}
182144
>
183-
<Text
184-
className={
185-
Platform.OS === "android"
186-
? "text-primary-text text-sm font-t3-medium"
187-
: "text-foreground text-2xs font-t3-bold uppercase"
188-
}
189-
>
145+
<Text className="android:text-primary-text android:text-sm android:font-t3-medium ios:text-foreground ios:text-2xs ios:font-t3-bold ios:uppercase">
190146
{isEditingFiles ? "Done" : "Edit"}
191147
</Text>
192148
</Pressable>
@@ -226,15 +182,10 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {
226182
<Pressable
227183
key={file.path}
228184
className={cn(
229-
"px-4 py-3",
230-
Platform.OS === "android"
231-
? included
232-
? "rounded-xl bg-subtle"
233-
: "rounded-xl"
234-
: cn(
235-
"rounded-[18px] border",
236-
included ? "border-border" : "border-border-subtle",
237-
),
185+
"px-4 py-3 android:rounded-xl ios:rounded-[18px] ios:border",
186+
included
187+
? "android:bg-subtle ios:border-border"
188+
: "ios:border-border-subtle",
238189
)}
239190
accessibilityRole="checkbox"
240191
accessibilityLabel={file.path}
@@ -303,16 +254,8 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {
303254
)}
304255
</View>
305256

306-
<View
307-
className={Platform.OS === "android" ? "gap-3 rounded-[20px] bg-card p-4" : "gap-2"}
308-
>
309-
<Text
310-
className={
311-
Platform.OS === "android"
312-
? "text-foreground text-base font-t3-medium"
313-
: "text-foreground text-sm font-t3-bold"
314-
}
315-
>
257+
<View className="android:gap-3 android:rounded-[20px] android:bg-card android:p-4 ios:gap-2">
258+
<Text className="text-foreground android:text-base android:font-t3-medium ios:text-sm ios:font-t3-bold">
316259
Commit message
317260
</Text>
318261
<TextInput
@@ -322,23 +265,20 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {
322265
onChangeText={setDialogCommitMessage}
323266
placeholder="Leave empty to auto-generate"
324267
textAlignVertical="top"
325-
className={cn(
326-
"min-h-[128px] px-4 py-3.5",
327-
Platform.OS === "android" ? "rounded-xl bg-sheet-solid" : "rounded-[20px]",
328-
)}
268+
className="min-h-[128px] px-4 py-3.5 android:rounded-xl android:bg-sheet-solid ios:rounded-[20px]"
329269
/>
330270
</View>
331271

332-
<View className={Platform.OS === "android" ? "gap-2" : "flex-row gap-3"}>
333-
<View className={Platform.OS === "android" ? undefined : "flex-1"}>
272+
<View className="android:gap-2 ios:flex-row ios:gap-3">
273+
<View className="ios:flex-1">
334274
<SheetActionButton
335275
icon="arrow.branch"
336276
label="Commit on new branch"
337277
disabled={noneSelected || busy}
338278
onPress={() => void runCommitAction(true)}
339279
/>
340280
</View>
341-
<View className={Platform.OS === "android" ? undefined : "flex-1"}>
281+
<View className="ios:flex-1">
342282
<SheetActionButton
343283
icon="checkmark.circle"
344284
label="Commit"

0 commit comments

Comments
 (0)