+4
-17
src/components/dialogs/StarterPackDialog.tsx
+4
-17
src/components/dialogs/StarterPackDialog.tsx
···
78
78
<Dialog.Outer control={control}>
79
79
<Dialog.Handle />
80
80
<StarterPackList
81
-
control={control}
82
81
onStartWizard={wrappedNavToWizard}
83
82
targetDid={targetDid}
84
83
enabled={enabled}
···
122
121
}
123
122
124
123
function StarterPackList({
125
-
control,
126
124
onStartWizard,
127
125
targetDid,
128
126
enabled,
129
127
}: {
130
-
control: Dialog.DialogControlProps
131
128
onStartWizard: () => void
132
129
targetDid: string
133
130
enabled?: boolean
134
131
}) {
132
+
const control = Dialog.useDialogContext()
135
133
const {_} = useLingui()
136
134
137
135
const {
138
136
data,
139
-
refetch,
140
137
isError,
141
138
isLoading,
142
139
hasNextPage,
···
147
144
const membershipItems =
148
145
data?.pages.flatMap(page => page.starterPacksWithMembership) || []
149
146
150
-
const _onRefresh = useCallback(async () => {
151
-
try {
152
-
await refetch()
153
-
} catch (err) {
154
-
// Error handling is optional since this is just a refresh
155
-
}
156
-
}, [refetch])
157
-
158
-
const _onEndReached = useCallback(async () => {
147
+
const onEndReached = useCallback(async () => {
159
148
if (isFetchingNextPage || !hasNextPage || isError) return
160
149
try {
161
150
await fetchNextPage()
···
239
228
? () => 'starter_pack_dialog_loader'
240
229
: (item: StarterPackWithMembership) => item.starterPack.uri
241
230
}
242
-
refreshing={false}
243
-
onRefresh={_onRefresh}
244
-
onEndReached={_onEndReached}
231
+
onEndReached={onEndReached}
245
232
onEndReachedThreshold={0.1}
246
233
ListHeaderComponent={listHeader}
247
234
ListEmptyComponent={<Empty onStartWizard={onStartWizard} />}
···
382
369
383
370
<Button
384
371
label={isInPack ? _(msg`Remove`) : _(msg`Add`)}
385
-
color={isInPack ? 'secondary' : 'primary'}
372
+
color={isInPack ? 'secondary' : 'primary_subtle'}
386
373
size="tiny"
387
374
disabled={isPendingRefresh}
388
375
onPress={handleToggleMembership}>