11import React from 'react' ;
22import type { OnyxEntry } from 'react-native-onyx' ;
33import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription' ;
4+ import { useProductTrainingContext } from '@components/ProductTrainingContext' ;
45import { useCurrencyListActions } from '@hooks/useCurrencyList' ;
56import useLocalize from '@hooks/useLocalize' ;
67import useNetwork from '@hooks/useNetwork' ;
78import useThemeStyles from '@hooks/useThemeStyles' ;
89import DistanceRequestUtils from '@libs/DistanceRequestUtils' ;
910import Navigation from '@libs/Navigation/Navigation' ;
11+ import variables from '@styles/variables' ;
1012import CONST from '@src/CONST' ;
1113import type { IOUAction , IOUType } from '@src/CONST' ;
1214import ROUTES from '@src/ROUTES' ;
@@ -30,6 +32,7 @@ type RateFieldProps = {
3032 formError : string ;
3133 shouldNavigateToUpgradePath : boolean ;
3234 shouldSelectPolicy : boolean ;
35+ shouldShowRateAutoUpdatedTooltip ?: boolean ;
3336} ;
3437
3538function RateField ( {
@@ -49,6 +52,7 @@ function RateField({
4952 formError,
5053 shouldNavigateToUpgradePath,
5154 shouldSelectPolicy,
55+ shouldShowRateAutoUpdatedTooltip,
5256} : RateFieldProps ) {
5357 const styles = useThemeStyles ( ) ;
5458 const { translate, toLocaleDigit} = useLocalize ( ) ;
@@ -59,6 +63,11 @@ function RateField({
5963 const isTrackExpense = iouType === CONST . IOU . TYPE . TRACK ;
6064 const isRateInteractive = ! ! rate && ! isReadOnly && iouType !== CONST . IOU . TYPE . SPLIT ;
6165
66+ const { renderProductTrainingTooltip, shouldShowProductTrainingTooltip, hideProductTrainingTooltip} = useProductTrainingContext (
67+ CONST . PRODUCT_TRAINING_TOOLTIP_NAMES . MILEAGE_RATE_AUTO_UPDATED ,
68+ ! ! shouldShowRateAutoUpdatedTooltip ,
69+ ) ;
70+
6271 return (
6372 < MenuItemWithTopDescription
6473 shouldShowRightIcon = { isRateInteractive }
@@ -99,6 +108,14 @@ function RateField({
99108 disabled = { didConfirm }
100109 interactive = { isRateInteractive }
101110 sentryLabel = { CONST . SENTRY_LABEL . REQUEST_CONFIRMATION_LIST . RATE_FIELD }
111+ shouldRenderTooltip = { shouldShowProductTrainingTooltip }
112+ renderTooltipContent = { renderProductTrainingTooltip }
113+ tooltipWrapperStyle = { styles . productTrainingTooltipWrapper }
114+ tooltipAnchorAlignment = { { horizontal : CONST . MODAL . ANCHOR_ORIGIN_HORIZONTAL . LEFT , vertical : CONST . MODAL . ANCHOR_ORIGIN_VERTICAL . BOTTOM } }
115+ tooltipShiftHorizontal = { variables . mileageRateTooltipShiftHorizontal }
116+ tooltipShiftVertical = { variables . mileageRateTooltipShiftVertical }
117+ onEducationTooltipPress = { hideProductTrainingTooltip }
118+ shouldHideOnScroll
102119 />
103120 ) ;
104121}
0 commit comments