Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash when have a lot of transactions. #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 23 additions & 22 deletions components/TransactionsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import React, {useState} from 'react';
import {createStackNavigator} from '@react-navigation/stack';
import {RegText, ZecAmount, UsdAmount, SecondaryButton, FadeText} from '../components/Components';
import {View, ScrollView, Image, Modal, TouchableOpacity, SafeAreaView, RefreshControl, Clipboard} from 'react-native';
import {View, ScrollView, Image, Modal, TouchableOpacity, SafeAreaView, RefreshControl, Clipboard,FlatList} from 'react-native';
import Toast from 'react-native-simple-toast';
import {TotalBalance, Transaction, Info, SyncStatus} from '../app/AppState';
import Utils from '../app/utils';
Expand Down Expand Up @@ -300,31 +300,32 @@ const TransactionsScreenView: React.FunctionComponent<TransactionsScreenViewProp
<View style={{display: 'flex', alignItems: 'center', marginTop: -25}}>
<Image source={require('../assets/img/logobig.png')} style={{width: 50, height: 50, resizeMode: 'contain'}} />
</View>
<ScrollView

<FlatList
refreshControl={
<RefreshControl refreshing={false} onRefresh={doRefresh} tintColor={colors.text} title="Refreshing" />
<RefreshControl refreshing={false} onRefresh={doRefresh} tintColor={colors.text} title="Refreshing"/>
}
style={{flexGrow: 1, marginTop: 10, width: '100%', height: '100%'}}>
{transactions?.flatMap((t) => {
let txmonth = moment(t.time * 1000).format('MMM YYYY');

var month = '';
if (txmonth !== lastMonth) {
month = txmonth;
lastMonth = txmonth;
}
data={transactions}
renderItem={({item})=>{
let txmonth = moment(item.time * 1000).format('MMM YYYY');

return (
var month = '';
if (txmonth !== lastMonth) {
month = txmonth;
lastMonth = txmonth;
}
return (
<TxSummaryLine
key={`${t.txid}-${t.type}`}
tx={t}
month={month}
setTxDetail={setTxDetail}
setTxDetailModalShowing={setTxDetailModalShowing}
/>
);
})}
</ScrollView>
key={`${item.txid}-${item.type}`}
tx={item}
month={month}
setTxDetail={setTxDetail}
setTxDetailModalShowing={setTxDetailModalShowing}
/>
)
}
}
/>
</View>
);
};
Expand Down