11import type { HostElement } from 'universal-test-renderer' ;
22
3- import { isValidElement } from './component-tree' ;
4-
53export const HOST_TEXT_NAMES = [ 'Text' , 'RCTText' ] ;
64const HOST_TEXT_INPUT_NAMES = [ 'TextInput' ] ;
75const HOST_IMAGE_NAMES = [ 'Image' ] ;
@@ -14,45 +12,45 @@ const HOST_MODAL_NAMES = ['Modal'];
1412 * @param element The element to check.
1513 */
1614export function isHostText ( element : HostElement | null ) {
17- return isValidElement ( element ) && HOST_TEXT_NAMES . includes ( element . type ) ;
15+ return element != null && HOST_TEXT_NAMES . includes ( element . type ) ;
1816}
1917
2018/**
2119 * Checks if the given element is a host TextInput element.
2220 * @param element The element to check.
2321 */
2422export function isHostTextInput ( element : HostElement | null ) {
25- return isValidElement ( element ) && HOST_TEXT_INPUT_NAMES . includes ( element . type ) ;
23+ return element != null && HOST_TEXT_INPUT_NAMES . includes ( element . type ) ;
2624}
2725
2826/**
2927 * Checks if the given element is a host Image element.
3028 * @param element The element to check.
3129 */
3230export function isHostImage ( element : HostElement | null ) {
33- return isValidElement ( element ) && HOST_IMAGE_NAMES . includes ( element . type ) ;
31+ return element != null && HOST_IMAGE_NAMES . includes ( element . type ) ;
3432}
3533
3634/**
3735 * Checks if the given element is a host Switch element.
3836 * @param element The element to check.
3937 */
4038export function isHostSwitch ( element : HostElement | null ) {
41- return isValidElement ( element ) && HOST_SWITCH_NAMES . includes ( element . type ) ;
39+ return element != null && HOST_SWITCH_NAMES . includes ( element . type ) ;
4240}
4341
4442/**
4543 * Checks if the given element is a host ScrollView element.
4644 * @param element The element to check.
4745 */
4846export function isHostScrollView ( element : HostElement | null ) {
49- return isValidElement ( element ) && HOST_SCROLL_VIEW_NAMES . includes ( element . type ) ;
47+ return element != null && HOST_SCROLL_VIEW_NAMES . includes ( element . type ) ;
5048}
5149
5250/**
5351 * Checks if the given element is a host Modal element.
5452 * @param element The element to check.
5553 */
5654export function isHostModal ( element : HostElement | null ) {
57- return isValidElement ( element ) && HOST_MODAL_NAMES . includes ( element . type ) ;
55+ return element != null && HOST_MODAL_NAMES . includes ( element . type ) ;
5856}
0 commit comments