Skip to content

Commit

Permalink
fix: change keyExtactor to use index and to be useCallback
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpchin authored and PedroBern committed Jan 30, 2021
1 parent bd4f0e2 commit 95be6c2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/createCollapsibleTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ const createCollapsibleTabs = <
[containerRef, refMap]
)

const keyExtractor = React.useCallback((_, index) => index.toString(), [])

return (
<Context.Provider
value={{
Expand Down Expand Up @@ -430,7 +432,7 @@ const createCollapsibleTabs = <
ref={containerRef}
initialScrollIndex={index.value}
data={data}
keyExtractor={(item) => item + ''}
keyExtractor={keyExtractor}
renderItem={renderItem}
horizontal
pagingEnabled
Expand Down

0 comments on commit 95be6c2

Please sign in to comment.