@@ -7,6 +7,7 @@ import { SafeAreaView } from "react-native-safe-area-context";
77import { SymbolView } from "../../components/AppSymbol" ;
88import { AppText as Text } from "../../components/AppText" ;
99import { SegmentedControl } from "../../components/SegmentedControl" ;
10+ import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider" ;
1011import { PullRequestThreadCard } from "./PullRequestCommentCard" ;
1112import { PullRequestMarkdown } from "./PullRequestMarkdown" ;
1213import {
@@ -27,6 +28,7 @@ export function PullRequestCommentsSheet({
2728 onClose : ( ) => void ;
2829} ) {
2930 const navigation = useNavigation ( ) ;
31+ const { themeVariables : colors } = useAppearancePreferences ( ) ;
3032 const draft = usePullRequestReviewDraft ( params ) ;
3133 const [ status , setStatus ] = useState < "resolved" | "unresolved" | "pending" > ( "unresolved" ) ;
3234 // Threads come from the optimistic activity projection, so a resolve moves its card between
@@ -42,8 +44,16 @@ export function PullRequestCommentsSheet({
4244 selectedStatus === "resolved" ? resolved : selectedStatus === "unresolved" ? unresolved : [ ] ;
4345 const pending = selectedStatus === "pending" ? draft . comments : [ ] ;
4446 const options = [
45- { value : "unresolved" as const , label : "Unresolved" , badge : unresolved . length } ,
46- { value : "resolved" as const , label : "Resolved" , badge : resolved . length } ,
47+ {
48+ value : "unresolved" as const ,
49+ label : "Unresolved" ,
50+ ...( draft . activityLoaded ? { badge : unresolved . length } : { } ) ,
51+ } ,
52+ {
53+ value : "resolved" as const ,
54+ label : "Resolved" ,
55+ ...( draft . activityLoaded ? { badge : resolved . length } : { } ) ,
56+ } ,
4757 ...( draft . comments . length
4858 ? [ { value : "pending" as const , label : "Pending" , badge : draft . comments . length } ]
4959 : [ ] ) ,
@@ -55,12 +65,17 @@ export function PullRequestCommentsSheet({
5565 presentationStyle = "pageSheet"
5666 onRequestClose = { onClose }
5767 >
58- < SafeAreaView className = "flex-1 bg-screen" >
68+ { /* SafeAreaView forwards className to a native view without Uniwind styling. */ }
69+ < SafeAreaView style = { { flex : 1 , backgroundColor : colors [ "--color-screen" ] } } >
5970 < View className = "flex-row items-center gap-3 px-4 pt-4 pb-1" >
6071 < View className = "min-w-0 flex-1" >
6172 < Text className = "text-base font-t3-bold" > Comments</ Text >
6273 < Text className = "text-2xs text-foreground-muted" numberOfLines = { 1 } >
63- { counts . open } open · { counts . resolved } resolved
74+ { draft . activityLoaded
75+ ? `${ counts . open } open · ${ counts . resolved } resolved`
76+ : draft . activityError
77+ ? "Could not load comments"
78+ : "Loading comments…" }
6479 { draft . comments . length ? ` · ${ draft . comments . length } pending` : "" }
6580 </ Text >
6681 </ View >
@@ -84,8 +99,9 @@ export function PullRequestCommentsSheet({
8499 />
85100 </ View >
86101 { /* Replies are written inside the cards, so the list must clear the keyboard. */ }
87- < KeyboardAvoidingView automaticOffset behavior = "padding" className = " flex-1" >
102+ < KeyboardAvoidingView automaticOffset behavior = "padding" style = { { flex : 1 } } >
88103 < ScrollView
104+ style = { { flex : 1 } }
89105 keyboardShouldPersistTaps = "handled"
90106 contentContainerStyle = { { padding : 12 , gap : 8 } }
91107 >
@@ -130,7 +146,25 @@ export function PullRequestCommentsSheet({
130146 onBeforeNavigate = { onClose }
131147 />
132148 ) ) }
133- { ! threads . length && ! pending . length ? (
149+ { draft . activityError ? (
150+ < View className = "gap-2" >
151+ < Text accessibilityRole = "alert" className = "text-sm text-danger-foreground" >
152+ { draft . activityError }
153+ </ Text >
154+ < Pressable
155+ accessibilityRole = "button"
156+ onPress = { draft . refreshActivity }
157+ className = "min-h-11 justify-center active:opacity-70"
158+ >
159+ < Text className = "text-sm font-t3-medium" > Try again</ Text >
160+ </ Pressable >
161+ </ View >
162+ ) : ! draft . activityLoaded && selectedStatus !== "pending" ? (
163+ < Text accessibilityLiveRegion = "polite" className = "text-sm text-foreground-muted" >
164+ Loading comments…
165+ </ Text >
166+ ) : null }
167+ { draft . activityLoaded && ! draft . activityError && ! threads . length && ! pending . length ? (
134168 < Text className = "text-sm text-foreground-muted" >
135169 { selectedStatus === "resolved"
136170 ? "No resolved comments."
0 commit comments