diff --git a/android/app/src/main/assets/fonts/OpenSans-LightItalic.ttf b/android/app/src/main/assets/fonts/OpenSans-LightItalic.ttf
new file mode 100644
index 0000000..6ca1401
Binary files /dev/null and b/android/app/src/main/assets/fonts/OpenSans-LightItalic.ttf differ
diff --git a/assets/fonts/OpenSans-LightItalic.ttf b/assets/fonts/OpenSans-LightItalic.ttf
new file mode 100644
index 0000000..6ca1401
Binary files /dev/null and b/assets/fonts/OpenSans-LightItalic.ttf differ
diff --git a/components/app-text.js b/components/app-text.js
index 829e8b3..83e8781 100644
--- a/components/app-text.js
+++ b/components/app-text.js
@@ -18,19 +18,6 @@ export default function AppText(props) {
)
}
-export function ActionHint(props) {
- if(props.isVisible) {
- return (
-
- {props.children}
-
- )
- } else {
- return null
- }
-}
-
export function SymptomSectionHeader(props) {
return (
diff --git a/components/cycle-day/symptoms/bleeding.js b/components/cycle-day/symptoms/bleeding.js
index 9d94a03..6893bfa 100644
--- a/components/cycle-day/symptoms/bleeding.js
+++ b/components/cycle-day/symptoms/bleeding.js
@@ -22,7 +22,7 @@ export default class Bleeding extends SymptomView {
symptomName = 'bleeding'
- onBackButtonPress() {
+ autoSave = () => {
if (typeof this.state.currentValue != 'number') {
this.deleteSymptomEntry()
return
diff --git a/components/cycle-day/symptoms/cervix.js b/components/cycle-day/symptoms/cervix.js
index f58ebf2..4515f5d 100644
--- a/components/cycle-day/symptoms/cervix.js
+++ b/components/cycle-day/symptoms/cervix.js
@@ -19,7 +19,7 @@ export default class Cervix extends SymptomView {
symptomName = 'cervix'
- onBackButtonPress() {
+ autoSave = () => {
const nothingEntered = ['opening', 'firmness', 'position'].every(val => typeof this.state[val] != 'number')
if (nothingEntered) {
this.deleteSymptomEntry()
diff --git a/components/cycle-day/symptoms/desire.js b/components/cycle-day/symptoms/desire.js
index 5ff9fad..f28ff85 100644
--- a/components/cycle-day/symptoms/desire.js
+++ b/components/cycle-day/symptoms/desire.js
@@ -19,7 +19,7 @@ export default class Desire extends SymptomView {
symptomName = 'desire'
- onBackButtonPress() {
+ autoSave = () => {
if (typeof this.state.currentValue != 'number') {
this.deleteSymptomEntry()
return
diff --git a/components/cycle-day/symptoms/mood.js b/components/cycle-day/symptoms/mood.js
index 09f8fbc..6b78891 100644
--- a/components/cycle-day/symptoms/mood.js
+++ b/components/cycle-day/symptoms/mood.js
@@ -24,7 +24,7 @@ export default class Mood extends SymptomView {
symptomName = "mood"
- onBackButtonPress() {
+ autoSave = () => {
const nothingEntered = Object.values(this.state).every(val => !val)
if (nothingEntered) {
this.deleteSymptomEntry()
diff --git a/components/cycle-day/symptoms/mucus.js b/components/cycle-day/symptoms/mucus.js
index 2d7b9d1..cc73591 100644
--- a/components/cycle-day/symptoms/mucus.js
+++ b/components/cycle-day/symptoms/mucus.js
@@ -20,7 +20,7 @@ export default class Mucus extends SymptomView {
symptomName = 'mucus'
- onBackButtonPress() {
+ autoSave = () => {
const nothingEntered = ['feeling', 'texture'].every(val => typeof this.state[val] != 'number')
if (nothingEntered) {
this.deleteSymptomEntry()
diff --git a/components/cycle-day/symptoms/note.js b/components/cycle-day/symptoms/note.js
index c2bed81..e9a2df6 100644
--- a/components/cycle-day/symptoms/note.js
+++ b/components/cycle-day/symptoms/note.js
@@ -23,7 +23,7 @@ export default class Note extends SymptomView {
symptomName = 'note'
- onBackButtonPress() {
+ autoSave = () => {
if (!this.state.currentValue) {
this.deleteSymptomEntry()
return
diff --git a/components/cycle-day/symptoms/pain.js b/components/cycle-day/symptoms/pain.js
index 30ac355..fdf3fec 100644
--- a/components/cycle-day/symptoms/pain.js
+++ b/components/cycle-day/symptoms/pain.js
@@ -26,7 +26,7 @@ export default class Pain extends SymptomView {
symptomName = 'pain'
- onBackButtonPress() {
+ autoSave = () => {
const nothingEntered = Object.values(this.state).every(val => !val)
if (nothingEntered) {
this.deleteSymptomEntry()
diff --git a/components/cycle-day/symptoms/sex.js b/components/cycle-day/symptoms/sex.js
index 9b195da..140afa3 100644
--- a/components/cycle-day/symptoms/sex.js
+++ b/components/cycle-day/symptoms/sex.js
@@ -26,7 +26,7 @@ export default class Sex extends SymptomView {
symptomName = "sex"
- onBackButtonPress() {
+ autoSave = () => {
const nothingEntered = Object.values(this.state).every(val => !val)
if (nothingEntered) {
this.deleteSymptomEntry()
diff --git a/components/cycle-day/symptoms/symptom-view.js b/components/cycle-day/symptoms/symptom-view.js
index 158b2e6..91c843f 100644
--- a/components/cycle-day/symptoms/symptom-view.js
+++ b/components/cycle-day/symptoms/symptom-view.js
@@ -1,6 +1,6 @@
import React, { Component } from 'react'
import {
- BackHandler, View, Alert, TouchableOpacity
+ View, Alert, TouchableOpacity
} from 'react-native'
import { saveSymptom } from '../../../db'
import InfoPopUp from './info-symptom'
@@ -13,11 +13,6 @@ import styles, { iconStyles } from '../../../styles'
export default class SymptomView extends Component {
constructor(props) {
super()
- this.backHandler = BackHandler.addEventListener(
- 'hardwareBackPress',
- this.handleBackButtonPressOnSymptomView.bind(this)
- )
- this.globalBackhandler = props.handleBackButtonPress
this.date = props.date
this.navigate = props.navigate
this.state = {
@@ -25,10 +20,8 @@ export default class SymptomView extends Component {
}
}
- async handleBackButtonPressOnSymptomView() {
- // every specific symptom view provides their own onBackButtonPress method
- const stopHere = await this.onBackButtonPress()
- if (!stopHere) this.globalBackhandler()
+ componentDidUpdate() {
+ this.autoSave()
}
saveSymptomEntry(entry) {
@@ -39,10 +32,6 @@ export default class SymptomView extends Component {
saveSymptom(this.symptomName, this.date)
}
- componentWillUnmount() {
- this.backHandler.remove()
- }
-
isDeleteIconActive() {
const symptomValueHasBeenFilledOut = key => {
// the state tracks whether the symptom info should be shown,
@@ -63,7 +52,7 @@ export default class SymptomView extends Component {
{
Alert.alert(
diff --git a/components/cycle-day/symptoms/temperature.js b/components/cycle-day/symptoms/temperature.js
index 8171f86..66715c8 100644
--- a/components/cycle-day/symptoms/temperature.js
+++ b/components/cycle-day/symptoms/temperature.js
@@ -3,7 +3,6 @@ import {
View,
Switch,
Keyboard,
- Alert,
ScrollView
} from 'react-native'
import DateTimePicker from 'react-native-modal-datetime-picker-nevo'
@@ -35,7 +34,6 @@ export default class Temp extends SymptomView {
exclude: temp ? temp.exclude : false,
time: temp ? temp.time : LocalTime.now().truncatedTo(minutes).toString(),
isTimePickerVisible: false,
- outOfRange: null,
note: temp ? temp.note : null
}
@@ -44,6 +42,7 @@ export default class Temp extends SymptomView {
if (temp.value === Math.floor(temp.value)) {
this.state.temperature = `${this.state.temperature}.0`
}
+ this.state.outOfRangeWarning = makeOutOfRangeWarningMessage(this.state.temperature)
} else {
const prevTemp = getPreviousTemperature(props.date)
if (prevTemp) {
@@ -63,19 +62,12 @@ export default class Temp extends SymptomView {
})
}
- async onBackButtonPress() {
+ autoSave = () => {
if (typeof this.state.temperature != 'string' || this.state.temperature === '') {
this.deleteSymptomEntry()
return
}
- const userWantsToSave = await this.warnUserIfTempOutOfRange()
- if (!userWantsToSave) return true
-
- this.saveTemperature()
- }
-
- saveTemperature = () => {
const dataToSave = {
value: Number(this.state.temperature),
exclude: this.state.exclude,
@@ -86,44 +78,13 @@ export default class Temp extends SymptomView {
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) {
- Alert.alert(
- sharedLabels.warning,
- warningMsg,
- [
- { text: sharedLabels.cancel, onPress: () => {
- resolve(false)
- }},
- { text: sharedLabels.save, onPress: () => {
- resolve(true)
- }}
- ]
- )
- } else {
- resolve(true)
- }
- })
- }
setTemperature = (temperature) => {
if (isNaN(Number(temperature))) return
- this.setState({ temperature, isSuggestion: false })
+ this.setState({
+ temperature, isSuggestion: false,
+ outOfRangeWarning: makeOutOfRangeWarningMessage(temperature)
+ })
}
setNote = (note) => {
@@ -157,6 +118,11 @@ export default class Temp extends SymptomView {
/>
°C
+ {this.state.outOfRangeWarning &&
+
+ {this.state.outOfRangeWarning}
+
+ }
range.max) {
+ warningMsg = labels.outOfAbsoluteRangeWarning
+ } else if (value < scale.min || value > scale.max) {
+ warningMsg = labels.outOfRangeWarning
+ } else {
+ warningMsg = null
+ }
+
+ return warningMsg
+}
\ No newline at end of file
diff --git a/ios/drip.xcodeproj/project.pbxproj b/ios/drip.xcodeproj/project.pbxproj
index 87553be..7ebb59a 100644
--- a/ios/drip.xcodeproj/project.pbxproj
+++ b/ios/drip.xcodeproj/project.pbxproj
@@ -72,6 +72,7 @@
E43EF009AC8C4698AB322190 /* NodeMobile.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C225FC4966694B9FBD32E946 /* NodeMobile.framework */; };
E4584E55EEC24302A3E84A23 /* nodejs-project in Resources */ = {isa = PBXBuildFile; fileRef = 6466AE2461BE4FA88B8372F0 /* nodejs-project */; };
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 */
/* 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 = ""; };
F992F2D99E614DD79FAD6565 /* libRNNodeJsMobile.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNNodeJsMobile.a; sourceTree = ""; };
3102FB76D69C42938E0E126D /* AntDesign.ttf */ = {isa = PBXFileReference; name = "AntDesign.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/AntDesign.ttf"; sourceTree = ""; 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 = ""; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -608,6 +610,7 @@
673C016DDDD74C2F89050279 /* OpenSans-Light.ttf */,
644690BCCEBF41789960B9A2 /* OpenSans-SemiBold.ttf */,
3102FB76D69C42938E0E126D /* AntDesign.ttf */,
+ 885BDE0B3896402F99D0C860 /* OpenSans-LightItalic.ttf */,
);
name = Resources;
sourceTree = "";
@@ -951,9 +954,9 @@
13B07F8E1A680F5B00A75B9A /* Resources */,
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
2B572382D4504B8FB4B9D251 /* Embed Frameworks */,
- 6A61F9B7BEB149D1894D6AB5 /* Build NodeJS Mobile Native Modules */,
- 53E84D10AC6B4045A1DBAB0C /* Sign NodeJS Mobile Native Modules */,
- F43CB3783FD9405C8198826C /* Remove NodeJS Mobile Framework Simulator Strips */,
+ D6AE48E8124449EE863F342D /* Build NodeJS Mobile Native Modules */,
+ 7D43D3729FAE42C0859CDC36 /* Sign NodeJS Mobile Native Modules */,
+ 54483AF1DA474A71931D6D6A /* Remove NodeJS Mobile Framework Simulator Strips */,
);
buildRules = (
);
@@ -1513,6 +1516,7 @@
5D921C348AC14944835A4D82 /* OpenSans-Light.ttf in Resources */,
71D0BCE4666A4AB8A0874B5A /* OpenSans-SemiBold.ttf in Resources */,
77500FAD5ADD402AAD2D9972 /* AntDesign.ttf in Resources */,
+ AA800A96BB73482AA90E29B8 /* OpenSans-LightItalic.ttf in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1562,7 +1566,7 @@
shellPath = /bin/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;
buildActionMask = 2147483647;
files = (
@@ -1630,7 +1634,7 @@ fi
popd
";
};
- 53E84D10AC6B4045A1DBAB0C /* Sign NodeJS Mobile Native Modules */ = {
+ 7D43D3729FAE42C0859CDC36 /* Sign NodeJS Mobile Native Modules */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
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
";
};
- F43CB3783FD9405C8198826C /* Remove NodeJS Mobile Framework Simulator Strips */ = {
+ 54483AF1DA474A71931D6D6A /* Remove NodeJS Mobile Framework Simulator Strips */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
diff --git a/ios/drip/Info.plist b/ios/drip/Info.plist
index 9091292..8df975a 100644
--- a/ios/drip/Info.plist
+++ b/ios/drip/Info.plist
@@ -87,6 +87,7 @@
OpenSans-Regular.ttf
OpenSans-SemiBold.ttf
AntDesign.ttf
+ OpenSans-LightItalic.ttf
diff --git a/styles/index.js b/styles/index.js
index af19dba..05830f8 100644
--- a/styles/index.js
+++ b/styles/index.js
@@ -17,6 +17,7 @@ const headerFont = 'Prompt-ExtraLight'
const textFont = 'OpenSans-Light'
const textFontBold = 'OpenSans-SemiBold'
+const textFontItalic = 'OpenSans-LightItalic'
const regularSize = 16
const hintSize = 14
@@ -43,12 +44,9 @@ export default StyleSheet.create({
fontSize: regularSize,
letterSpacing: 0.5
},
- actionHint: {
- color: secondaryColor,
- fontFamily: textFont,
+ hint: {
+ fontFamily: textFontItalic,
fontSize: hintSize,
- fontWeight: 'bold',
- margin: defaultIndentation
},
paragraph: {
marginBottom: defaultBottomMargin