Skip to content

Missing type for scrollToOffset on SwipeListView #472

@ccannell

Description

@ccannell

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions