software-mansion/react-native-gesture-handler

Certain classes (ScrollView, RNGHTextInput) no longer exporting type

johnnywang opened this issue ยท 6 comments

Description

After updating to 2.16.1, I'm getting TypeScript errors in my code from several packages exported by RNGH when used in refs. Namely, ScrollView and RNGHTextInput will now error out with something like 'ScrollViewType' refers to a value, but is being used as a type here. Did you mean 'typeof ScrollViewType'?

Looking online, it seems this results from the type not being exported anymore, with some suggestions being to use InstanceType<typeof ScrollView> in place of it, but that only seems to throw different errors.

Opening as a bug because I didn't see any notes in the changelog about breaking changes, so this doesn't seem intentional.

Steps to reproduce

  1. Upgrade to 2.16.1
  2. Use ScrollView or RNGHTextInput inside something like a useRef

Snack or a link to a repository

n/a

Gesture Handler version

2.16.1

React Native version

0.72.10

Platforms

Android, iOS

JavaScript runtime

None

Workflow

None

Architecture

None

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

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?

It seems to have been broken from: #2835

I also reported this on Discord, but I'll add following:

Hey folks, RNGH 2.16.1 is breaking types.

actually problem is that gesture handler has moved the typings to .native.d.ts file in 2.16.1 and our setup now only looks for .d.ts.

interestingly when i added it to moduleSuffixes, our modules on web started picking .native.tsx.

We had to downgrade back to 2.16.0 - we'd appreciate a fix or rollback

Hi @johnnywang! We decided to revert faulty PR (#2896). I'll make sure to let you know when we release patched version.

We've just released 2.16.2 ๐Ÿ˜„ It would be great if you could confirm that the errors are gone after upgrading to the newest version!

I can confirm this has been fixed in 2.16.2, I no longer have TS errors