Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Commit

Permalink
fixed virtualized list view errors
Browse files Browse the repository at this point in the history
  • Loading branch information
norbertschuler committed Dec 31, 2021
1 parent f09395b commit 12ded16
Show file tree
Hide file tree
Showing 16 changed files with 431 additions and 451 deletions.
1 change: 1 addition & 0 deletions app/actions/loadTposAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export function loadProject(plantProject, options = {}) {
request
.then(res => {
//debug('========================', res.data);
dispatch(setSelectedPlantProjectId(parseInt(res.data.id)));
dispatch(mergeEntities(normalize(res.data, plantProjectSchema)));
dispatch(mergeEntities(normalize(res.data.tpoData, tpoSchema)));
options.loading && dispatch(setProgressModelState(false));
Expand Down
1 change: 1 addition & 0 deletions app/components/Challenge/challengeList.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class ChallengeList extends Component {
render() {
const { challenges } = this.props;
return (
/* This crashes if embedded into a ScrollView */
<FlatList
data={challenges}
// eslint-disable-next-line no-underscore-dangle
Expand Down
56 changes: 30 additions & 26 deletions app/components/Common/CurrencySelectorList.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ class CurrencySelectorList extends Component {
this.state.search ? (
this.setSearch()
) : (
this.props.hideCurrencyModal({
show: false
})
);
this.props.hideCurrencyModal({
show: false
})
);
};
getCountryCode = currency =>
countryCodes.find(c => c.code == currency.value) || {};
Expand Down Expand Up @@ -208,8 +208,8 @@ class CurrencySelectorList extends Component {
{this.state.search ? (
<Icon name="arrow-back" size={30} color="black" />
) : (
<Icon name="close" size={30} color="#4d5153" />
)}
<Icon name="close" size={30} color="#4d5153" />
)}

</TouchableItem>
<View
Expand All @@ -234,9 +234,15 @@ class CurrencySelectorList extends Component {
/>
</View>
</View>
<ScrollView>
<View>
{this.state.search ? null : (
{this.state.search ? (
<FlatList
data={currenciesArray}
keyExtractor={this.keyExtractor}
renderItem={this.renderItem}
/>
) : (
<>
<View>
<Text
style={{
fontFamily: 'OpenSans-Bold',
Expand All @@ -248,15 +254,13 @@ class CurrencySelectorList extends Component {
>
{i18n.t('label.featured_currencies')}
</Text>
)}
<FlatList
data={currenciesArray.slice(0, 2)}
keyExtractor={this.keyExtractor}
renderItem={this.renderItem}
/>
</View>
<View>
{this.state.search ? null : (
<FlatList
data={currenciesArray.slice(0, 2)}
keyExtractor={this.keyExtractor}
renderItem={this.renderItem}
/>
</View>
<View>
<Text
style={{
fontFamily: 'OpenSans-Bold',
Expand All @@ -268,14 +272,14 @@ class CurrencySelectorList extends Component {
>
{i18n.t('label.all_currencies')}
</Text>
)}
</View>
<FlatList
data={currenciesArray.slice(2)}
keyExtractor={this.keyExtractor}
renderItem={this.renderItem}
/>
</ScrollView>
<FlatList
data={currenciesArray.slice(2)}
keyExtractor={this.keyExtractor}
renderItem={this.renderItem}
/>
</View>
</>
)}
</View>
</View>
</Modal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ const CompetitionsList = props => {
};

return (
/* This crashes if embedded into a ScrollView */
<FlatList
data={
props.tabType !== 'mine'
Expand Down
102 changes: 50 additions & 52 deletions app/components/LeaderboardRefresh/Companies/CompaniesLeaderBoard.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,64 +80,62 @@ const CompaniesLeaderBoard = ({ navigation }) => {
return (
<SafeAreaView style={styles.mainContainer}>
<Header navigation={navigation} />
<ScrollView showsVerticalScrollIndicator={false}>
<View style={styles.headingAndSubHeadeingContainer}>
<View style={styles.headerContainer}>
<Text style={styles.headerText}>
{i18n.t('label.lbr_companies')}
</Text>
</View>
<View>
<Text style={styles.subHeaderText}>
{i18n.t('label.lbr_c_leaderboard')}
</Text>
</View>
<View style={styles.headingAndSubHeadeingContainer}>
<View style={styles.headerContainer}>
<Text style={styles.headerText}>
{i18n.t('label.lbr_companies')}
</Text>
</View>
<View>
<Text style={styles.subHeaderText}>
{i18n.t('label.lbr_c_leaderboard')}
</Text>
</View>
<ScrollView
showsHorizontalScrollIndicator={false}
horizontal
contentContainerStyle={styles.timeLineContentContainerStyle}
style={styles.timeLineContainer}
</View>
<ScrollView
showsHorizontalScrollIndicator={false}
horizontal
contentContainerStyle={styles.timeLineContentContainerStyle}
style={styles.timeLineContainer}
>
<TouchableOpacity
onPress={() => setPeriod('1w')}
style={
styles[period == '1w' ? 'activeChipContainer' : 'chipContainer']
}
>
<TouchableOpacity
onPress={() => setPeriod('1w')}
style={
styles[period == '1w' ? 'activeChipContainer' : 'chipContainer']
}
<Text
style={styles[period == '1w' ? 'activeChipText' : 'chipText']}
>
<Text
style={styles[period == '1w' ? 'activeChipText' : 'chipText']}
>
{i18n.t('label.lbr_c_this_week')}
</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => setPeriod('1y')}
style={
styles[period == '1y' ? 'activeChipContainer' : 'chipContainer']
}
{i18n.t('label.lbr_c_this_week')}
</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => setPeriod('1y')}
style={
styles[period == '1y' ? 'activeChipContainer' : 'chipContainer']
}
>
<Text
style={styles[period == '1y' ? 'activeChipText' : 'chipText']}
>
<Text
style={styles[period == '1y' ? 'activeChipText' : 'chipText']}
>
{i18n.t('label.lbr_c_year')}
</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => setPeriod('all')}
style={
styles[period == 'all' ? 'activeChipContainer' : 'chipContainer']
}
{i18n.t('label.lbr_c_year')}
</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => setPeriod('all')}
style={
styles[period == 'all' ? 'activeChipContainer' : 'chipContainer']
}
>
<Text
style={styles[period == 'all' ? 'activeChipText' : 'chipText']}
>
<Text
style={styles[period == 'all' ? 'activeChipText' : 'chipText']}
>
{i18n.t('label.lbr_c_all_time')}
</Text>
</TouchableOpacity>
</ScrollView>
<View style={styles.countriesListContainer}>{renderCompanyList()}</View>
{i18n.t('label.lbr_c_all_time')}
</Text>
</TouchableOpacity>
</ScrollView>
<View style={styles.countriesListContainer}>{renderCompanyList()}</View>
</SafeAreaView>
);
};
Expand Down
103 changes: 49 additions & 54 deletions app/components/LeaderboardRefresh/Countries/CountriesLeaderBoard.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,67 +119,62 @@ const CountriesLeaderBoard = ({ navigation }) => {
return (
<SafeAreaView style={styles.mainContainer}>
<Header navigation={navigation} />
<View style={styles.headingAndSubHeadeingContainer}>
<View style={styles.headerContainer}>
<Text style={styles.headerText}>
{i18n.t('label.lbr_c_countries')}
</Text>
</View>
<View>
<Text style={styles.subHeaderText}>
{i18n.t('label.lbr_c_leaderboard')}
</Text>
</View>
</View>
<ScrollView
showsVerticalScrollIndicator={false}
contentContainerStyle={{}}
showsHorizontalScrollIndicator={false}
horizontal
contentContainerStyle={styles.timeLineContentContainerStyle}
style={styles.timeLineContainer}
>
<View style={styles.headingAndSubHeadeingContainer}>
<View style={styles.headerContainer}>
<Text style={styles.headerText}>
{i18n.t('label.lbr_c_countries')}
</Text>
</View>
<View>
<Text style={styles.subHeaderText}>
{i18n.t('label.lbr_c_leaderboard')}
</Text>
</View>
</View>
<ScrollView
showsHorizontalScrollIndicator={false}
horizontal
contentContainerStyle={styles.timeLineContentContainerStyle}
style={styles.timeLineContainer}
<TouchableOpacity
onPress={() => setPeriod('1w')}
style={
styles[period == '1w' ? 'activeChipContainer' : 'chipContainer']
}
>
<TouchableOpacity
onPress={() => setPeriod('1w')}
style={
styles[period == '1w' ? 'activeChipContainer' : 'chipContainer']
}
<Text
style={styles[period == '1w' ? 'activeChipText' : 'chipText']}
>
<Text
style={styles[period == '1w' ? 'activeChipText' : 'chipText']}
>
{i18n.t('label.lbr_c_this_week')}
</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => setPeriod('1y')}
style={
styles[period == '1y' ? 'activeChipContainer' : 'chipContainer']
}
{i18n.t('label.lbr_c_this_week')}
</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => setPeriod('1y')}
style={
styles[period == '1y' ? 'activeChipContainer' : 'chipContainer']
}
>
<Text
style={styles[period == '1y' ? 'activeChipText' : 'chipText']}
>
<Text
style={styles[period == '1y' ? 'activeChipText' : 'chipText']}
>
{i18n.t('label.lbr_c_year')}
</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => setPeriod('all')}
style={
styles[period == 'all' ? 'activeChipContainer' : 'chipContainer']
}
{i18n.t('label.lbr_c_year')}
</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() => setPeriod('all')}
style={
styles[period == 'all' ? 'activeChipContainer' : 'chipContainer']
}
>
<Text
style={styles[period == 'all' ? 'activeChipText' : 'chipText']}
>
<Text
style={styles[period == 'all' ? 'activeChipText' : 'chipText']}
>
{i18n.t('label.lbr_c_all_time')}
</Text>
</TouchableOpacity>
</ScrollView>
<View style={styles.countriesListContainer}>{renderCountryList()}</View>
{i18n.t('label.lbr_c_all_time')}
</Text>
</TouchableOpacity>
</ScrollView>
<View style={styles.countriesListContainer}>{renderCountryList()}</View>
</SafeAreaView>
);
};
Expand Down
Loading

0 comments on commit 12ded16

Please sign in to comment.