Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion apps/mobile/src/features/review/ReviewSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,16 @@ export function ReviewSheet(props: ReviewSheetProps) {
await refreshSelectedSection();
setIsPullRefreshing(false);
};
const isRefreshing = isPullRefreshing || isSelectedSectionPending || areFilePatchesPending;
// A refresh that starts programmatically adds its height to the native top inset and
// subtracts it when it ends. If topContentInset changes in between, the inset ends up
// short and the content sits under the header, so the fallback ScrollView starts over.
const [fallbackInset, setFallbackInset] = useState(topContentInset);
const [fallbackScrollViewKey, setFallbackScrollViewKey] = useState(0);
if (fallbackInset !== topContentInset) {
setFallbackInset(topContentInset);
if (isRefreshing) setFallbackScrollViewKey((key) => key + 1);
}
const reviewFileNavigatorRef = useRef<ReviewFileNavigatorHandle>(null);
const reviewFiles = parsedDiff.kind === "files" ? parsedDiff.files : [];
const fileVisibility = useReviewFileVisibility({
Expand Down Expand Up @@ -766,6 +776,7 @@ export function ReviewSheet(props: ReviewSheetProps) {
</View>
) : (
<ScrollView
key={fallbackScrollViewKey}
contentContainerStyle={
Platform.OS === "android" && (parsedDiff.kind === "empty" || !selectedSection)
? { flexGrow: 1, justifyContent: "center" }
Expand All @@ -784,7 +795,7 @@ export function ReviewSheet(props: ReviewSheetProps) {
// iOS has no other refresh affordance here (the explicit
// "Refresh current diff" menu is Android-only).
<RefreshControl
refreshing={isPullRefreshing || isSelectedSectionPending || areFilePatchesPending}
refreshing={isRefreshing}
onRefresh={() => void handlePullToRefresh()}
/>
}
Expand Down
Loading