@hedia/recommendation-screen 2.1.42 → 2.1.43-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/src/RecommendationScreen.js +337 -312
  2. package/dist/src/components/Header.js +4 -4
  3. package/dist/src/components/Icon.js +2 -0
  4. package/dist/src/components/InfoBars.d.ts +0 -2
  5. package/dist/src/components/InfoBars.js +39 -42
  6. package/dist/src/components/InvisibleNumberInput.js +70 -71
  7. package/dist/src/components/LimitationMessage.js +13 -14
  8. package/dist/src/components/RecentInsulin.js +19 -19
  9. package/dist/src/components/RecommendationModal.d.ts +0 -1
  10. package/dist/src/components/RecommendationModal.js +73 -65
  11. package/dist/src/components/RecommendedCarbs.js +101 -97
  12. package/dist/src/components/RecommendedInsulin.js +98 -95
  13. package/dist/src/components/Remeasure.js +34 -32
  14. package/dist/src/components/TransferToLogbook.js +23 -25
  15. package/dist/src/components/TwoOptionModal.d.ts +0 -10
  16. package/dist/src/components/TwoOptionModal.js +10 -18
  17. package/dist/src/components/activity/Activity.js +14 -12
  18. package/dist/src/components/activity/ActivityIcon.js +11 -11
  19. package/dist/src/components/activity/ActivityIntensity.js +16 -19
  20. package/dist/src/components/mood/Emotion.js +29 -32
  21. package/dist/src/components/mood/MoodIcon.js +23 -26
  22. package/dist/src/components/text/TextBold.d.ts +8 -0
  23. package/dist/src/components/text/TextBold.js +12 -0
  24. package/dist/src/components/text/TextRegular.d.ts +8 -0
  25. package/dist/src/components/text/TextRegular.js +12 -0
  26. package/dist/src/utils/AttentionMessages.js +36 -36
  27. package/dist/src/utils/RecommendationError.js +1 -0
  28. package/dist/src/utils/Utils.js +15 -15
  29. package/package.json +5 -5
@@ -1,8 +1,9 @@
1
1
  import { Activity } from "@hedia/types";
2
2
  import { t } from "@lingui/macro";
3
3
  import React from "react";
4
- import { Dimensions, Image, StyleSheet, Text, View } from "react-native";
4
+ import { Dimensions, Image, StyleSheet, View } from "react-native";
5
5
  import { i18n } from "../../locale/i18nUtils";
6
+ import TextRegular from "../text/TextRegular";
6
7
  const { Other } = Activity.Enums.ActivityEnum;
7
8
  /** Mapping from ActivityEnums to corresponding image resource. */
