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

Certain classes (ScrollView, RNGHTextInput) no longer exporting type #2889

Closed
johnnywang opened this issue May 2, 2024 · 6 comments · Fixed by #2896
Closed

Certain classes (ScrollView, RNGHTextInput) no longer exporting type #2889

johnnywang opened this issue May 2, 2024 · 6 comments · Fixed by #2896
Labels
Missing repro Platform: Android This issue is specific to Android Platform: iOS This issue is specific to iOS

Comments

@johnnywang
Copy link

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

@github-actions github-actions bot added Platform: Android This issue is specific to Android Platform: iOS This issue is specific to iOS labels May 2, 2024
@johnnywang johnnywang changed the title Certain classes no longer exporting type Certain classes (ScrollView, RNGHTextInput) no longer exporting type May 2, 2024
Copy link

github-actions bot commented May 2, 2024

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?

@huextrat
Copy link

huextrat commented May 2, 2024

It seems to have been broken from: #2835

@hirbod
Copy link

hirbod commented May 2, 2024

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

@m-bert
Copy link
Contributor

m-bert commented May 7, 2024

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

j-piasecki pushed a commit that referenced this issue May 7, 2024
)

## Description

This reverts commit e3e0b79.

#2835 was the first PR that was meant to introduce compatibility with
`Next.js`. Unfortunately, it broke types outside of our repository. Our
`tsconfig.json` has special flag, i.e. `moduleSuffixes`, which allows
`tsc` to look for `.native` files first. Most of our users do not have
this flag and they've run into `ts` problems, like this one:

```
'TextInput' refers to a value, but is being used as a type here. Did you mean 'typeof TextInput'?
```

Given that removing `moduleSuffixes` from `tsconfig` results in a bunch
of errors (and there are more of them that we may not be aware of), we
decided that it will be better to revert this change for now. It is not
necessary since we only need it to support `Next.js`. At first I thought
that #2873 may help, but unfortunately it doesn't.

Fixes #2889

## Test plan

1. Check that web, Android and iOS work as they did before
2. Check that code from [this
comment](#2835 (comment))
now does not throw any errors
@m-bert
Copy link
Contributor

m-bert commented May 7, 2024

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!

@renchap
Copy link
Contributor

renchap commented May 7, 2024

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

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
5 participants