Fix: temperature screen

This commit is contained in:
Maria Zadnepryanets
2022-09-16 18:29:26 +00:00
committed by Sofiya Tepikin
parent 2fb82d95e6
commit e289094d97
+101 -92
View File
@@ -112,98 +112,100 @@ const SymptomEditView = ({ date, onClose, symptom, symptomData }) => {
return ( return (
<AppModal onClose={onSave}> <AppModal onClose={onSave}>
<ScrollView <View style={styles.modalWindow}>
contentContainerStyle={styles.modalContainer}
style={styles.modalWindow}
>
<View style={styles.headerContainer}> <View style={styles.headerContainer}>
<CloseIcon onClose={onSave} /> <CloseIcon onClose={onSave} />
</View> </View>
{symptom === 'temperature' && ( <ScrollView
<Temperature contentContainerStyle={styles.modalContainer}
date={date} keyboardDismissMode="on-drag"
data={data} >
save={(value, field) => onSaveTemperature(value, field)} {symptom === 'temperature' && (
/> <Temperature
)} date={date}
{shouldShow(symptomConfig.selectTabGroups) && data={data}
symtomPage[symptom].selectTabGroups.map((group) => { save={(value, field) => onSaveTemperature(value, field)}
return ( />
<Segment key={group.key} style={styles.segmentBorder}> )}
<AppText style={styles.title}>{group.title}</AppText> {shouldShow(symptomConfig.selectTabGroups) &&
<SelectTabGroup symtomPage[symptom].selectTabGroups.map((group) => {
activeButton={data[group.key]} return (
buttons={group.options} <Segment key={group.key} style={styles.segmentBorder}>
onSelect={(value) => onSelectTab(group, value)} <AppText style={styles.title}>{group.title}</AppText>
/> <SelectTabGroup
</Segment> activeButton={data[group.key]}
) buttons={group.options}
})} onSelect={(value) => onSelectTab(group, value)}
{shouldShow(symptomConfig.selectBoxGroups) &&
symtomPage[symptom].selectBoxGroups.map((group) => {
const isOtherSelected =
data['other'] !== null &&
data['other'] !== false &&
Object.keys(group.options).includes('other')
return (
<Segment key={group.key} style={styles.segmentBorder}>
<AppText style={styles.title}>{group.title}</AppText>
<SelectBoxGroup
labels={group.options}
onSelect={(value) => onSelectBox(value)}
optionsState={data}
/>
{isOtherSelected && (
<AppTextInput
multiline={true}
placeholder={sharedLabels.enter}
value={data.note}
onChangeText={(value) => onSelectBoxNote(value)}
/> />
)} </Segment>
</Segment> )
) })}
})} {shouldShow(symptomConfig.selectBoxGroups) &&
{shouldShow(symptomConfig.excludeText) && ( symtomPage[symptom].selectBoxGroups.map((group) => {
<Segment style={styles.segmentBorder}> const isOtherSelected =
<AppSwitch data['other'] !== null &&
onToggle={onExcludeToggle} data['other'] !== false &&
text={symtomPage[symptom].excludeText} Object.keys(group.options).includes('other')
value={data.exclude}
/> return (
</Segment> <Segment key={group.key} style={styles.segmentBorder}>
)} <AppText style={styles.title}>{group.title}</AppText>
{shouldShow(symptomConfig.note) && ( <SelectBoxGroup
<Segment style={styles.segmentBorder}> labels={group.options}
<AppText>{symtomPage[symptom].note}</AppText> onSelect={(value) => onSelectBox(value)}
<AppTextInput optionsState={data}
multiline={true} />
numberOfLines={3} {isOtherSelected && (
onChangeText={onEditNote} <AppTextInput
placeholder={sharedLabels.enter} multiline={true}
testID="noteInput" placeholder={sharedLabels.enter}
value={noteText !== null ? noteText : ''} value={data.note}
/> onChangeText={(value) => onSelectBoxNote(value)}
</Segment> />
)} )}
<View style={styles.buttonsContainer}> </Segment>
<Button iconName={iconName} isSmall onPress={onPressLearnMore}> )
{sharedLabels.learnMore} })}
</Button> {shouldShow(symptomConfig.excludeText) && (
<Button isSmall onPress={onRemove}> <Segment style={styles.segmentBorder}>
{sharedLabels.remove} <AppSwitch
</Button> onToggle={onExcludeToggle}
<Button isCTA isSmall onPress={onSave}> text={symtomPage[symptom].excludeText}
{sharedLabels.save} value={data.exclude}
</Button> />
</View> </Segment>
{shouldShowInfo && ( )}
<Segment last style={styles.segmentBorder}> {shouldShow(symptomConfig.note) && (
<AppText>{info[symptom].text}</AppText> <Segment style={styles.segmentBorder}>
</Segment> <AppText>{symtomPage[symptom].note}</AppText>
)} <AppTextInput
</ScrollView> multiline={true}
numberOfLines={3}
onChangeText={onEditNote}
placeholder={sharedLabels.enter}
testID="noteInput"
value={noteText !== null ? noteText : ''}
/>
</Segment>
)}
<View style={styles.buttonsContainer}>
<Button iconName={iconName} isSmall onPress={onPressLearnMore}>
{sharedLabels.learnMore}
</Button>
<Button isSmall onPress={onRemove}>
{sharedLabels.remove}
</Button>
<Button isCTA isSmall onPress={onSave}>
{sharedLabels.save}
</Button>
</View>
{shouldShowInfo && (
<Segment last style={styles.segmentBorder}>
<AppText>{info[symptom].text}</AppText>
</Segment>
)}
</ScrollView>
</View>
</AppModal> </AppModal>
) )
} }
@@ -218,21 +220,28 @@ SymptomEditView.propTypes = {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
buttonsContainer: { buttonsContainer: {
...Containers.rowContainer, ...Containers.rowContainer,
paddingHorizontal: Spacing.base,
paddingBottom: Spacing.base,
}, },
headerContainer: { headerContainer: {
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'flex-end', justifyContent: 'flex-end',
paddingVertical: Spacing.tiny, paddingTop: Spacing.base,
paddingHorizontal: Spacing.base,
position: 'absolute',
width: '100%',
zIndex: 3, // works on ios
elevation: 3, // works on android
}, },
modalContainer: { modalContainer: {
flex: 1, paddingHorizontal: Spacing.base,
padding: Spacing.base,
}, },
modalWindow: { modalWindow: {
alignSelf: 'center', alignSelf: 'center',
backgroundColor: 'white', backgroundColor: 'white',
borderRadius: 10, borderRadius: 10,
marginVertical: Sizes.huge * 2, marginTop: Sizes.huge * 2,
paddingTop: Spacing.large * 2,
position: 'absolute', position: 'absolute',
minHeight: '40%', minHeight: '40%',
maxHeight: Dimensions.get('window').height * 0.7, maxHeight: Dimensions.get('window').height * 0.7,