From 651435dfc619302c7717c85bf3db17c784b09567 Mon Sep 17 00:00:00 2001 From: keplyx Date: Tue, 10 Mar 2020 17:08:57 +0100 Subject: [PATCH] Improved proximo list performance by using a pure component --- components/PureFlatList.js | 17 +++++++++++++++++ screens/Proximo/ProximoListScreen.js | 5 ++--- 2 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 components/PureFlatList.js diff --git a/components/PureFlatList.js b/components/PureFlatList.js new file mode 100644 index 0000000..fd87c69 --- /dev/null +++ b/components/PureFlatList.js @@ -0,0 +1,17 @@ +import * as React from 'react'; +import {FlatList} from "react-native"; + + +export default class PureFlatList extends React.PureComponent{ + + render() { + return ( + + ); + } +} diff --git a/screens/Proximo/ProximoListScreen.js b/screens/Proximo/ProximoListScreen.js index 3d7bd77..c909402 100644 --- a/screens/Proximo/ProximoListScreen.js +++ b/screens/Proximo/ProximoListScreen.js @@ -5,6 +5,7 @@ import {FlatList, Image, ScrollView, View} from "react-native"; import i18n from "i18n-js"; import CustomModal from "../../components/CustomModal"; import {Avatar, IconButton, List, RadioButton, Searchbar, Subheading, Text, Title, withTheme} from "react-native-paper"; +import PureFlatList from "../../components/PureFlatList"; function sortPrice(a, b) { return a.price - b.price; @@ -313,11 +314,9 @@ class ProximoListScreen extends React.Component { {this.state.modalCurrentDisplayItem} -