import { NativeSyntheticEvent , TextInputSelectionChangeEventData } from 'react-native' ; import { ReactTestInstance } from 'react-test-renderer' ; export function mockSelectionChangeEvent ( start , end ) { return { nativeEvent : { selection : { start , end } } } as NativeSyntheticEvent < TextInputSelectionChangeEventData > ; } export function flattenTextChild ( instance ) { const children = [ ] ; if ( Array . isArray ( instance . children ) ) { for ( const inst of instance . children ) { if ( typeof inst !== 'string' ) { children . push ( ... flattenTextChild ( inst ) ) ; } else { children . push ( inst ) ; } } } return children ; }