question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: _RNGestureHandlerModule.default.flushOperations is not a function

See original GitHub issue

Description

Issue with typing on the new version 2.4.0, the tests where we use Scrollable View (FlatList, ScrollView …) does not pass anymore

TypeError: _RNGestureHandlerModule.default.flushOperations is not a function

  at Timeout._onTimeout (node_modules/react-native-gesture-handler/lib/commonjs/handlers/gestureHandlerCommon.ts:194:30)

Platforms

  • iOS
  • Android
  • Web

Screenshots

Steps To Reproduce

  1. update to new version 2.4.0 from version 2.3.1

  2. write component that uses ScrollView for example

  3. run test

  4. test will fail with following error => ` TypeError: _RNGestureHandlerModule.default.flushOperations is not a function

    at Timeout._onTimeout (node_modules/react-native-gesture-handler/lib/commonjs/handlers/gestureHandlerCommon.ts:194:30)`

Expected behavior

Actual behavior

Snack or minimal code example

`import { ReactElement } from ‘react’; import { View, useWindowDimensions, ActivityIndicator } from ‘react-native’; import { ScrollView } from ‘react-native-gesture-handler’; import RenderHTML from ‘react-native-render-html’; import { useNavigation, useRoute } from ‘@react-navigation/native’;

import { useTranslation } from ‘src/Shared/Config’; import { Color, routeNames, sharedStyles, tagsStyle } from ‘src/Shared/constants’; import { SettingsHeader } from ‘…/SubComponents’; import { styles } from ‘./PrivacyPolicyScreen.style’; import { SettingsScreenProps, SettingsTermsOfUseProps } from ‘src/Router/types.router’;

export const PrivacyPolicyScreen = (): ReactElement => { const { t } = useTranslation(); const { params: { uri }, } = useRoute<SettingsTermsOfUseProps[‘route’]>(); const { goBack, navigate } = useNavigation<SettingsScreenProps[‘navigation’]>(); const { width: screenWidth } = useWindowDimensions();

const onClose = () => { navigate(routeNames.App); };

return ( <View testID=“privacyPolicyScreenContainer” style={[sharedStyles.fullFlex, styles.container]}> <SettingsHeader title={t(‘settings_privacy_policy_item’)} onLeftPress={goBack} onRightPress={onClose} /> <ScrollView testID="privacyPolicyScreenContent" contentContainerStyle={styles.contentContainer} style={styles.content} > <RenderHTML source={{ uri }} contentWidth={screenWidth} tagsStyles={tagsStyle} remoteLoadingView={() => <ActivityIndicator size="large" color={Color.Blue} />} /> </ScrollView> </View> ); }; `

====== Jest Test ======

` it(‘click on terms of use to the correct page’, async () => { const { getByTestId } = render(<LegalNoticesScreen />);

const termOfUseEntry = getByTestId('testId-settings_page_item_terms_use');
expect(termOfUseEntry).toBeDefined();

await act(async () => {
  fireEvent.press(termOfUseEntry);
});

await waitFor(() => expect(navContext.navigate).toHaveBeenCalledTimes(1));
expect(navContext.navigate).toHaveBeenNthCalledWith(1, routeNames.SettingsTermsOfUse, {
  uri: 'https://partoo-mobile-app.s3.eu-west-1.amazonaws.com/terms-of-use/terms-of-use_fr.html',
});

});`

==== Error ==== TypeError: _RNGestureHandlerModule.default.flushOperations is not a function

  at Timeout._onTimeout (node_modules/react-native-gesture-handler/lib/commonjs/handlers/gestureHandlerCommon.ts:194:30)

Package versions

  • React: 17.0.2
  • React Native: 0.67.4.
  • React Native Gesture Handler: 2.4.0
  • React Native Reanimated:2.7.0

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:22 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
cloudworkpro-hassencommented, May 10, 2022

I am not sure if its a similar issue but I am getting this error when running yarn test

TypeError: Cannot read properties of undefined (reading 'flushOperations')

      at Object.<anonymous> (node_modules/react-native-gesture-handler/lib/commonjs/RNGestureHandlerModule.ts:19:28)
      at Object.<anonymous> (node_modules/react-native-gesture-handler/lib/commonjs/init.ts:2:1)

  console.error
    [react-native-gesture-handler] react-native-gesture-handler module was not found. Make sure you're running your app on the native platform and your code is linked properly (cd ios && pod install && cd ..).
    
    For installation instructions, please refer to https://docs.swmansion.com/react-native-gesture-handler/docs/#installation

      at Object.<anonymous> (node_modules/react-native-gesture-handler/lib/commonjs/RNGestureHandlerModule.ts:7:11)
      at Object.<anonymous> (node_modules/react-native-gesture-handler/lib/commonjs/init.ts:2:1)

in my package.json I have this

    "react-native-gesture-handler": "^2.4.2",

Also I have linked pods for IOS

3reactions
j-piaseckicommented, Apr 21, 2022

@DominicGBauer Just released Gesture Handler 2.4.1 contains the fix for this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

react native - undefined is not an object (evaluating ...
im fix it just like mr.amiri said but im not delete my node_module im just ... Since I am not allowed to comment,...
Read more >
Troubleshooting - React Navigation
I'm getting an error "TypeError: Cannot read property 'bind' of undefined" or "TypeError: propListener.apply is not a function"​.
Read more >
[Solved]-React Native - undefined is not an object(evaluating ...
Coding example for the question React Native - undefined is not an object(evaluating 'RNGestureHandlerModule.state')-React Native.
Read more >
TypeError: _ExpoSecureStore.default.getValueWithKeyAsync ...
getValueWithKeyAsync is not a function. I am trying to use expo-secure-store in my React Native.
Read more >
undefined is not an object (evaluating ... - Edward Beazer
undefined is not an object (evaluating 'RNGestureHandlerModule.State'). Error while installing React Navigation. Sun, 06 Jan 2019. This happens when you ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found