11import * as React from 'react' ;
22import { ReactTestInstance } from 'react-test-renderer' ;
3- import { Modal , Switch , Text , TextInput , View } from 'react-native' ;
3+ import { Modal , ScrollView , Switch , Text , TextInput , View } from 'react-native' ;
44import { configureInternal , getConfig , HostComponentNames } from '../config' ;
55import { renderWithAct } from '../render-act' ;
66import { HostTestInstance } from './component-tree' ;
@@ -35,6 +35,7 @@ function detectHostComponentNames(): HostComponentNames {
3535 < Text testID = "text" > Hello</ Text >
3636 < TextInput testID = "textInput" />
3737 < Switch testID = "switch" />
38+ < ScrollView testID = "scrollView" />
3839 < Modal testID = "modal" />
3940 </ View >
4041 ) ;
@@ -43,6 +44,7 @@ function detectHostComponentNames(): HostComponentNames {
4344 text : getByTestId ( renderer . root , 'text' ) . type as string ,
4445 textInput : getByTestId ( renderer . root , 'textInput' ) . type as string ,
4546 switch : getByTestId ( renderer . root , 'switch' ) . type as string ,
47+ scrollView : getByTestId ( renderer . root , 'scrollView' ) . type as string ,
4648 modal : getByTestId ( renderer . root , 'modal' ) . type as string ,
4749 } ;
4850 } catch ( error ) {
@@ -89,6 +91,16 @@ export function isHostTextInput(
8991 return element ?. type === getHostComponentNames ( ) . textInput ;
9092}
9193
94+ /**
95+ * Checks if the given element is a host ScrollView.
96+ * @param element The element to check.
97+ */
98+ export function isHostScrollView (
99+ element ?: ReactTestInstance | null
100+ ) : element is HostTestInstance {
101+ return element ?. type === getHostComponentNames ( ) . scrollView ;
102+ }
103+
92104/**
93105 * Checks if the given element is a host Modal.
94106 * @param element The element to check.
0 commit comments