@@ -34,10 +34,23 @@ jest.mock('expo-audio', () => ({
3434 setIsAudioActiveAsync : jest . fn ( ) ,
3535} ) ) ;
3636
37- // Mock Platform.OS for React Native
38- jest . mock ( 'react-native/Libraries/Utilities/Platform' , ( ) => ( {
39- OS : 'ios' ,
40- select : jest . fn ( ) . mockImplementation ( ( obj ) => obj . ios || obj . default ) ,
37+ // Mock the host component names function to prevent testing library errors
38+ jest . mock ( '@testing-library/react-native/build/helpers/host-component-names' , ( ) => ( {
39+ getHostComponentNames : jest . fn ( ( ) => ( {
40+ text : 'Text' ,
41+ view : 'View' ,
42+ scrollView : 'ScrollView' ,
43+ touchable : 'TouchableOpacity' ,
44+ switch : 'Switch' ,
45+ textInput : 'TextInput' ,
46+ } ) ) ,
47+ configureHostComponentNamesIfNeeded : jest . fn ( ) ,
48+ isHostText : jest . fn ( ( element ) => element ?. type === 'Text' || element ?. _fiber ?. type === 'Text' || ( typeof element === 'object' && element ?. props ?. children && typeof element . props . children === 'string' ) ) ,
49+ isHostTextInput : jest . fn ( ( element ) => element ?. type === 'TextInput' || element ?. _fiber ?. type === 'TextInput' ) ,
50+ isHostImage : jest . fn ( ( element ) => element ?. type === 'Image' || element ?. _fiber ?. type === 'Image' ) ,
51+ isHostSwitch : jest . fn ( ( element ) => element ?. type === 'Switch' || element ?. _fiber ?. type === 'Switch' ) ,
52+ isHostScrollView : jest . fn ( ( element ) => element ?. type === 'ScrollView' || element ?. _fiber ?. type === 'ScrollView' ) ,
53+ isHostModal : jest . fn ( ( element ) => element ?. type === 'Modal' || element ?. _fiber ?. type === 'Modal' ) ,
4154} ) ) ;
4255
4356// Global mocks for common problematic modules
0 commit comments