11import type { VideoReadyForDisplayEvent } from 'expo-av' ;
22import type { ImageContentFit } from 'expo-image' ;
3- import React , { useCallback , useEffect , useLayoutEffect , useMemo , useRef , useState } from 'react' ;
3+ import React , { useCallback , useEffect , useLayoutEffect , useRef , useState } from 'react' ;
44import { Image , InteractionManager , View } from 'react-native' ;
5- // eslint-disable-next-line no-restricted-imports
6- import type { ImageResizeMode , ImageSourcePropType , LayoutChangeEvent , ScrollView as RNScrollView , StyleProp , TextStyle , ViewStyle } from 'react-native' ;
5+ import type { ImageResizeMode , ImageSourcePropType , StyleProp , TextStyle , ViewStyle } from 'react-native' ;
76import { GestureHandlerRootView } from 'react-native-gesture-handler' ;
87import type { MergeExclusive } from 'type-fest' ;
98import useLocalize from '@hooks/useLocalize' ;
109import useNetwork from '@hooks/useNetwork' ;
1110import useResponsiveLayout from '@hooks/useResponsiveLayout' ;
12- import useSafeAreaInsets from '@hooks/useSafeAreaInsets' ;
1311import useStyleUtils from '@hooks/useStyleUtils' ;
1412import useThemeStyles from '@hooks/useThemeStyles' ;
1513import { parseFSAttributes } from '@libs/Fullstory' ;
@@ -211,10 +209,6 @@ function FeatureTrainingModal({
211209 const { shouldUseNarrowLayout} = useResponsiveLayout ( ) ;
212210 const { isOffline} = useNetwork ( ) ;
213211 const hasHelpButtonBeenPressed = useRef ( false ) ;
214- const scrollViewRef = useRef < RNScrollView > ( null ) ;
215- const [ containerHeight , setContainerHeight ] = useState ( 0 ) ;
216- const [ contentHeight , setContentHeight ] = useState ( 0 ) ;
217- const insets = useSafeAreaInsets ( ) ;
218212
219213 useEffect ( ( ) => {
220214 InteractionManager . runAfterInteractions ( ( ) => {
@@ -361,18 +355,8 @@ function FeatureTrainingModal({
361355 */
362356 useLayoutEffect ( parseFSAttributes , [ ] ) ;
363357
364- // Scrolls modal to the bottom when keyboard appears so the action buttons are visible.
365- useEffect ( ( ) => {
366- if ( contentHeight <= containerHeight || onboardingIsMediumOrLargerScreenWidth || ! shouldUseScrollView ) {
367- return ;
368- }
369- scrollViewRef . current ?. scrollToEnd ( { animated : false } ) ;
370- } , [ contentHeight , containerHeight , onboardingIsMediumOrLargerScreenWidth , shouldUseScrollView ] ) ;
371-
372358 const Wrapper = shouldUseScrollView ? ScrollView : View ;
373359
374- const wrapperStyles = useMemo ( ( ) => ( shouldUseScrollView ? StyleUtils . getScrollableFeatureTrainingModalStyles ( insets ) : { } ) , [ shouldUseScrollView , StyleUtils , insets ] ) ;
375-
376360 return (
377361 < Modal
378362 avoidKeyboard = { avoidKeyboard }
@@ -402,13 +386,9 @@ function FeatureTrainingModal({
402386 shouldUseReanimatedModal
403387 >
404388 < Wrapper
405- scrollsToTop = { false }
406- style = { [ styles . mh100 , onboardingIsMediumOrLargerScreenWidth && StyleUtils . getWidthStyle ( width ) , wrapperStyles . style ] }
407- contentContainerStyle = { wrapperStyles . containerStyle }
389+ style = { [ styles . mh100 , onboardingIsMediumOrLargerScreenWidth && StyleUtils . getWidthStyle ( width ) ] }
390+ contentContainerStyle = { shouldUseScrollView ? styles . pb5 : undefined }
408391 keyboardShouldPersistTaps = { shouldUseScrollView ? 'handled' : undefined }
409- ref = { shouldUseScrollView ? scrollViewRef : undefined }
410- onLayout = { shouldUseScrollView ? ( e : LayoutChangeEvent ) => setContainerHeight ( e . nativeEvent . layout . height ) : undefined }
411- onContentSizeChange = { shouldUseScrollView ? ( _w : number , h : number ) => setContentHeight ( h ) : undefined }
412392 fsClass = { CONST . FULL_STORY . UNMASK }
413393 testID = { CONST . FULL_STORY . UNMASK }
414394 >
@@ -417,20 +397,9 @@ function FeatureTrainingModal({
417397 </ View >
418398 < View style = { [ styles . mt5 , styles . mh5 , contentOuterContainerStyles ] } >
419399 { ! ! title && ! ! description && (
420- < View
421- style = { [
422- onboardingIsMediumOrLargerScreenWidth ? [ styles . gap1 , styles . mb8 ] : [ shouldRenderHTMLDescription ? styles . mb5 : styles . mb10 ] ,
423- contentInnerContainerStyles ,
424- ] }
425- >
400+ < View style = { [ onboardingIsMediumOrLargerScreenWidth ? [ styles . gap1 , styles . mb8 ] : [ styles . mb10 ] , contentInnerContainerStyles ] } >
426401 { typeof title === 'string' ? < Text style = { [ styles . textHeadlineH1 , titleStyles ] } > { title } </ Text > : title }
427- { shouldRenderHTMLDescription ? (
428- < View style = { styles . mb2 } >
429- < RenderHTML html = { description } />
430- </ View >
431- ) : (
432- < Text style = { styles . textSupporting } > { description } </ Text >
433- ) }
402+ { shouldRenderHTMLDescription ? < RenderHTML html = { description } /> : < Text style = { styles . textSupporting } > { description } </ Text > }
434403 { secondaryDescription . length > 0 && < Text style = { [ styles . textSupporting , styles . mt4 ] } > { secondaryDescription } </ Text > }
435404 { children }
436405 </ View >
0 commit comments