1
1
import * as React from 'react' ;
2
2
import { ReactTestInstance } from 'react-test-renderer' ;
3
- import { Modal , ScrollView , Switch , Text , TextInput , View } from 'react-native' ;
3
+ import { Image , Modal , ScrollView , Switch , Text , TextInput , View } from 'react-native' ;
4
4
import { configureInternal , getConfig , HostComponentNames } from '../config' ;
5
5
import { renderWithAct } from '../render-act' ;
6
6
import { HostTestInstance } from './component-tree' ;
@@ -34,6 +34,7 @@ function detectHostComponentNames(): HostComponentNames {
34
34
< View >
35
35
< Text testID = "text" > Hello</ Text >
36
36
< TextInput testID = "textInput" />
37
+ < Image testID = "image" />
37
38
< Switch testID = "switch" />
38
39
< ScrollView testID = "scrollView" />
39
40
< Modal testID = "modal" />
@@ -43,6 +44,7 @@ function detectHostComponentNames(): HostComponentNames {
43
44
return {
44
45
text : getByTestId ( renderer . root , 'text' ) . type as string ,
45
46
textInput : getByTestId ( renderer . root , 'textInput' ) . type as string ,
47
+ image : getByTestId ( renderer . root , 'image' ) . type as string ,
46
48
switch : getByTestId ( renderer . root , 'switch' ) . type as string ,
47
49
scrollView : getByTestId ( renderer . root , 'scrollView' ) . type as string ,
48
50
modal : getByTestId ( renderer . root , 'modal' ) . type as string ,
@@ -85,6 +87,14 @@ export function isHostTextInput(element?: ReactTestInstance | null): element is
85
87
return element ?. type === getHostComponentNames ( ) . textInput ;
86
88
}
87
89
90
+ /**
91
+ * Checks if the given element is a host Image element.
92
+ * @param element The element to check.
93
+ */
94
+ export function isHostImage ( element ?: ReactTestInstance | null ) : element is HostTestInstance {
95
+ return element ?. type === getHostComponentNames ( ) . image ;
96
+ }
97
+
88
98
/**
89
99
* Checks if the given element is a host Switch element.
90
100
* @param element The element to check.
0 commit comments