Skip to content

Commit 44620fc

Browse files
committed
refactor: Replace FlatList with View for branches tab rendering
Replaced FlatList component with a simple View and map iteration for rendering repository branches. This change simplifies the implementation by removing the need for FlatList-specific props like keyExtractor, onEndReached, and ListFooterComponent while maintaining the same functionality. The branches are now rendered using a standard map operation with proper key props for each branch item.
1 parent b56f3ec commit 44620fc

5 files changed

Lines changed: 92 additions & 72 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
## [0.0.11](https://github.com/involvex/awesome-github-app/compare/0.0.10...0.0.11) (2026-03-09)
2+
13
## [0.0.10](https://github.com/involvex/awesome-github-app/compare/0.0.9...0.0.10) (2026-03-09)
24

35
### Features
46

5-
- add infinite scroll pagination and notification support ([a7557fc](https://github.com/involvex/awesome-github-app/commit/a7557fc8fdb4e39e2ad034baab151da3453ab64d))
7+
- add infinite scroll pagination and notification support ([b56f3ec](https://github.com/involvex/awesome-github-app/commit/b56f3ec78efdee1d6fe573621a41c8e1daef39f2))
68

79
## [0.0.9](https://github.com/involvex/awesome-github-app/compare/0.0.8...0.0.9) (2026-03-09)
810

android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ android {
9292
applicationId 'com.involvex.awesomegithubapp'
9393
minSdkVersion rootProject.ext.minSdkVersion
9494
targetSdkVersion rootProject.ext.targetSdkVersion
95-
versionCode 10
96-
versionName "0.0.10"
95+
versionCode 11
96+
versionName "0.0.11"
9797

9898
buildConfigField "String", "REACT_NATIVE_RELEASE_LEVEL", "\"${findProperty('reactNativeReleaseLevel') ?: 'stable'}\""
9999
}

app.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "awesome-github-app",
44
"slug": "awesome-github-app",
55
"owner": "involvex",
6-
"version": "0.0.10",
6+
"version": "0.0.11",
77
"orientation": "portrait",
88
"userInterfaceStyle": "automatic",
99
"githubUrl": "https://github.com/involvex/awesome-github-app.git",
@@ -28,7 +28,7 @@
2828
"backgroundColor": "#ffffff"
2929
},
3030
"userInterfaceStyle": "automatic",
31-
"versionCode": 10
31+
"versionCode": 11
3232
},
3333
"web": {
3434
"output": "single",
@@ -37,7 +37,7 @@
3737
},
3838
"ios": {
3939
"bundleIdentifier": "com.involvex.awesomegithubapp",
40-
"buildNumber": "10",
40+
"buildNumber": "11",
4141
"infoPlist": {
4242
"ITSAppUsesNonExemptEncryption": false
4343
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "awesome-github-app",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"private": true,
55
"keywords": [
66
"github",

src/app/repo/[owner]/[repo]/index.tsx

Lines changed: 83 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1+
import {
2+
useRepo,
3+
useRepoTopics,
4+
useRepoReadme,
5+
useRepoContents,
6+
useCreateFork,
7+
useBranches,
8+
} from "../../../../lib/api/hooks";
19
import {
210
ActivityIndicator,
3-
FlatList,
411
Linking,
512
Pressable,
613
ScrollView,
@@ -9,14 +16,6 @@ import {
916
Text,
1017
View,
1118
} from "react-native";
12-
import {
13-
useRepo,
14-
useRepoTopics,
15-
useRepoReadme,
16-
useRepoContents,
17-
useCreateFork,
18-
useBranches,
19-
} from "../../../../lib/api/hooks";
2019
import { LanguageDot } from "../../../../components/ui/LanguageDot";
2120
import { Markdown } from "../../../../components/ui/Markdown";
2221
import { useLocalSearchParams, useRouter } from "expo-router";
@@ -319,23 +318,8 @@ function BranchesTab({ owner, repo }: { owner: string; repo: string }) {
319318
}
320319

321320
return (
322-
<FlatList
323-
data={branches}
324-
keyExtractor={item => item.name}
325-
contentContainerStyle={styles.tabContent}
326-
onEndReached={() => {
327-
if (hasNextPage && !isFetchingNextPage) fetchNextPage();
328-
}}
329-
onEndReachedThreshold={0.3}
330-
ListFooterComponent={
331-
isFetchingNextPage ? (
332-
<ActivityIndicator
333-
style={{ paddingVertical: 16 }}
334-
color={theme.primary}
335-
/>
336-
) : null
337-
}
338-
ListEmptyComponent={
321+
<View style={styles.tabContent}>
322+
{branches.length === 0 ? (
339323
<View style={styles.emptyState}>
340324
<Ionicons
341325
name="git-branch-outline"
@@ -346,50 +330,73 @@ function BranchesTab({ owner, repo }: { owner: string; repo: string }) {
346330
No branches
347331
</Text>
348332
</View>
349-
}
350-
renderItem={({ item }) => (
351-
<View
352-
style={[
353-
styles.branchRow,
354-
{ backgroundColor: theme.surface, borderColor: theme.border },
355-
]}
356-
>
357-
<Ionicons
358-
name="git-branch-outline"
359-
size={16}
360-
color={theme.muted}
361-
/>
362-
<Text
363-
style={[styles.branchName, { color: theme.text }]}
364-
numberOfLines={1}
333+
) : (
334+
branches.map(item => (
335+
<View
336+
key={item.name}
337+
style={[
338+
styles.branchRow,
339+
{ backgroundColor: theme.surface, borderColor: theme.border },
340+
]}
365341
>
366-
{item.name}
367-
</Text>
368-
{item.name === defaultBranch && (
369-
<View
370-
style={[
371-
styles.branchBadge,
372-
{
373-
backgroundColor: theme.primary + "20",
374-
borderColor: theme.primary,
375-
},
376-
]}
377-
>
378-
<Text style={[styles.branchBadgeText, { color: theme.primary }]}>
379-
default
380-
</Text>
381-
</View>
382-
)}
383-
{item.protected && (
384342
<Ionicons
385-
name="lock-closed-outline"
386-
size={14}
343+
name="git-branch-outline"
344+
size={16}
387345
color={theme.muted}
388346
/>
389-
)}
390-
</View>
347+
<Text
348+
style={[styles.branchName, { color: theme.text }]}
349+
numberOfLines={1}
350+
>
351+
{item.name}
352+
</Text>
353+
{item.name === defaultBranch && (
354+
<View
355+
style={[
356+
styles.branchBadge,
357+
{
358+
backgroundColor: theme.primary + "20",
359+
borderColor: theme.primary,
360+
},
361+
]}
362+
>
363+
<Text
364+
style={[styles.branchBadgeText, { color: theme.primary }]}
365+
>
366+
default
367+
</Text>
368+
</View>
369+
)}
370+
{item.protected && (
371+
<Ionicons
372+
name="lock-closed-outline"
373+
size={14}
374+
color={theme.muted}
375+
/>
376+
)}
377+
</View>
378+
))
379+
)}
380+
{isFetchingNextPage && (
381+
<ActivityIndicator
382+
style={{ paddingVertical: 16 }}
383+
color={theme.primary}
384+
/>
385+
)}
386+
{hasNextPage && !isFetchingNextPage && (
387+
<Pressable
388+
style={[
389+
styles.loadMoreBtn,
390+
{ borderColor: theme.border, backgroundColor: theme.surface },
391+
]}
392+
onPress={() => fetchNextPage()}
393+
>
394+
<Text style={[styles.loadMoreText, { color: theme.primary }]}>
395+
Load more
396+
</Text>
397+
</Pressable>
391398
)}
392-
/>
399+
</View>
393400
);
394401
}
395402

@@ -921,6 +928,17 @@ const styles = StyleSheet.create({
921928
fontSize: 11,
922929
fontWeight: "600",
923930
},
931+
loadMoreBtn: {
932+
alignItems: "center",
933+
paddingVertical: 12,
934+
marginTop: 8,
935+
borderRadius: 8,
936+
borderWidth: StyleSheet.hairlineWidth,
937+
},
938+
loadMoreText: {
939+
fontSize: 14,
940+
fontWeight: "500",
941+
},
924942
breadcrumb: { marginBottom: 8 },
925943
breadcrumbContent: { flexDirection: "row", alignItems: "center" },
926944
breadcrumbItem: { flexDirection: "row", alignItems: "center" },

0 commit comments

Comments
 (0)