Clean up
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -18,19 +18,6 @@ export default function AppText(props) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ActionHint(props) {
|
|
||||||
if(props.isVisible) {
|
|
||||||
return (
|
|
||||||
<AppText
|
|
||||||
style={[styles.actionHint, props.style]}>
|
|
||||||
{props.children}
|
|
||||||
</AppText>
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function SymptomSectionHeader(props) {
|
export function SymptomSectionHeader(props) {
|
||||||
return (
|
return (
|
||||||
<AppText style={styles.symptomViewHeading}>
|
<AppText style={styles.symptomViewHeading}>
|
||||||
|
|||||||
@@ -24,13 +24,6 @@ export default class SymptomView extends Component {
|
|||||||
this.autoSave()
|
this.autoSave()
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO where is this needed now?
|
|
||||||
async handleBackButtonPressOnSymptomView() {
|
|
||||||
// every specific symptom view provides their own onBackButtonPress method
|
|
||||||
const stopHere = await this.onBackButtonPress()
|
|
||||||
if (!stopHere) this.globalBackhandler()
|
|
||||||
}
|
|
||||||
|
|
||||||
saveSymptomEntry(entry) {
|
saveSymptomEntry(entry) {
|
||||||
saveSymptom(this.symptomName, this.date, entry)
|
saveSymptom(this.symptomName, this.date, entry)
|
||||||
}
|
}
|
||||||
@@ -59,8 +52,7 @@ export default class SymptomView extends Component {
|
|||||||
<Header
|
<Header
|
||||||
title={headerTitles[this.symptomName].toLowerCase()}
|
title={headerTitles[this.symptomName].toLowerCase()}
|
||||||
date={this.date}
|
date={this.date}
|
||||||
// TODO what to put here instead?
|
goBack={this.props.handleBackButtonPress}
|
||||||
goBack={this.handleBackButtonPressOnSymptomView.bind(this)}
|
|
||||||
deleteIconActive={this.isDeleteIconActive()}
|
deleteIconActive={this.isDeleteIconActive()}
|
||||||
deleteEntry={() => {
|
deleteEntry={() => {
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import {
|
|||||||
View,
|
View,
|
||||||
Switch,
|
Switch,
|
||||||
Keyboard,
|
Keyboard,
|
||||||
Alert,
|
|
||||||
ScrollView
|
ScrollView
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
import DateTimePicker from 'react-native-modal-datetime-picker-nevo'
|
import DateTimePicker from 'react-native-modal-datetime-picker-nevo'
|
||||||
@@ -35,7 +34,6 @@ export default class Temp extends SymptomView {
|
|||||||
exclude: temp ? temp.exclude : false,
|
exclude: temp ? temp.exclude : false,
|
||||||
time: temp ? temp.time : LocalTime.now().truncatedTo(minutes).toString(),
|
time: temp ? temp.time : LocalTime.now().truncatedTo(minutes).toString(),
|
||||||
isTimePickerVisible: false,
|
isTimePickerVisible: false,
|
||||||
outOfRange: null,
|
|
||||||
note: temp ? temp.note : null
|
note: temp ? temp.note : null
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +42,7 @@ export default class Temp extends SymptomView {
|
|||||||
if (temp.value === Math.floor(temp.value)) {
|
if (temp.value === Math.floor(temp.value)) {
|
||||||
this.state.temperature = `${this.state.temperature}.0`
|
this.state.temperature = `${this.state.temperature}.0`
|
||||||
}
|
}
|
||||||
|
this.state.outOfRangeWarning = makeOutOfRangeWarningMessage(this.state.temperature)
|
||||||
} else {
|
} else {
|
||||||
const prevTemp = getPreviousTemperature(props.date)
|
const prevTemp = getPreviousTemperature(props.date)
|
||||||
if (prevTemp) {
|
if (prevTemp) {
|
||||||
@@ -79,43 +78,13 @@ export default class Temp extends SymptomView {
|
|||||||
this.saveSymptomEntry(dataToSave)
|
this.saveSymptomEntry(dataToSave)
|
||||||
}
|
}
|
||||||
|
|
||||||
warnUserIfTempOutOfRange = async () => {
|
|
||||||
const value = Number(this.state.temperature)
|
|
||||||
const { min, max } = config.temperatureScale
|
|
||||||
const range = { min, max }
|
|
||||||
const scale = scaleObservable.value
|
|
||||||
let warningMsg
|
|
||||||
|
|
||||||
if (value < range.min || value > range.max) {
|
|
||||||
warningMsg = labels.outOfAbsoluteRangeWarning
|
|
||||||
} else if (value < scale.min || value > scale.max) {
|
|
||||||
warningMsg = labels.outOfRangeWarning
|
|
||||||
}
|
|
||||||
|
|
||||||
// RN alert runs asynchronously but doesn't provide a callback, so wrap
|
|
||||||
// it in a promise
|
|
||||||
return new Promise(resolve => {
|
|
||||||
if (warningMsg) {
|
|
||||||
// we set this so the time picker doesn't open at the same time
|
|
||||||
this.warningAlertOpen = true
|
|
||||||
Alert.alert(
|
|
||||||
sharedLabels.warning,
|
|
||||||
warningMsg,
|
|
||||||
[
|
|
||||||
{ text: sharedLabels.ok, onPress: () => {
|
|
||||||
this.warningAlertOpen = false
|
|
||||||
}}
|
|
||||||
]
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
resolve(true)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
setTemperature = (temperature) => {
|
setTemperature = (temperature) => {
|
||||||
if (isNaN(Number(temperature))) return
|
if (isNaN(Number(temperature))) return
|
||||||
this.setState({ temperature, isSuggestion: false })
|
this.setState({
|
||||||
|
temperature, isSuggestion: false,
|
||||||
|
outOfRangeWarning: makeOutOfRangeWarningMessage(temperature)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
setNote = (note) => {
|
setNote = (note) => {
|
||||||
@@ -146,10 +115,14 @@ export default class Temp extends SymptomView {
|
|||||||
onChangeText={this.setTemperature}
|
onChangeText={this.setTemperature}
|
||||||
keyboardType='numeric'
|
keyboardType='numeric'
|
||||||
maxLength={5}
|
maxLength={5}
|
||||||
onBlur={this.warnUserIfTempOutOfRange}
|
|
||||||
/>
|
/>
|
||||||
<AppText style={{ marginLeft: 5 }}>°C</AppText>
|
<AppText style={{ marginLeft: 5 }}>°C</AppText>
|
||||||
</View>
|
</View>
|
||||||
|
{this.state.outOfRangeWarning &&
|
||||||
|
<AppText style={styles.hint}>
|
||||||
|
{this.state.outOfRangeWarning}
|
||||||
|
</AppText>
|
||||||
|
}
|
||||||
</SymptomSection>
|
</SymptomSection>
|
||||||
<SymptomSection
|
<SymptomSection
|
||||||
header={labels.time}
|
header={labels.time}
|
||||||
@@ -157,13 +130,7 @@ export default class Temp extends SymptomView {
|
|||||||
<View style={styles.framedSegmentInlineChildren}>
|
<View style={styles.framedSegmentInlineChildren}>
|
||||||
<AppTextInput
|
<AppTextInput
|
||||||
style={[styles.temperatureTextInput]}
|
style={[styles.temperatureTextInput]}
|
||||||
onFocus={() => {
|
onFocus={this.showTimePicker}
|
||||||
if (this.warningAlertOpen) {
|
|
||||||
Keyboard.dismiss()
|
|
||||||
} else {
|
|
||||||
this.showTimePicker()
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
value={this.state.time}
|
value={this.state.time}
|
||||||
/>
|
/>
|
||||||
<DateTimePicker
|
<DateTimePicker
|
||||||
@@ -207,3 +174,22 @@ export default class Temp extends SymptomView {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function makeOutOfRangeWarningMessage(temperature) {
|
||||||
|
if (temperature === '') return
|
||||||
|
const value = Number(temperature)
|
||||||
|
const { min, max } = config.temperatureScale
|
||||||
|
const range = { min, max }
|
||||||
|
const scale = scaleObservable.value
|
||||||
|
let warningMsg
|
||||||
|
|
||||||
|
if (value < range.min || value > range.max) {
|
||||||
|
warningMsg = labels.outOfAbsoluteRangeWarning
|
||||||
|
} else if (value < scale.min || value > scale.max) {
|
||||||
|
warningMsg = labels.outOfRangeWarning
|
||||||
|
} else {
|
||||||
|
warningMsg = null
|
||||||
|
}
|
||||||
|
|
||||||
|
return warningMsg
|
||||||
|
}
|
||||||
@@ -72,6 +72,7 @@
|
|||||||
E43EF009AC8C4698AB322190 /* NodeMobile.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C225FC4966694B9FBD32E946 /* NodeMobile.framework */; };
|
E43EF009AC8C4698AB322190 /* NodeMobile.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C225FC4966694B9FBD32E946 /* NodeMobile.framework */; };
|
||||||
E4584E55EEC24302A3E84A23 /* nodejs-project in Resources */ = {isa = PBXBuildFile; fileRef = 6466AE2461BE4FA88B8372F0 /* nodejs-project */; };
|
E4584E55EEC24302A3E84A23 /* nodejs-project in Resources */ = {isa = PBXBuildFile; fileRef = 6466AE2461BE4FA88B8372F0 /* nodejs-project */; };
|
||||||
77500FAD5ADD402AAD2D9972 /* AntDesign.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 3102FB76D69C42938E0E126D /* AntDesign.ttf */; };
|
77500FAD5ADD402AAD2D9972 /* AntDesign.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 3102FB76D69C42938E0E126D /* AntDesign.ttf */; };
|
||||||
|
AA800A96BB73482AA90E29B8 /* OpenSans-LightItalic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 885BDE0B3896402F99D0C860 /* OpenSans-LightItalic.ttf */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
@@ -516,6 +517,7 @@
|
|||||||
F59A471BDE4144A1A41D4B52 /* Feather.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Feather.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Feather.ttf"; sourceTree = "<group>"; };
|
F59A471BDE4144A1A41D4B52 /* Feather.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Feather.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Feather.ttf"; sourceTree = "<group>"; };
|
||||||
F992F2D99E614DD79FAD6565 /* libRNNodeJsMobile.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNNodeJsMobile.a; sourceTree = "<group>"; };
|
F992F2D99E614DD79FAD6565 /* libRNNodeJsMobile.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNNodeJsMobile.a; sourceTree = "<group>"; };
|
||||||
3102FB76D69C42938E0E126D /* AntDesign.ttf */ = {isa = PBXFileReference; name = "AntDesign.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/AntDesign.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
|
3102FB76D69C42938E0E126D /* AntDesign.ttf */ = {isa = PBXFileReference; name = "AntDesign.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/AntDesign.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
|
||||||
|
885BDE0B3896402F99D0C860 /* OpenSans-LightItalic.ttf */ = {isa = PBXFileReference; name = "OpenSans-LightItalic.ttf"; path = "../assets/fonts/OpenSans-LightItalic.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@@ -608,6 +610,7 @@
|
|||||||
673C016DDDD74C2F89050279 /* OpenSans-Light.ttf */,
|
673C016DDDD74C2F89050279 /* OpenSans-Light.ttf */,
|
||||||
644690BCCEBF41789960B9A2 /* OpenSans-SemiBold.ttf */,
|
644690BCCEBF41789960B9A2 /* OpenSans-SemiBold.ttf */,
|
||||||
3102FB76D69C42938E0E126D /* AntDesign.ttf */,
|
3102FB76D69C42938E0E126D /* AntDesign.ttf */,
|
||||||
|
885BDE0B3896402F99D0C860 /* OpenSans-LightItalic.ttf */,
|
||||||
);
|
);
|
||||||
name = Resources;
|
name = Resources;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -951,9 +954,9 @@
|
|||||||
13B07F8E1A680F5B00A75B9A /* Resources */,
|
13B07F8E1A680F5B00A75B9A /* Resources */,
|
||||||
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
|
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
|
||||||
2B572382D4504B8FB4B9D251 /* Embed Frameworks */,
|
2B572382D4504B8FB4B9D251 /* Embed Frameworks */,
|
||||||
6A61F9B7BEB149D1894D6AB5 /* Build NodeJS Mobile Native Modules */,
|
D6AE48E8124449EE863F342D /* Build NodeJS Mobile Native Modules */,
|
||||||
53E84D10AC6B4045A1DBAB0C /* Sign NodeJS Mobile Native Modules */,
|
7D43D3729FAE42C0859CDC36 /* Sign NodeJS Mobile Native Modules */,
|
||||||
F43CB3783FD9405C8198826C /* Remove NodeJS Mobile Framework Simulator Strips */,
|
54483AF1DA474A71931D6D6A /* Remove NodeJS Mobile Framework Simulator Strips */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
@@ -1513,6 +1516,7 @@
|
|||||||
5D921C348AC14944835A4D82 /* OpenSans-Light.ttf in Resources */,
|
5D921C348AC14944835A4D82 /* OpenSans-Light.ttf in Resources */,
|
||||||
71D0BCE4666A4AB8A0874B5A /* OpenSans-SemiBold.ttf in Resources */,
|
71D0BCE4666A4AB8A0874B5A /* OpenSans-SemiBold.ttf in Resources */,
|
||||||
77500FAD5ADD402AAD2D9972 /* AntDesign.ttf in Resources */,
|
77500FAD5ADD402AAD2D9972 /* AntDesign.ttf in Resources */,
|
||||||
|
AA800A96BB73482AA90E29B8 /* OpenSans-LightItalic.ttf in Resources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@@ -1562,7 +1566,7 @@
|
|||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
|
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
|
||||||
};
|
};
|
||||||
6A61F9B7BEB149D1894D6AB5 /* Build NodeJS Mobile Native Modules */ = {
|
D6AE48E8124449EE863F342D /* Build NodeJS Mobile Native Modules */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
@@ -1630,7 +1634,7 @@ fi
|
|||||||
popd
|
popd
|
||||||
";
|
";
|
||||||
};
|
};
|
||||||
53E84D10AC6B4045A1DBAB0C /* Sign NodeJS Mobile Native Modules */ = {
|
7D43D3729FAE42C0859CDC36 /* Sign NodeJS Mobile Native Modules */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
@@ -1690,7 +1694,7 @@ find \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -path \"*/*.framework/*\" -del
|
|||||||
find \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -name \"*.framework\" -type d -delete
|
find \"$CODESIGNING_FOLDER_PATH/nodejs-project/\" -name \"*.framework\" -type d -delete
|
||||||
";
|
";
|
||||||
};
|
};
|
||||||
F43CB3783FD9405C8198826C /* Remove NodeJS Mobile Framework Simulator Strips */ = {
|
54483AF1DA474A71931D6D6A /* Remove NodeJS Mobile Framework Simulator Strips */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
|||||||
@@ -87,6 +87,7 @@
|
|||||||
<string>OpenSans-Regular.ttf</string>
|
<string>OpenSans-Regular.ttf</string>
|
||||||
<string>OpenSans-SemiBold.ttf</string>
|
<string>OpenSans-SemiBold.ttf</string>
|
||||||
<string>AntDesign.ttf</string>
|
<string>AntDesign.ttf</string>
|
||||||
|
<string>OpenSans-LightItalic.ttf</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
+3
-5
@@ -17,6 +17,7 @@ const headerFont = 'Prompt-ExtraLight'
|
|||||||
|
|
||||||
const textFont = 'OpenSans-Light'
|
const textFont = 'OpenSans-Light'
|
||||||
const textFontBold = 'OpenSans-SemiBold'
|
const textFontBold = 'OpenSans-SemiBold'
|
||||||
|
const textFontItalic = 'OpenSans-LightItalic'
|
||||||
|
|
||||||
const regularSize = 16
|
const regularSize = 16
|
||||||
const hintSize = 14
|
const hintSize = 14
|
||||||
@@ -43,12 +44,9 @@ export default StyleSheet.create({
|
|||||||
fontSize: regularSize,
|
fontSize: regularSize,
|
||||||
letterSpacing: 0.5
|
letterSpacing: 0.5
|
||||||
},
|
},
|
||||||
actionHint: {
|
hint: {
|
||||||
color: secondaryColor,
|
fontFamily: textFontItalic,
|
||||||
fontFamily: textFont,
|
|
||||||
fontSize: hintSize,
|
fontSize: hintSize,
|
||||||
fontWeight: 'bold',
|
|
||||||
margin: defaultIndentation
|
|
||||||
},
|
},
|
||||||
paragraph: {
|
paragraph: {
|
||||||
marginBottom: defaultBottomMargin
|
marginBottom: defaultBottomMargin
|
||||||
|
|||||||
Reference in New Issue
Block a user