8
9
  export const ACTIVITY_ICONS = {
@@ -14,15 +15,12 @@ export const ACTIVITY_ICONS = {
14
15
  };
15
16
  /** Component used to displat the user's physical activity type icon */
16
17
  export default class ActivityIcon extends React.Component {
17
- constructor() {
18
- super(...arguments);
19
- /**
20
- * @returns The value from the ACTIVITY_ICONS constant that corresponds to the value of the activityType prop.
21
- */
22
- this.getActivityIcon = () => {
23
- return ACTIVITY_ICONS[this.props.activityType ?? Other];
24
- };
25
- }
18
+ /**
19
+ * @returns The value from the ACTIVITY_ICONS constant that corresponds to the value of the activityType prop.
20
+ */
21
+ getActivityIcon = () => {
22
+ return ACTIVITY_ICONS[this.props.activityType ?? Other];
23
+ };
26
24
  /**
27
25
  * Steps:
28
26
  * 1. Unpack activityType and activityTitle from props.
@@ -36,7 +34,9 @@ export default class ActivityIcon extends React.Component {
36
34
  const testID = `${Activity.Enums.ActivityEnum[activityType ?? Other]}-icon`.toLowerCase();
37
35
  return (<View style={activityIconStyles.container}>
38
36
  <Image style={activityIconStyles.activityIcon} source={this.getActivityIcon()} testID={testID}/>
39
- <Text style={activityIconStyles.activityTitle}>{activityTitle || i18n._(t `Untitled Activity`)}</Text>
37
+ <TextRegular style={activityIconStyles.activityTitle}>
38
+ {activityTitle || i18n._(t `Untitled Activity`)}
39
+ </TextRegular>
40
40
  </View>);
41
41
  }
42
42
  }
@@ -1,33 +1,31 @@
1
1
  import { Activity } from "@hedia/types";
2
2
  import React from "react";
3
- import { Dimensions, StyleSheet, Text, View } from "react-native";
3
+ import { Dimensions, StyleSheet, View } from "react-native";
4
4
  import { ActivityIntensityTranslations } from "../../utils/Translations";
5
5
  import { infoStyles } from "../InfoBars";
6
+ import TextBold from "../text/TextBold";
6
7
  /** Component used to display the users's physical activity intensity on its corresponding background color */
7
8
  export default class ActivityIntensity extends React.Component {
8
- constructor() {
9
- super(...arguments);
10
- /**
11
- * Steps:
12
- * 1. Set intensity to the activityIntensity prop.
13
- * 2. Set the style variable to the style that correspond to the intensity.
14
- * @returns JSX element that displays the intensity of the user’s activity along with the associated color coding
15
- */
16
- this.render = () => {
17
- const intensity = this.props.activityIntensity;
18
- const style = activityIntensityStyles[intensity];
19
- return (<View style={[infoStyles.margin, activityIntensityStyles.row]}>
9
+ /**
10
+ * Steps:
11
+ * 1. Set intensity to the activityIntensity prop.
12
+ * 2. Set the style variable to the style that correspond to the intensity.
13
+ * @returns JSX element that displays the intensity of the user’s activity along with the associated color coding
14
+ */
15
+ render = () => {
16
+ const intensity = this.props.activityIntensity;
17
+ const style = activityIntensityStyles[intensity];
18
+ return (<View style={[infoStyles.margin, activityIntensityStyles.row]}>
20
19
  <View style={activityIntensityStyles.intensityContainer}>
21
20
  <View style={[activityIntensityStyles.intensityTextContainer, style]}>
22
- <Text style={activityIntensityStyles.bold} testID={`intensity-${intensity}`}>
21
+ <TextBold style={activityIntensityStyles.text} testID={`intensity-${intensity}`}>
23
22
  {ActivityIntensityTranslations[intensity]()}
24
- </Text>
23
+ </TextBold>
25
24
  </View>
26
25
  </View>
27
26
  <View style={activityIntensityStyles.intensityContainerOffset}/>
28
27
  </View>);
29
- };
30
- }
28
+ };
31
29
  }
32
30
  const activityIntensityStyles = StyleSheet.create({
33
31
  row: {
@@ -54,8 +52,7 @@ const activityIntensityStyles = StyleSheet.create({
54
52
  intensityContainerOffset: {
55
53
  flex: 16,
56
54
  },
57
- bold: {
58
- fontWeight: `bold`,
55
+ text: {
59
56
  fontSize: Dimensions.get(`screen`).width / 30,
60
57
  },
61
58
  });
@@ -1,48 +1,46 @@
1
1
  import { Logbook } from "@hedia/types";
2
2
  import { t } from "@lingui/macro";
3
3
  import React from "react";
4
- import { Dimensions, StyleSheet, Text, View } from "react-native";
4
+ import { Dimensions, StyleSheet, View } from "react-native";
5
5
  import { i18n } from "../../locale/i18nUtils";
6
+ import TextBold from "../text/TextBold";
6
7
  import MoodIcon from "./MoodIcon";
7
8
  const MoodEnum = Logbook.Enums.MoodEnum;
8
9
  /** The Emotion component displays a horizontally arranged set of icons representing various moods and allows the user to select one. */
9
10
  export default class Emotion extends React.Component {
10
- constructor() {
11
- super(...arguments);
12
- /**
13
- * Handle what should happen when the user picks taps on one of the mood icons.
14
- *
15
- * Steps:
16
- * 1. Call the moodSelected prop callback function with selected as argument if toggle is true and null as argument otherwise.
17
- * @param selected Integer number that represents the icon that was tapped.
18
- * @param toggle Boolean indicating whether the icon should be deselected.
19
- */
20
- this.handleIconPress = (selected, toggle) => {
21
- this.props.moodSelected(toggle ? selected : null);
22
- };
23
- /**
24
- * Compose a sequence of MoodIcons
25
- *
26
- * Steps:
27
- * 1. Make a sequence of MoodEnum values from the properties of the MoodEnum object and save the sequence as a variable named values.
28
- * 2. Map each of the elements of the values sequence to a MoodIcon.
29
- * @returns JSX Element consisting of an array of MoodIcon components.
30
- */
31
- this.mappedMoods = () => {
32
- const values = Object.values(MoodEnum).filter((val) => isNaN(Number(val)));
33
- return values.map((key) => {
34
- const moodValue = MoodEnum[key];
35
- return (<MoodIcon onPress={(toggle) => this.handleIconPress(moodValue, toggle)} active={moodValue === this.props.currentMood} mood={moodValue} key={moodValue}/>);
36
- });
37
- };
38
- }
11
+ /**
12
+ * Handle what should happen when the user picks taps on one of the mood icons.
13
+ *
14
+ * Steps:
15
+ * 1. Call the moodSelected prop callback function with selected as argument if toggle is true and null as argument otherwise.
16
+ * @param selected Integer number that represents the icon that was tapped.
17
+ * @param toggle Boolean indicating whether the icon should be deselected.
18
+ */
19
+ handleIconPress = (selected, toggle) => {
20
+ this.props.moodSelected(toggle ? selected : null);
21
+ };
22
+ /**
23
+ * Compose a sequence of MoodIcons
24
+ *
25
+ * Steps:
26
+ * 1. Make a sequence of MoodEnum values from the properties of the MoodEnum object and save the sequence as a variable named values.
27
+ * 2. Map each of the elements of the values sequence to a MoodIcon.
28
+ * @returns JSX Element consisting of an array of MoodIcon components.
29
+ */
30
+ mappedMoods = () => {
31
+ const values = Object.values(MoodEnum).filter((val) => isNaN(Number(val)));
32
+ return values.map((key) => {
33
+ const moodValue = MoodEnum[key];
34
+ return (<MoodIcon onPress={(toggle) => this.handleIconPress(moodValue, toggle)} active={moodValue === this.props.currentMood} mood={moodValue} key={moodValue}/>);
35
+ });
36
+ };
39
37
  /**
40
38
  * @returns JSX element to display the mood icons from mappedMoods() in a horizontal arrangement.
41
39
  */
42
40
  render() {
43
41
  return (<View style={emotionStyles.container}>
44
42
  <View style={emotionStyles.feelingContainer}>
45
- <Text style={emotionStyles.feelingText}>{i18n._(t `How are you feeling?`)}</Text>
43
+ <TextBold style={emotionStyles.feelingText}>{i18n._(t `How are you feeling?`)}</TextBold>
46
44
  </View>
47
45
  <View style={emotionStyles.moodIconContainer}>{this.mappedMoods()}</View>
48
46
  </View>);
@@ -58,7 +56,6 @@ const emotionStyles = StyleSheet.create({
58
56
  feelingText: {
59
57
  textAlign: `center`,
60
58
  color: `white`,
61
- fontWeight: `bold`,
62
59
  fontSize: Dimensions.get(`screen`).width / 26,
63
60
  },
64
61
  moodIconContainer: { flex: 1, flexDirection: `row`, justifyContent: `center` },
@@ -20,32 +20,29 @@ export const MOODS_ACTIVE = {
20
20
  };
21
21
  /** Component to display a mood icon base on its props. */
22
22
  export default class MoodIcon extends React.Component {
23
- constructor() {
24
- super(...arguments);
25
- /**
26
- * Get the icon image resource that should be displayed for the mood icon.
27
- *
28
- * Steps:
29
- * 1. If the active prop is true, return the value from the MOODS_ACTIVE constant that corresponds to the value of the mood prop.
30
- * 2. (Only reached if the active prop is false) Return the value from the MOODS_INACTIVE constant that corresponds to the value of the mood prop.
31
- * @returns Image resource that should be displayed for the mood icon.
32
- */
33
- this.getMoodIcon = () => {
34
- if (this.props.active) {
35
- return MOODS_ACTIVE[this.props.mood];
36
- }
37
- return MOODS_INACTIVE[this.props.mood];
38
- };
39
- /**
40
- * Handle what happens when the mood icon is pressed.
41
- *
42
- * Steps:
43
- * 1. Call the onPress prop callback function with the toggle argument set to the inverse value of the active prop.
44
- */
45
- this.handleOnPress = () => {
46
- this.props.onPress(!this.props.active);
47
- };
48
- }
23
+ /**
24
+ * Get the icon image resource that should be displayed for the mood icon.
25
+ *
26
+ * Steps:
27
+ * 1. If the active prop is true, return the value from the MOODS_ACTIVE constant that corresponds to the value of the mood prop.
28
+ * 2. (Only reached if the active prop is false) Return the value from the MOODS_INACTIVE constant that corresponds to the value of the mood prop.
29
+ * @returns Image resource that should be displayed for the mood icon.
30
+ */
31
+ getMoodIcon = () => {
32
+ if (this.props.active) {
33
+ return MOODS_ACTIVE[this.props.mood];
34
+ }
35
+ return MOODS_INACTIVE[this.props.mood];
36
+ };
37
+ /**
38
+ * Handle what happens when the mood icon is pressed.
39
+ *
40
+ * Steps:
41
+ * 1. Call the onPress prop callback function with the toggle argument set to the inverse value of the active prop.
42
+ */
43
+ handleOnPress = () => {
44
+ this.props.onPress(!this.props.active);
45
+ };
49
46
  /** JSX element to display the mood icon retrieved using the getMoodIcon() method. */
50
47
  render() {
51
48
  const { mood, active } = this.props;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { TextProps, TextStyle } from "react-native";
3
+ interface IProps extends Omit<TextProps, `style`> {
4
+ style: TextStyle;
5
+ }
6
+ /** Component used to set the font family to Roboto-Bold */
7
+ declare const TextBold: (props: IProps) => JSX.Element;
8
+ export default TextBold;
@@ -0,0 +1,12 @@
1
+ import * as React from "react";
2
+ import { StyleSheet, Text } from "react-native";
3
+ /** Component used to set the font family to Roboto-Bold */
4
+ const TextBold = (props) => (<Text {...props} style={[styles.defaultText, props.style]}>
5
+ {props.children}
6
+ </Text>);
7
+ const styles = StyleSheet.create({
8
+ defaultText: {
9
+ fontFamily: `Roboto-Bold`,
10
+ },
11
+ });
12
+ export default TextBold;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { TextProps, TextStyle } from "react-native";
3
+ interface IProps extends Omit<TextProps, `style`> {
4
+ style: TextStyle;
5
+ }
6
+ /** Component used to set the font family to Roboto-Regular */
7
+ declare const TextRegular: (props: IProps) => JSX.Element;
8
+ export default TextRegular;
@@ -0,0 +1,12 @@
1
+ import * as React from "react";
2
+ import { StyleSheet, Text } from "react-native";
3
+ /** Component used to set the font family to Roboto-Regular */
4
+ const TextRegular = (props) => (<Text {...props} style={[styles.defaultText, props.style]}>
5
+ {props.children}
6
+ </Text>);
7
+ const styles = StyleSheet.create({
8
+ defaultText: {
9
+ fontFamily: `Roboto-Regular`,
10
+ },
11
+ });
12
+ export default TextRegular;
@@ -73,46 +73,46 @@ export function getLimitedValue(reduction) {
73
73
  }
74
74
  /** Provides methods for getting strings for composing attention messages and other important communications to the user. */
75
75
  export class Messages {
76
- }
77
- /** Inform the user that their BGL is very low and what they should do about it. */
78
- Messages.VeryLowBGL = () => i18n._(t `Your blood glucose level is very low. Take glucagon or eat carbohydrates if possible. Seek medical attention.`);
79
- /** Inform the user that their BGL is very low. */
80
- Messages.LowBGL = () => i18n._(t `Your blood glucose level is very low.`);
81
- /** Inform the user that they will be reminded to remeasure their BGL soon. */
82
- Messages.Reminder15Minutes = () => i18n._(t `You will be reminded to measure your blood glucose level in 15 min.`);
83
- /** Encourages the user to postpone exercise. Specifically when their BGL is high. */
84
- Messages.PostponePhysicalActivity = () => i18n._(t `If it is possible, postpone your planned exercise.`);
85
- /** Encourages the user to postpone exercise. Specifically when their BGL is low. */
86
- Messages.PostponePhysicalActivityUnder5MMOL = () => i18n._(t `Consider not to initiate physical activity before your blood glucose level is within the recommended ranges prior to physical activity.`);
87
- /** Inform about high BGL. */
88
- Messages.HighBGL = () => i18n._(t `You have a high blood glucose level.`);
89
- /** Encourage user to measure ketones. */
90
- Messages.InsulinKetones = () => i18n._(t `You should take rapid-acting insulin and measure ketones.`);
91
- /** Inform the user that their insulin recommendation was limited for safety. */
92
- Messages.RecommendationWasLimited = () => i18n._(t `Your recommendation would have been higher than ${SAFETY_INSULIN_LIMIT} units of insulin, but it has been limited for safety reasons.
76
+ /** Inform the user that their BGL is very low and what they should do about it. */
77
+ static VeryLowBGL = () => i18n._(t `Your blood glucose level is very low. Take glucagon or eat carbohydrates if possible. Seek medical attention.`);
78
+ /** Inform the user that their BGL is very low. */
79
+ static LowBGL = () => i18n._(t `Your blood glucose level is very low.`);
80
+ /** Inform the user that they will be reminded to remeasure their BGL soon. */
81
+ static Reminder15Minutes = () => i18n._(t `You will be reminded to measure your blood glucose level in 15 min.`);
82
+ /** Encourages the user to postpone exercise. Specifically when their BGL is high. */
83
+ static PostponePhysicalActivity = () => i18n._(t `If it is possible, postpone your planned exercise.`);
84
+ /** Encourages the user to postpone exercise. Specifically when their BGL is low. */
85
+ static PostponePhysicalActivityUnder5MMOL = () => i18n._(t `Consider not to initiate physical activity before your blood glucose level is within the recommended ranges prior to physical activity.`);
86
+ /** Inform about high BGL. */
87
+ static HighBGL = () => i18n._(t `You have a high blood glucose level.`);
88
+ /** Encourage user to measure ketones. */
89
+ static InsulinKetones = () => i18n._(t `You should take rapid-acting insulin and measure ketones.`);
90
+ /** Inform the user that their insulin recommendation was limited for safety. */
91
+ static RecommendationWasLimited = () => i18n._(t `Your recommendation would have been higher than ${SAFETY_INSULIN_LIMIT} units of insulin, but it has been limited for safety reasons.
93
92
  Hedia never recommends more than ${SAFETY_INSULIN_LIMIT} units of insulin per calculation.`);
94
- /** Inform the user that their insulin recommendation was limited for safety in combination with an activity. */
95
- Messages.RecommendationWasLimitedActivity = (activityReduction) => i18n._(t `Your recommendation would have been higher than ${getLimitedValue(activityReduction)}
93
+ /** Inform the user that their insulin recommendation was limited for safety in combination with an activity. */
94
+ static RecommendationWasLimitedActivity = (activityReduction) => i18n._(t `Your recommendation would have been higher than ${getLimitedValue(activityReduction)}
96
95
  units of insulin, but it has been limited for safety reasons.${`\n\n`}
97
96
  Hedia never recommends more than ${SAFETY_INSULIN_LIMIT}
98
97
  units of insulin per calculation, but because of the physical activity
99
98
  you entered it has been further reduced by ${(activityReduction * 100).toFixed(0)}% to
100
99
  ${getLimitedValue(activityReduction)}.`);
101
- /** Inform the user that the insulin amount they entered is above HDA’s safety limit. */
102
- Messages.InsulinInputWasLimited = (activityReduction) => activityReduction
103
- ? i18n._(t `Hedia doesn't support more than ${SAFETY_INSULIN_LIMIT} units of insulin per calculation, but because of the physical activity you entered it has been further reduced by
100
+ /** Inform the user that the insulin amount they entered is above HDA’s safety limit. */
101
+ static InsulinInputWasLimited = (activityReduction) => activityReduction
102
+ ? i18n._(t `Hedia doesn't support more than ${SAFETY_INSULIN_LIMIT} units of insulin per calculation, but because of the physical activity you entered it has been further reduced by
104
103
  ${(activityReduction * 100).toFixed(0)}% to ${getLimitedValue(activityReduction)} units for this calculation.`)
105
- : i18n._(t `Hedia does not support more than ${SAFETY_INSULIN_LIMIT} units of insulin per calculation.`);
106
- /** Title for the modal that informs the user that their calculation is too old. */
107
- Messages.TimeoutPrompTitle = () => i18n._(t `More than 15 minutes has passed since this calculation was started.`);
108
- /**
109
- * Inform the user that their recommendation calculation is too old.
110
- * Variant to show when they didn’t see the actual insulin recommendation because they didn’t tell whether they injected insulin recently.
111
- */
112
- Messages.TimeoutRecommendationNotVisible = () => i18n._(t `Please go through the calculation steps with new measurements to ensure a safe recommendation.`);
113
- /** Inform the user that their recommendation calculation is too old. */
114
- Messages.TimeoutRecommendationVisible = (date) => {
115
- const day = moment(date).format(`LL`);
116
- const time = moment(date).format(`HH:mm`);
117
- return i18n._(t `Recommendation from ${day} at ${time} was not transfered to your logbook.${`\n`}Did you use the recommendation?`);
118
- };
104
+ : i18n._(t `Hedia does not support more than ${SAFETY_INSULIN_LIMIT} units of insulin per calculation.`);
105
+ /** Title for the modal that informs the user that their calculation is too old. */
106
+ static TimeoutPrompTitle = () => i18n._(t `More than 15 minutes has passed since this calculation was started.`);
107
+ /**
108
+ * Inform the user that their recommendation calculation is too old.
109
+ * Variant to show when they didn’t see the actual insulin recommendation because they didn’t tell whether they injected insulin recently.
110
+ */
111
+ static TimeoutRecommendationNotVisible = () => i18n._(t `Please go through the calculation steps with new measurements to ensure a safe recommendation.`);
112
+ /** Inform the user that their recommendation calculation is too old. */
113
+ static TimeoutRecommendationVisible = (date) => {
114
+ const day = moment(date).format(`LL`);
115
+ const time = moment(date).format(`HH:mm`);
116
+ return i18n._(t `Recommendation from ${day} at ${time} was not transfered to your logbook.${`\n`}Did you use the recommendation?`);
117
+ };
118
+ }
@@ -11,6 +11,7 @@ const SAFETY_INSULIN_LIMIT = BolusCalculator.Constants.SAFETY_INSULIN_LIMIT;
11
11
  * from getting a recommendation until the problem is solved.
12
12
  */
13
13
  export class RecommendationError extends Error {
14
+ type;
14
15
  constructor(message, type) {
15
16
  super(message);
16
17
  this.type = type;
@@ -109,6 +109,21 @@ export class Utils {
109
109
  static displayedBKLValue(value, unit) {
110
110
  return unit === BloodKetonesUnit.MMOL_L ? value.toFixed(1) : `${Utils.convertBKLToMGDL(value)}`;
111
111
  }
112
+ /**
113
+ * Format a measurement unit for displaying to the user. More concrete, it is used to display the litre symbol with uppercase "L".
114
+ *
115
+ * Steps:
116
+ * 1. Set unitWithoutLastLetter to be unit except for the last character.
117
+ * 2. Set lastLetterUppercase to be the last letter of unit converted to uppercase.
118
+ * 3. Return unitWithoutLastLetter concatenated with lastLetterUppercase.
119
+ * @param unit The measurement unit to format.
120
+ * @returns The measurement unit formatted for displaying to the user.
121
+ */
122
+ static formatUnit = (unit) => {
123
+ const unitWithoutLastLetter = unit.substring(0, unit.length - 1);
124
+ const lastLetterUppercase = unit.substring(unit.length - 1, unit.length).toUpperCase();
125
+ return `${unitWithoutLastLetter}${lastLetterUppercase}`;
126
+ };
112
127
  /**
113
128
  * Returns the key of key/value object when passing the key value as argument.
114
129
  *
@@ -124,18 +139,3 @@ export class Utils {
124
139
  return Object.keys(keys)[values.indexOf(value)];
125
140
  }
126
141
  }
127
- /**
128
- * Format a measurement unit for displaying to the user. More concrete, it is used to display the litre symbol with uppercase "L".
129
- *
130
- * Steps:
131
- * 1. Set unitWithoutLastLetter to be unit except for the last character.
132
- * 2. Set lastLetterUppercase to be the last letter of unit converted to uppercase.
133
- * 3. Return unitWithoutLastLetter concatenated with lastLetterUppercase.
134
- * @param unit The measurement unit to format.
135
- * @returns The measurement unit formatted for displaying to the user.
136
- */
137
- Utils.formatUnit = (unit) => {
138
- const unitWithoutLastLetter = unit.substring(0, unit.length - 1);
139
- const lastLetterUppercase = unit.substring(unit.length - 1, unit.length).toUpperCase();
140
- return `${unitWithoutLastLetter}${lastLetterUppercase}`;
141
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hedia/recommendation-screen",
3
- "version": "2.1.42",
3
+ "version": "2.1.43-alpha.0",
4
4
  "description": "Hedia Recommendation Screen for Bolus and Carbohydrates",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -54,8 +54,8 @@
54
54
  "@types/lingui__core": "2.7.0",
55
55
  "@types/lingui__macro": "2.7.3",
56
56
  "@types/lingui__react": "2.8.2",
57
- "@types/react": "16.9.35",
58
- "@types/react-native": "0.65.3",
57
+ "@types/react": "17.0.28",
58
+ "@types/react-native": "0.67.3",
59
59
  "@types/react-test-renderer": "17.0.1",
60
60
  "babel-core": "7.0.0-bridge.0",
61
61
  "babel-jest": "26.0.1",
@@ -66,7 +66,7 @@
66
66
  "npm-package-json-lint": "5.4.1",
67
67
  "prettier": "2.5.1",
68
68
  "react": "17.0.2",
69
- "react-native": "0.66.3",
69
+ "react-native": "0.67.3",
70
70
  "react-native-keyboard-aware-scroll-view": "0.9.5",
71
71
  "react-native-linear-gradient": "2.5.6",
72
72
  "react-native-testing-library": "2.1.0",
@@ -76,7 +76,7 @@
76
76
  "tslint-config-prettier": "1.18.0",
77
77
  "typedoc": "0.21.10",
78
78
  "typedoc-plugin-no-inherit": "1.3.1",
79
- "typescript": "4.1.5"
79
+ "typescript": "4.4.3"
80
80
  },
81
81
  "dependencies": {
82
82
  "@hedia/types": "2.2.1",