From 9d87dc246cd52e9fcd1ecafe1830bcaaf01a7a15 Mon Sep 17 00:00:00 2001 From: JonatanSalas Date: Tue, 27 Oct 2020 10:29:41 -0300 Subject: [PATCH] fix: add support to show based on correct index --- src/components/StoryPreview/index.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/StoryPreview/index.tsx b/src/components/StoryPreview/index.tsx index 771473b..99f2c65 100644 --- a/src/components/StoryPreview/index.tsx +++ b/src/components/StoryPreview/index.tsx @@ -103,11 +103,15 @@ export const StoryPreview: React.FC = ({ {...StoryPreviewItemProps} {...story} onPress={() => { + const storyIndex = stories.findIndex( + (s: Story) => s.id === story.id + ); + setIsVisible(true); - setIndex(idx); + setIndex(storyIndex); if (onStoryPreviewItemPress) { - onStoryPreviewItemPress(story, idx); + onStoryPreviewItemPress(story, storyIndex); } }} />