@hedia/recommendation-screen 2.1.34-alpha.6 → 2.1.34-alpha.8

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hedia/recommendation-screen",
3
- "version": "2.1.34-alpha.6",
3
+ "version": "2.1.34-alpha.8",
4
4
  "description": "Hedia Recommendation Screen for Bolus and Carbohydrates",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -141,6 +141,7 @@ export default class RecommendationScreen extends React.Component<IRecommendatio
141
141
  * A reference to the screens scrollview allowing us to programmatically scroll the screen in the handleNoRecentInsulin() method.
142
142
  * The member is initiated without a value but will be set as soon as the component is being rendered.
143
143
  */
144
+ private scrollViewRef?;
144
145
  /**
145
146
  * A reference to the eventSubscription that'll be returned by AppState.addEventListener().
146
147
  * It'll allow us to later remove the subscription.
@@ -197,7 +197,11 @@ export default class RecommendationScreen extends React.Component {
197
197
  * so all relevant elements are visible on the screen and the scroll happens reliably.
198
198
  */
199
199
  this.handleNoRecentInsulin = () => {
200
- this.setState({ isRecommendationDisplayed: true });
200
+ this.setState({ isRecommendationDisplayed: true }, () => {
201
+ setImmediate(() => {
202
+ this.scrollViewRef?.scrollToEnd({ animated: false });
203
+ });
204
+ });
201
205
  };
202
206
  /**
203
207
  * Handle what happens when the user changes the content of the additional carbohydrates input field.
@@ -435,7 +439,7 @@ export default class RecommendationScreen extends React.Component {
435
439
  return (<I18nProvider language={this.props.language} i18n={i18n}>
436
440
  <ScrollView testID={RecommendationScreenTestIds.RecommendationScrollView} style={containerStyles.container} ref={(view) => {
437
441
  if (view !== null) {
438
- // this.scrollViewRef = view;
442
+ this.scrollViewRef = view;
439
443
  }
440
444
  }}>
441
445
  <Header exitCallback={this.onExit}/>
@@ -456,7 +460,7 @@ export default class RecommendationScreen extends React.Component {
456
460
  </View>
457
461
  {this.props.calculatorParams.activity && this.props.activityDisplayProps ? (<Activity activity={this.props.calculatorParams.activity} activityType={this.props.activityDisplayProps.activityType} activityTitle={this.props.activityDisplayProps.activityTitle} activityReduction={this.state.activityReduction}/>) : null}
458
462
  <Remeasure onSliderChange={this.updateRemeasureTime} remeasureTime={this.state.remeasureTime}/>
459
- {!this.state.isRecommendationDisplayed ? (<RecentInsulin onRecentInsulinYes={this.props.onRecentInsulinYes} onRecentInsulinNo={this.handleNoRecentInsulin}/>) : (<RecommendedInsulin injectionMethod={this.props.injectionMethod} insulinRecommendation={insulinRecommendation} enteredInsulin={enteredInsulin} activityReduction={activityReduction} updateRecommendedInsulin={this.updateInsulinRecommendation}/>)}
463
+ {!isRecommendationDisplayed ? (<RecentInsulin onRecentInsulinYes={this.props.onRecentInsulinYes} onRecentInsulinNo={this.handleNoRecentInsulin}/>) : (<RecommendedInsulin injectionMethod={this.props.injectionMethod} insulinRecommendation={insulinRecommendation} enteredInsulin={enteredInsulin} activityReduction={activityReduction} updateRecommendedInsulin={this.updateInsulinRecommendation}/>)}
460
464
  <Emotion moodSelected={this.handleMoodSelected} currentMood={this.state.selectedMood}/>
461
465
  <TransferToLogbook visible={isRecommendationDisplayed} transfer={this.handleTransfer}/>
462
466
  <RecommendationModal isVisible={recommendationModal} suggestedCarbohydrates={carbRecommendationProp} attentionMessage={this.getBGLevelAttentionMessage()} limitationMessage={this.getLimitationAttentionMessage()} onClickOkButton={this.hideAttentionModal} onAcceptCarbohydrates={this.acceptCarbRecommendation} onDeclineCarbohydrates={this.declineCarbRecommendation}/>