Add SelectTabGroup for secondary Symptom Switch
This commit is contained in:
@@ -6,6 +6,7 @@ import AppSwitch from '../../common/app-switch'
|
|||||||
import AppText from '../../common/app-text'
|
import AppText from '../../common/app-text'
|
||||||
import TemperatureSlider from './temperature-slider'
|
import TemperatureSlider from './temperature-slider'
|
||||||
import Segment from '../../common/segment'
|
import Segment from '../../common/segment'
|
||||||
|
import SelectTabGroup from '../../cycle-day/select-tab-group'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
desireTrackingCategoryObservable,
|
desireTrackingCategoryObservable,
|
||||||
@@ -120,7 +121,16 @@ const Settings = () => {
|
|||||||
? labels.periodPrediction.on
|
? labels.periodPrediction.on
|
||||||
: labels.periodPrediction.off
|
: labels.periodPrediction.off
|
||||||
|
|
||||||
const onCervixToggle = (value) => {
|
// old
|
||||||
|
// const onCervixToggle = (value) => {
|
||||||
|
// if (isMucusTrackingCategoryEnabled && isCervixTrackingCategoryEnabled) {
|
||||||
|
// setShouldUseCervix(value)
|
||||||
|
// saveUseCervix(value)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// new
|
||||||
|
const onSelectTab = (value) => {
|
||||||
if (isMucusTrackingCategoryEnabled && isCervixTrackingCategoryEnabled) {
|
if (isMucusTrackingCategoryEnabled && isCervixTrackingCategoryEnabled) {
|
||||||
setShouldUseCervix(value)
|
setShouldUseCervix(value)
|
||||||
saveUseCervix(value)
|
saveUseCervix(value)
|
||||||
@@ -170,6 +180,18 @@ const Settings = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//new
|
||||||
|
const secondarySymptomButtons = [
|
||||||
|
{
|
||||||
|
label: 'cervical mucus',
|
||||||
|
value: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'cervix',
|
||||||
|
value: 1,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
const cervixText = shouldUseCervix
|
const cervixText = shouldUseCervix
|
||||||
? labels.useCervix.cervixModeOn
|
? labels.useCervix.cervixModeOn
|
||||||
: labels.useCervix.cervixModeOff
|
: labels.useCervix.cervixModeOff
|
||||||
@@ -263,13 +285,21 @@ const Settings = () => {
|
|||||||
|
|
||||||
<Pressable onPress={secSymptomDisabledPrompt}>
|
<Pressable onPress={secSymptomDisabledPrompt}>
|
||||||
<Segment title={labels.useCervix.title}>
|
<Segment title={labels.useCervix.title}>
|
||||||
<AppSwitch
|
{/* hier war vorher der AppSwitch */}
|
||||||
onToggle={onCervixToggle}
|
{/* noch condition adden */}
|
||||||
text={cervixText}
|
{isTemperatureTrackingCategoryEnabled && (
|
||||||
value={shouldUseCervix}
|
<>
|
||||||
trackColor={{ true: Colors.turquoiseDark }}
|
<AppText>{cervixText}</AppText>
|
||||||
disabled={isSecondarySymptomDisabled}
|
<SelectTabGroup
|
||||||
/>
|
activeButton={shouldUseCervix}
|
||||||
|
buttons={secondarySymptomButtons}
|
||||||
|
onSelect={(value) => onSelectTab(value)}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{!isTemperatureTrackingCategoryEnabled && (
|
||||||
|
<AppText>{labels.disabled.message}</AppText>
|
||||||
|
)}
|
||||||
</Segment>
|
</Segment>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user