software-mansion / react-native-gesture-handler

Declarative API exposing platform native touch and gesture system to React Native.
https://docs.swmansion.com/react-native-gesture-handler/
MIT License
6.13k stars 982 forks source link

Revert "Change `.web` files to default and add `.native` (#2835)" #2896

Closed m-bert closed 6 months ago

m-bert commented 6 months ago

Description

This reverts commit e3e0b79a3d3a622ec65a9c9509e8b5b12b01ff6e.

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 now does not throw any errors