Skip to content
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

ReferenceError: Can't find variable: queueMicrotask #2505

Closed
abdulrafeh857 opened this issue Jun 8, 2023 · 7 comments · Fixed by #2612
Closed

ReferenceError: Can't find variable: queueMicrotask #2505

abdulrafeh857 opened this issue Jun 8, 2023 · 7 comments · Fixed by #2612
Labels
Missing repro Platform: Android This issue is specific to Android Platform: iOS This issue is specific to iOS

Comments

@abdulrafeh857
Copy link

abdulrafeh857 commented Jun 8, 2023

Description

I am experiencing this error in react-native-gesture-handler. I don't know the cause of this error because it was working absolutely fine.

"react-native" : 0.65.1
"react-native-gesture-handler" - 2.11.0

Simulator Screen Shot - iPhone 11 Pro Max - 2023-06-08 at 23 01 28

Sample Code

import {FlatList} from 'react-native-gesture-handler';
<FlatList
data={carsData}
renderItem={renderCars}
ref={flatListRef}
)}
/>

Steps to reproduce

yarn
yarn ios
Error comes as soon as i try to render a flatlist from react-native-gesture-handler

Snack or a link to a repository

...

Gesture Handler version

2.11.0

React Native version

0.65.1

Platforms

Android, iOS

JavaScript runtime

None

Workflow

React Native (without Expo)

Architecture

Paper (Old Architecture)

Build type

Debug mode

Device

iOS simulator

Device model

iPhone 11Pro Max

Acknowledgements

Yes

@github-actions github-actions bot added Platform: Android This issue is specific to Android Platform: iOS This issue is specific to iOS Missing repro labels Jun 8, 2023
@github-actions
Copy link

github-actions bot commented Jun 8, 2023

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

@rayjackson13
Copy link

Hi! This issue also happened to me on Android after upgrading "react-native-gesture-handler" from v2.9.0 to v2.11.0.

@valmirw
Copy link

valmirw commented Jun 13, 2023

+1, on iOS.
"react": "17.0.1", "react-native": "0.64.4", "react-native-gesture-handler": "^2.5.0",

Somehow after opening the debugger the error isn't shown. As soon as the debugger is stopped this error is shown.

image

Update: after publishing it on TestFlight, it does not work. A white screen is displayed only.

@abdulrafeh857
Copy link
Author

I commented the queueMicrotask functions at these places the error went away. Don't know how it will impact the functionality or performance.

node_modules/react-native-gesture-handler/src/handlers/gestureHandlerCommon.ts
node_modules/react-native-gesture-handler/src/handlers/createHandler.tsx

@j-piasecki
Copy link
Member

Which JavaScript runtime are you using? - JSC would be the default on those RN versions so unless you've enabled Hermes or installed react-native-v8, it will be that.

@Juanjojara
Copy link

I have this exact same problem on iOS. I have xcode 14.3.1, react-native 0.63.5, react-native-gesture-handler 2.9.0.
The solution from @abdulrafeh857 worked for me but is not a real solution, it's barely a patch and I hope that it does not have any major impact on the app.

@m-bert
Copy link
Contributor

m-bert commented Sep 28, 2023

Hi @abdulrafeh857! I've prepared this PR, could you please check if it helps?

m-bert added a commit that referenced this issue Sep 28, 2023
## Description

`queueMicrotask` was added in `react-native` 0.66 ([see changelog](https://github.com/react-native-community/releases/blob/master/CHANGELOG.md#v0660)). Because we support versions from 0.64, and some of users still use older versions of `react-native`, we have to change how we handle microtasks in versions below 0.66.

Fixes #2505 
Fixes #2484 

## Test plan

Tested on newly created app with `react-native` 0.65.1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing repro Platform: Android This issue is specific to Android Platform: iOS This issue is specific to iOS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants