callstack / react-native-pager-view

React Native wrapper for the Android ViewPager and iOS UIPageViewController.
MIT License
2.72k stars 418 forks source link

[TS] PagerView typescript is broken #823

Closed AlirezaHadjar closed 5 months ago

AlirezaHadjar commented 6 months ago

Description

I just noticed that in the latest version, the typescript of this package is not working as expected.

Reproducible Demo

  1. Create a ref:
    const ref = useRef<PagerView>(null);

    Now you will get this ts error: 'PagerView' refers to a value, but is being used as a type here. Did you mean 'typeof PagerView'

Screenshot 2024-05-03 at 7 06 04 PM

renchap commented 6 months ago

I can reproduce this with 6.3.1, while it works with 6.3.0.

https://github.com/callstack/react-native-pager-view/pull/817 has been merged and is in the v6.3.1 tag which I think it a mistake, because it means that 6.3.1 is in equivalent to 7.0.0-rc2?

Pining @troZee here because I do not think this was your intent at all!

asusoft commented 6 months ago

any fix??

sergeymild commented 5 months ago

The same error

Jonnboy91 commented 5 months ago

I came across this same issue as well. Noticed that on iOS it still seemed to work even with the typescript complaints, but Android was not working anymore on the screens that uses this.

As mentioned previously locking the version to 6.3.0 works.

troZee commented 5 months ago

Hello 👋 @MrRefactor is ill and he will fix that till the end of this week. Please make the useNext prop as an optional and it should work as a workaround.

DrRefactor commented 5 months ago

@troZee I'm not @MrRefactor but funny enough, "almost am" (look at the nicknames). Please see my PR: https://github.com/callstack/react-native-pager-view/pull/827

renchap commented 5 months ago

This is fixing main, but you still published a patch release (6.3.1) with the content of main, which makes it equivalent to a major 7.0.0 release.

gottfriedaniel commented 5 months ago

When you'll release this fix?