Header.tsx/ModeSelector.tsx: disable font scaling, Professions.tsx: performance improvements
This commit is contained in:
parent
aad940e0df
commit
84b5f8598a
|
@ -42,6 +42,7 @@ const Header = ({ onSearch }: HeaderProps) => {
|
|||
onChangeText={setSearch}
|
||||
value={search}
|
||||
ref={inputRef}
|
||||
allowFontScaling={false}
|
||||
/>
|
||||
</Item>
|
||||
<View>
|
||||
|
|
|
@ -19,13 +19,13 @@ const ModeSelector = ({ mode, onChangeMode }: ModeSelectorProps) => {
|
|||
onPress={() => onChangeMode(Mode.All)}
|
||||
active={mode === Mode.All}
|
||||
>
|
||||
<Text>Wszystkie</Text>
|
||||
<Text allowFontScaling={false}>Wszystkie</Text>
|
||||
</Button>
|
||||
<Button
|
||||
onPress={() => onChangeMode(Mode.Saved)}
|
||||
active={mode === Mode.Saved}
|
||||
>
|
||||
<Text>Zapisane</Text>
|
||||
<Text allowFontScaling={false}>Zapisane</Text>
|
||||
</Button>
|
||||
</Segment>
|
||||
);
|
||||
|
|
|
@ -12,7 +12,6 @@ export interface ProfessionsProps
|
|||
extends Pick<FlatListProps<Profession>, 'refreshing' | 'onRefresh'> {
|
||||
professions: Profession[];
|
||||
}
|
||||
|
||||
const Professions = ({
|
||||
professions,
|
||||
refreshing,
|
||||
|
@ -35,6 +34,13 @@ const Professions = ({
|
|||
},
|
||||
[setShowModal, setSelectedQualification],
|
||||
);
|
||||
const renderItem = useCallback(
|
||||
({ item }: { item: Profession }) => {
|
||||
return <Item profession={item} onPress={handlePress} />;
|
||||
},
|
||||
[handlePress],
|
||||
);
|
||||
const keyExtractor = useCallback(item => item.id, []);
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
|
@ -42,11 +48,9 @@ const Professions = ({
|
|||
ref={listRef}
|
||||
dataArray={professions}
|
||||
contentContainerStyle={styles.contentContainer}
|
||||
renderItem={({ item }: { item: Profession }) => {
|
||||
return <Item profession={item} onPress={handlePress} />;
|
||||
}}
|
||||
renderItem={renderItem}
|
||||
ListEmptyComponent={<ListEmpty />}
|
||||
keyExtractor={item => item.id}
|
||||
keyExtractor={keyExtractor}
|
||||
refreshControl={
|
||||
<RefreshControl
|
||||
refreshing={refreshing ?? false}
|
||||
|
|
|
@ -24,7 +24,7 @@ const Suggestions = ({ qualifications }: SuggestionsProps) => {
|
|||
qualifications.length === 0 ? styles.fullHeight : {},
|
||||
]}
|
||||
>
|
||||
Niestety, ale do wybranej kwalifikacji nie zostały dodane żadne pytania.
|
||||
Do wybranej kwalifikacji nie zostały dodane żadne pytania.
|
||||
</H1>
|
||||
{qualifications.length > 0 && (
|
||||
<View style={styles.similarQualificationsContainer}>
|
||||
|
@ -45,31 +45,33 @@ const Suggestions = ({ qualifications }: SuggestionsProps) => {
|
|||
</Body>
|
||||
</CardItem>
|
||||
<CardItem>
|
||||
{QUESTIONS.map(question => {
|
||||
return (
|
||||
<Button
|
||||
key={question}
|
||||
onPress={() => {
|
||||
navigation.navigate(Screen.Test, {
|
||||
qualificationID: qualification.id,
|
||||
limit: question,
|
||||
});
|
||||
}}
|
||||
style={styles.button}
|
||||
small
|
||||
>
|
||||
<Text>
|
||||
Test {question}{' '}
|
||||
{polishPlurals(
|
||||
'pytanie',
|
||||
'pytania',
|
||||
'pytań',
|
||||
question,
|
||||
)}
|
||||
</Text>
|
||||
</Button>
|
||||
);
|
||||
})}
|
||||
<Body>
|
||||
{QUESTIONS.map(question => {
|
||||
return (
|
||||
<Button
|
||||
key={question}
|
||||
onPress={() => {
|
||||
navigation.navigate(Screen.Test, {
|
||||
qualificationID: qualification.id,
|
||||
limit: question,
|
||||
});
|
||||
}}
|
||||
full
|
||||
style={styles.button}
|
||||
>
|
||||
<Text>
|
||||
Test {question}{' '}
|
||||
{polishPlurals(
|
||||
'pytanie',
|
||||
'pytania',
|
||||
'pytań',
|
||||
question,
|
||||
)}
|
||||
</Text>
|
||||
</Button>
|
||||
);
|
||||
})}
|
||||
</Body>
|
||||
</CardItem>
|
||||
</Card>
|
||||
);
|
||||
|
@ -95,7 +97,7 @@ const styles = StyleSheet.create({
|
|||
marginTop: 20,
|
||||
},
|
||||
button: {
|
||||
marginRight: 3,
|
||||
marginBottom: 3,
|
||||
},
|
||||
similarQualificationsHeading: {
|
||||
marginBottom: 10,
|
||||
|
|
Reference in New Issue