Skip to content

Commit

Permalink
[chore] Scrolling entire view
Browse files Browse the repository at this point in the history
  • Loading branch information
stackchain committed Dec 3, 2021
1 parent 046b2da commit 2e219d9
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 45 deletions.
88 changes: 46 additions & 42 deletions src/TxHistory/TxHistory.tsx
Expand Up @@ -52,51 +52,55 @@ const TxHistory = () => {
<StatusBar type="light" />

<View style={styles.container}>
<OfflineBanner />
<SyncErrorBanner showRefresh={!isSyncing} isOpen={isOnline && lastSyncError} />
<ScrollView
refreshControl={
<RefreshControl
onRefresh={() => dispatch(updateHistory())}
refreshing={isSyncing}
progressViewOffset={150}
/>
}
>
<OfflineBanner />
<SyncErrorBanner showRefresh={!isSyncing} isOpen={isOnline && lastSyncError} />

<WalletHero
render={(active) => {
if (active === 0) {
return (
<View style={styles.tabNavigatorRoot}>
{isByron(walletMeta.walletImplementationId) && showWarning && (
<WarningBanner
title={intl.formatMessage(warningBannerMessages.title).toUpperCase()}
icon={infoIcon}
message={intl.formatMessage(warningBannerMessages.message)}
showCloseIcon
onRequestClose={() => setShowWarning(false)}
style={styles.warningNoteStyles}
/>
)}
<WalletHero
render={(active) => {
if (active === 0) {
return (
<View style={styles.tabNavigatorRoot}>
{isByron(walletMeta.walletImplementationId) && showWarning && (
<WarningBanner
title={intl.formatMessage(warningBannerMessages.title).toUpperCase()}
icon={infoIcon}
message={intl.formatMessage(warningBannerMessages.message)}
showCloseIcon
onRequestClose={() => setShowWarning(false)}
style={styles.warningNoteStyles}
/>
)}

{_.isEmpty(transactionsInfo) ? (
<ScrollView
refreshControl={
<RefreshControl onRefresh={() => dispatch(updateHistory())} refreshing={isSyncing} />
}
>
{_.isEmpty(transactionsInfo) ? (
<EmptyHistory />
</ScrollView>
) : (
<TxHistoryList
refreshing={isSyncing}
onRefresh={() => dispatch(updateHistory())}
transactions={transactionsInfo}
/>
)}
</View>
)
} else if (active === 1) {
return (
<View style={styles.tabNavigatorRoot}>
<AssetList refreshing={isSyncing} onRefresh={() => dispatch(updateHistory())} />
</View>
)
}
}}
/>
) : (
<TxHistoryList
refreshing={isSyncing}
onRefresh={() => dispatch(updateHistory())}
transactions={transactionsInfo}
/>
)}
</View>
)
} else if (active === 1) {
return (
<View style={styles.tabNavigatorRoot}>
<AssetList refreshing={isSyncing} onRefresh={() => dispatch(updateHistory())} />
</View>
)
}
}}
/>
</ScrollView>
</View>
</SafeAreaView>
)
Expand Down
6 changes: 3 additions & 3 deletions src/TxHistory/TxHistoryList.tsx
Expand Up @@ -18,7 +18,7 @@ type Props = {
onRefresh: () => void
}

export const TxHistoryList = ({transactions, refreshing, onRefresh}: Props) => {
export const TxHistoryList = ({transactions, refreshing}: Props) => {
const strings = useStrings()
const navigation = useNavigation()
const groupedTransactions = getTransactionsByDate(transactions)
Expand All @@ -32,13 +32,13 @@ export const TxHistoryList = ({transactions, refreshing, onRefresh}: Props) => {
<TxListActionsBannerForTransactionsTab onExport={handleExport} onSearch={handleSearch} />
)}
<SectionList
onRefresh={onRefresh}
refreshing={refreshing}
renderItem={({item}) => <TxHistoryListItem navigation={navigation} id={item.id} />}
renderSectionHeader={({section: {data}}) => <DayHeader ts={data[0].submittedAt} />}
refreshing={refreshing}
sections={groupedTransactions}
keyExtractor={(item) => item.id}
stickySectionHeadersEnabled={false}
nestedScrollEnabled={true}
/>
</View>
)
Expand Down

0 comments on commit 2e219d9

Please sign in to comment.