Skip to content

Commit

Permalink
fix: add support to show based on correct index
Browse files Browse the repository at this point in the history
  • Loading branch information
JonatanSalas committed Oct 27, 2020
1 parent 51ab281 commit 9d87dc2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/StoryPreview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,15 @@ export const StoryPreview: React.FC<StoryPreviewProps> = ({
{...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);
}
}}
/>
Expand Down

0 comments on commit 9d87dc2

Please sign in to comment.