@@ -21,12 +21,12 @@ import { useSceneScrollHandler } from '../../state/SceneScrollState'
21
21
import { useDispatch , useSelector } from '../../types/reactRedux'
22
22
import { NavigationBase , WalletsTabSceneProps } from '../../types/routerTypes'
23
23
import { coinrankListData , infoServerData } from '../../util/network'
24
- import { calculateSpamThreshold , convertNativeToDenomination , darkenHexColor , unixToLocaleDateTime , zeroString } from '../../util/utils'
24
+ import { calculateSpamThreshold , convertNativeToDenomination , darkenHexColor , zeroString } from '../../util/utils'
25
25
import { EdgeCard } from '../cards/EdgeCard'
26
26
import { InfoCardCarousel } from '../cards/InfoCardCarousel'
27
27
import { SwipeChart } from '../charts/SwipeChart'
28
28
import { AccentColors } from '../common/DotsBackground'
29
- import { EdgeAnim , fadeInDown10 , MAX_LIST_ITEMS_ANIM } from '../common/EdgeAnim'
29
+ import { fadeInDown10 } from '../common/EdgeAnim'
30
30
import { SceneWrapper } from '../common/SceneWrapper'
31
31
import { SectionHeader as SectionHeaderUi4 } from '../common/SectionHeader'
32
32
import { withWallet } from '../hoc/withWallet'
@@ -35,7 +35,7 @@ import { BuyCrypto } from '../themed/BuyCrypto'
35
35
import { EdgeText , Paragraph } from '../themed/EdgeText'
36
36
import { ExplorerCard } from '../themed/ExplorerCard'
37
37
import { SearchFooter } from '../themed/SearchFooter'
38
- import { EmptyLoader , SectionHeader , SectionHeaderCentered } from '../themed/TransactionListComponents'
38
+ import { EmptyLoader , SectionHeaderCentered } from '../themed/TransactionListComponents'
39
39
import { TransactionListRow } from '../themed/TransactionListRow'
40
40
import { TransactionListTop } from '../themed/TransactionListTop'
41
41
@@ -101,11 +101,7 @@ function TransactionListComponent(props: Props) {
101
101
} , [ exchangeDenom , exchangeRate , spamFilterOn ] )
102
102
103
103
// Transaction list state machine:
104
- const {
105
- transactions,
106
- atEnd,
107
- requestMore : handleScrollEnd
108
- } = useTransactionList ( wallet , tokenId , {
104
+ const { transactions, requestMore : handleScrollEnd } = useTransactionList ( wallet , tokenId , {
109
105
searchString : isSearching ? searchText : undefined ,
110
106
spamThreshold
111
107
} )
@@ -116,36 +112,10 @@ function TransactionListComponent(props: Props) {
116
112
const listItems = React . useMemo ( ( ) => {
117
113
if ( isTransactionListUnsupported ) return [ ]
118
114
119
- let lastSection = ''
120
- const out : ListItem [ ] = [ ]
121
- for ( const tx of transactions ) {
122
- // Create a new section header if we need one:
123
- const { date } = unixToLocaleDateTime ( tx . date )
124
- if ( date !== lastSection ) {
125
- out . push ( date )
126
- lastSection = date
127
- }
128
-
129
- // Add the transaction to the list:
130
- out . push ( tx )
131
- }
132
-
133
- // If we are still loading, add a spinner at the end:
134
- if ( ! atEnd ) out . push ( null )
135
-
136
- return out
137
- } , [ atEnd , isTransactionListUnsupported , transactions ] )
138
-
139
- // TODO: Comment out sticky header indices until we figure out how to
140
- // give the headers a background only when they're sticking.
141
- // Figure out where the section headers are located:
142
- // const stickyHeaderIndices = React.useMemo<number[]>(() => {
143
- // const out: number[] = []
144
- // for (let i = 0; i < listItems.length; ++i) {
145
- // if (typeof listItems[i] === 'string') out.push(i)
146
- // }
147
- // return out
148
- // }, [listItems])
115
+ // Take only the 5 most recent transactions
116
+ const recentTransactions = transactions . slice ( 0 , 5 )
117
+ return recentTransactions . length > 0 ? recentTransactions : [ ]
118
+ } , [ isTransactionListUnsupported , transactions ] )
149
119
150
120
// ---------------------------------------------------------------------------
151
121
// Side-Effects
@@ -254,27 +224,35 @@ function TransactionListComponent(props: Props) {
254
224
) }
255
225
< SectionHeaderUi4
256
226
leftTitle = { lstrings . transaction_list_recent_transactions }
257
- rightNode = { lstrings . coin_rank_see_more }
258
- onRightPress = { handlePressCoinRanking }
227
+ rightNode = { lstrings . see_all }
228
+ onRightPress = { ( ) => navigation . navigate ( 'transactionList2' , route . params ) }
259
229
/>
230
+ < EdgeCard sections >
231
+ { listItems . map ( ( tx : EdgeTransaction ) => (
232
+ < View key = { tx . txid } style = { styles . txRow } >
233
+ < TransactionListRow navigation = { navigation as NavigationBase } transaction = { tx } wallet = { wallet } noCard />
234
+ </ View >
235
+ ) ) }
236
+ </ EdgeCard >
260
237
</ >
261
238
)
262
239
} , [
263
- listItems . length ,
240
+ listItems ,
264
241
navigation ,
265
242
isSearching ,
266
243
tokenId ,
267
244
wallet ,
268
245
isLightAccount ,
269
246
pluginId ,
270
- route . params . countryCode ,
247
+ route . params ,
271
248
screenWidth ,
272
249
assetId ,
273
250
displayName ,
274
251
handlePressCoinRanking ,
275
252
fiatRateFormat ,
276
253
currencyCode ,
277
- fiatCurrencyCode
254
+ fiatCurrencyCode ,
255
+ styles . txRow
278
256
] )
279
257
280
258
const emptyComponent = React . useMemo ( ( ) => {
@@ -292,19 +270,7 @@ function TransactionListComponent(props: Props) {
292
270
return < EmptyLoader />
293
271
}
294
272
295
- const disableAnimation = index >= MAX_LIST_ITEMS_ANIM
296
- if ( typeof item === 'string' ) {
297
- return (
298
- < EdgeAnim disableAnimation = { disableAnimation } enter = { { type : 'fadeInDown' , distance : 30 * ( index + 1 ) } } >
299
- < SectionHeader title = { item } />
300
- </ EdgeAnim >
301
- )
302
- }
303
- return (
304
- < EdgeAnim disableAnimation = { disableAnimation } enter = { { type : 'fadeInDown' , distance : 30 * ( index + 1 ) } } >
305
- < TransactionListRow navigation = { navigation as NavigationBase } transaction = { item } wallet = { wallet } />
306
- </ EdgeAnim >
307
- )
273
+ return null // We're not using the FlatList rendering anymore
308
274
} )
309
275
310
276
const keyExtractor = useHandler ( ( item : ListItem ) => {
@@ -376,9 +342,6 @@ function TransactionListComponent(props: Props) {
376
342
ListHeaderComponent = { topArea }
377
343
onEndReachedThreshold = { 0.5 }
378
344
renderItem = { renderItem }
379
- // TODO: Comment out sticky header indices until we figure out how to
380
- // give the headers a background only when they're sticking.
381
- // stickyHeaderIndices={stickyHeaderIndices}
382
345
onEndReached = { handleScrollEnd }
383
346
onScroll = { handleScroll }
384
347
scrollIndicatorInsets = { SCROLL_INDICATOR_INSET_FIX }
@@ -406,7 +369,9 @@ export const TransactionList = withWallet(TransactionListComponent)
406
369
407
370
const getStyles = cacheStyles ( ( ) => ( {
408
371
flatList : {
409
- overflow : 'visible' ,
410
- flexShrink : 0
372
+ flex : 1
373
+ } ,
374
+ txRow : {
375
+ paddingVertical : 0
411
376
}
412
377
} ) )
0 commit comments