Skip to content
TypeScript

fix(mobile): Android commit sheet scrolls to the commit buttons (#28272)

shivam3d68b7a05d63
diff --git a/apps/mobile/src/features/threads/git/GitCommitSheet.tsx b/apps/mobile/src/features/threads/git/GitCommitSheet.tsx
index 68ea161b011..f833a2ec4ce 100644
--- a/apps/mobile/src/features/threads/git/GitCommitSheet.tsx
+++ b/apps/mobile/src/features/threads/git/GitCommitSheet.tsx
@@ -67,24 +67,31 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {
});
};
+ const android = Platform.OS === "android";
+ const header = (
+ <SheetHeader
+ presentation={android ? "inline" : "native"}
+ title="Commit changes"
+ subtitle={gitStatus.data?.refName ?? "(detached HEAD)"}
+ onCancel={() => navigation.goBack()}
+ accessibilityLabel="Cancel commit"
+ />
+ );
+
return (
+ // Material sheet drags follow the first nested-scrolling native view, and the inline
+ // header's Compose button is one, so Android renders content first and reverses the column.
<View
collapsable={false}
- className="bg-sheet ios:flex-1"
- style={Platform.OS === "android" ? { maxHeight: windowHeight * 0.92 } : undefined}
+ className="bg-sheet ios:flex-1 android:flex-col-reverse"
+ style={android ? { maxHeight: windowHeight * 0.92 } : undefined}
>
- {Platform.OS === "android" ? (
+ {android ? (
<NativeStackScreenOptions
options={{ sheetCornerRadius: 28, sheetAllowedDetents: "fitToContents" }}
/>
) : null}
- <SheetHeader
- presentation={Platform.OS === "android" ? "inline" : "native"}
- title="Commit changes"
- subtitle={gitStatus.data?.refName ?? "(detached HEAD)"}
- onCancel={() => navigation.goBack()}
- accessibilityLabel="Cancel commit"
- />
+ {android ? null : header}
<ScreenContent fitToContents>
<ScrollView
nestedScrollEnabled
@@ -228,6 +235,7 @@ export function GitCommitSheet(_props: GitCommitSheetProps) {
</View>
</ScrollView>
</ScreenContent>
+ {android ? header : null}
</View>
);
}