Skip to content

Commit

Permalink
Merge pull request #116 from Adil7767/storiesFeature
Browse files Browse the repository at this point in the history
feat(stories): add ability to start playing stories from a specific s…
  • Loading branch information
LukasFridmansky authored Oct 8, 2024
2 parents ddc2884 + cebce6b commit 077aea9
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export default YourComponent;
`goToPreviousStory` | () => void | Goes to previous story item
`goToNextStory` | () => void | Goes to next story item
`getCurrentStory` | () => {userId?: string, storyId?: string} | Returns current userId and storyId
`goToSpecificStory` | ( userId: string, index: number ) => void | Change current playing story to defined index if index not exist then start playing first story
## Types
Expand Down
1 change: 1 addition & 0 deletions src/components/InstagramStories/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ const InstagramStories = forwardRef<InstagramStoriesPublicMethods, InstagramStor

},
clearProgressStorage,
goToSpecificStory: ( userId, index ) => modalRef.current?.goToSpecificStory( userId, index ),
hide: () => modalRef.current?.hide(),
show: ( id ) => {

Expand Down
1 change: 1 addition & 0 deletions src/components/Modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ const StoryModal = forwardRef<StoryModalPublicMethods, StoryModalProps>( ( {
getCurrentStory: () => ( { userId: userId.value, storyId: currentStory.value } ),
goToPreviousStory: toPreviousStory,
goToNextStory: toNextStory,
goToSpecificStory: ( newUserId, index ) => scrollTo( newUserId, true, false, undefined, index ),
} ), [ userId.value, currentStory.value ] );

useEffect( () => {
Expand Down
1 change: 1 addition & 0 deletions src/core/dto/componentsDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export type StoryModalPublicMethods = {
goToPreviousStory: () => void;
goToNextStory: () => void;
getCurrentStory: () => { userId?: string, storyId?: string };
goToSpecificStory: ( userId: string, index?: number ) => void;
};

export type GestureContext = {
Expand Down
1 change: 1 addition & 0 deletions src/core/dto/instagramStoriesDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,5 @@ export type InstagramStoriesPublicMethods = {
goToPreviousStory: () => void;
goToNextStory: () => void;
getCurrentStory: () => { userId?: string, storyId?: string };
goToSpecificStory: ( userId: string, index?: number ) => void;
};

0 comments on commit 077aea9

Please sign in to comment.