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

fix: add ScrollView type to 'getScrollResponder' #11112

Conversation

ken0nek
Copy link
Contributor

@ken0nek ken0nek commented Dec 19, 2022

Recreation of #10775 due to the git changes.

Motivation

Close #10722

getScrollResponder has a type error around SectionList due to missing type for SectionList


FlatList - https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-native/index.d.ts#L4057

    getScrollResponder: () => JSX.Element | null | undefined;

SectionList - https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-native/index.d.ts#L4294

    getScrollResponder(): ScrollView | undefined;

Test plan

Use

  • @types/react: ^18.0.15
  • @react-navigation/native: ken0nek/react-navigation.git#react-navigation-native-v6.1.1-gitpkg

Check no errors for useScrollToTop with SectionList.

const sectionList = useRef<SectionList>(null);
useScrollToTop(sectionList);

@netlify
Copy link

netlify bot commented Dec 19, 2022

Deploy Preview for react-navigation-example ready!

Name Link
🔨 Latest commit 8154e9e
🔍 Latest deploy log https://app.netlify.com/sites/react-navigation-example/deploys/63e93bd98c16310008990f92
😎 Deploy Preview https://deploy-preview-11112--react-navigation-example.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@ken0nek
Copy link
Contributor Author

ken0nek commented Dec 19, 2022

@TomCorvus I recreated a pull request (the same diff). Could you try "ken0nek/react-navigation.git#react-navigation-native-v6.1.1-gitpkg"?

yarn add ken0nek/react-navigation.git#react-navigation-native-v6.1.1-gitpkg

@ken0nek
Copy link
Contributor Author

ken0nek commented Dec 19, 2022

@satya164 I recreated #10775 as you suggested. Please review this when you have a chance. Thank you!

ref: #10775 (comment)

@TomCorvus
Copy link

@TomCorvus I recreated a pull request (the same diff). Could you try "ken0nek/react-navigation.git#react-navigation-native-v6.1.1-gitpkg"?

yarn add ken0nek/react-navigation.git#react-navigation-native-v6.1.1-gitpkg

It seems to be fixed 👍

@ken0nek
Copy link
Contributor Author

ken0nek commented Dec 20, 2022

@TomCorvus Thank you for the update! 🤝

Copy link
Member

@satya164 satya164 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR

@satya164 satya164 enabled auto-merge (squash) February 12, 2023 19:20
@codecov-commenter
Copy link

Codecov Report

Base: 74.11% // Head: 74.11% // No change to project coverage 👍

Coverage data is based on head (8154e9e) compared to base (fbfc9b3).
Patch has no changes to coverable lines.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #11112   +/-   ##
=======================================
  Coverage   74.11%   74.11%           
=======================================
  Files         176      176           
  Lines        5602     5602           
  Branches     2197     2197           
=======================================
  Hits         4152     4152           
  Misses       1401     1401           
  Partials       49       49           
Impacted Files Coverage Δ
packages/native/src/useScrollToTop.tsx 0.00% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@satya164 satya164 merged commit bb3b849 into react-navigation:main Feb 12, 2023
satya164 added a commit that referenced this pull request Feb 12, 2023
Recreation of
#10775 due to
the git changes.

**Motivation**

Close #10722

`getScrollResponder` has a type error around `SectionList` due to
missing type for `SectionList`

-----

FlatList -
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-native/index.d.ts#L4057

```ts
    getScrollResponder: () => JSX.Element | null | undefined;
```

SectionList -
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-native/index.d.ts#L4294

```ts
    getScrollResponder(): ScrollView | undefined;
```

**Test plan**

Use
- `@types/react`: `^18.0.15` 
- `@react-navigation/native`:
`ken0nek/react-navigation.git#react-navigation-native-v6.1.1-gitpkg`

Check no errors for `useScrollToTop` with `SectionList`.

```ts
const sectionList = useRef<SectionList>(null);
useScrollToTop(sectionList);
```

Co-authored-by: Satyajit Sahoo <satyajit.happy@gmail.com>
satya164 added a commit that referenced this pull request Feb 17, 2023
Recreation of
#10775 due to
the git changes.

**Motivation**

Close #10722

`getScrollResponder` has a type error around `SectionList` due to
missing type for `SectionList`

-----

FlatList -
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-native/index.d.ts#L4057

```ts
    getScrollResponder: () => JSX.Element | null | undefined;
```

SectionList -
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-native/index.d.ts#L4294

```ts
    getScrollResponder(): ScrollView | undefined;
```

**Test plan**

Use
- `@types/react`: `^18.0.15` 
- `@react-navigation/native`:
`ken0nek/react-navigation.git#react-navigation-native-v6.1.1-gitpkg`

Check no errors for `useScrollToTop` with `SectionList`.

```ts
const sectionList = useRef<SectionList>(null);
useScrollToTop(sectionList);
```

Co-authored-by: Satyajit Sahoo <satyajit.happy@gmail.com>
satya164 added a commit that referenced this pull request Feb 17, 2023
Recreation of
#10775 due to
the git changes.

**Motivation**

Close #10722

`getScrollResponder` has a type error around `SectionList` due to
missing type for `SectionList`

-----

FlatList -
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-native/index.d.ts#L4057

```ts
    getScrollResponder: () => JSX.Element | null | undefined;
```

SectionList -
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-native/index.d.ts#L4294

```ts
    getScrollResponder(): ScrollView | undefined;
```

**Test plan**

Use
- `@types/react`: `^18.0.15` 
- `@react-navigation/native`:
`ken0nek/react-navigation.git#react-navigation-native-v6.1.1-gitpkg`

Check no errors for `useScrollToTop` with `SectionList`.

```ts
const sectionList = useRef<SectionList>(null);
useScrollToTop(sectionList);
```

Co-authored-by: Satyajit Sahoo <satyajit.happy@gmail.com>
@ken0nek ken0nek deleted the work/useScrollToTop_getScrollResponder_re branch June 17, 2023 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TS error on useScrollToTop if useRef type is SectionList
4 participants