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

Missing type for scrollToOffset on SwipeListView #472

Closed
ccannell opened this issue May 29, 2020 · 2 comments · May be fixed by #583
Closed

Missing type for scrollToOffset on SwipeListView #472

ccannell opened this issue May 29, 2020 · 2 comments · May be fixed by #583

Comments

@ccannell
Copy link

ccannell commented May 29, 2020

Describe the bug
Typescript error: Property scrollToOffset does not exist on type SwipeListView<MyType> where the object is the ref parameter in the listViewRef function.

let listViewRef: SwipeListView<MyType> | null = null;

<SwipeListView
  ...
  listViewRef={(ref) => {
    // type of ref is SwipeListView as defined here https://github.com/jemise111/react-native-swipe-list-view/blob/master/types/index.d.ts#L395
    listViewRef = ref;
  }}
/>

...

// This works fine at runtime. Typescript is showing an error that scrollToOffset does not exist 
listViewRef?.scrollToOffset({
  x: 0,
  y: 0,
  animated: true,
});
              

Environment:

  • OS: Mac using Expo, testing on iOS simulator
  • RNSLV Version: 3.1.0
  • RN Version: 0.61
@jemise111
Copy link
Owner

@ccannell I don't use typescript often, I'm not exactly sure how to fix this one. AFAIK SwipeListView should be extending FlatListProps which should contain the scrollToOffset function, no? Any suggestions would be awesome

https://github.com/jemise111/react-native-swipe-list-view/blob/master/types/index.d.ts#L503

@jemise111
Copy link
Owner

Closing as inactive

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 a pull request may close this issue.

2 participants