Professions.tsx: performance improvements

This commit is contained in:
Dawid Wysokiński 2021-04-18 19:52:41 +02:00
parent 84b5f8598a
commit 478615dde6
3 changed files with 5 additions and 1 deletions

View File

@ -6,6 +6,8 @@ declare module 'native-base' {
namespace NativeBase {
interface List {
ListEmptyComponent?: FlatListProps<any>['ListEmptyComponent'];
initialNumToRender?: number;
maxToRenderPerBatch?: number;
}
}
}

View File

@ -37,4 +37,4 @@ const Item = ({ profession, onPress }: ItemProps) => {
);
};
export default Item;
export default React.memo(Item);

View File

@ -51,12 +51,14 @@ const Professions = ({
renderItem={renderItem}
ListEmptyComponent={<ListEmpty />}
keyExtractor={keyExtractor}
maxToRenderPerBatch={5}
refreshControl={
<RefreshControl
refreshing={refreshing ?? false}
onRefresh={onRefresh ?? (() => {})}
/>
}
initialNumToRender={5}
/>
<QualificationModal
onPressBackdrop={() => setShowModal(false)}