-
-
Notifications
You must be signed in to change notification settings - Fork 984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: _RNGestureHandlerModule.default.flushOperations is not a function #2007
Comments
same here :( well, almost. for me the error is about js instead of ts, but it's the same issue.
Package versionsReact: 17.0.2 |
remove this line |
error on node_modules/react-native-gesture-handler/src/mocks.ts not export method flushOperations |
We don't import ScrollView from react-native-gesture-handler
Indeed, when adding a NOOP for flushOperations on mocks, all tests work again. |
yes |
I can't do that because I have issues with react-native scrollViews when used inside Screens presented as Modals by react-navigation (Scroll does not work on android devices). So I had to use the ones from react-native-gesture-handler |
Hi! I added mock for |
Tried to patch it as you did, but it didn’t resolve my issue |
Hmm, I cannot reproduce it with the patch applied. Could you prepare a repository with a reproduction of it? |
When will the next release with this be deployed? |
@idrissakhi i had the same issue. needed to apply similar changes to |
@DominicGBauer Just released Gesture Handler 2.4.1 contains the fix for this issue. |
@j-piasecki we need to add the same code to node_modules/react-native-gesture-handler/lib/commonjs/mocks.js, otherwise the new version does not resolve this issue at 100% |
@idrissakhi the code under |
Perfect, I will test new release today 💪 |
Didn't work for me |
@hichemBAALI I'm not able to reproduce it after the fix. If this is still affecting you, could you prepare a reproduction? @idrissakhi Did the new release fix the problem for you? |
Since the discussion has stopped, I'm assuming the problem was fixed by the latest release. I'll close the issue but if you are still experiencing it, feel free to reopen it. |
I confirm that the issue is resolved, thank you @j-piasecki |
I am not sure if its a similar issue but I am getting this error when running yarn test
in my package.json I have this
Also I have linked pods for IOS |
Same issue here ^^ |
Make sure you've setup Gesture Handler's mocks correctly as described here, as it looks like mocks for GH module are missing. |
Description
Issue with typing on the new version 2.4.0, the tests where we use Scrollable View (FlatList, ScrollView ...) does not pass anymore
Platforms
Screenshots
Steps To Reproduce
update to new version 2.4.0 from version 2.3.1
write component that uses ScrollView for example
run test
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} />
<RenderHTML
source={{ uri }}
contentWidth={screenWidth}
tagsStyles={tagsStyle}
remoteLoadingView={() => }
/>
);
};
`
====== Jest Test ======
` it('click on terms of use to the correct page', async () => {
const { getByTestId } = render();
});`
==== Error ====
TypeError: _RNGestureHandlerModule.default.flushOperations is not a function
Package versions
The text was updated successfully, but these errors were encountered: