Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some issues with stories #6

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Content/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const StoryContent: FC<StoryContentProps> = ( { stories, active, activeStory } )

const content = useMemo( () => stories[storyIndex]?.renderContent?.(), [ storyIndex ] );

return content ? <View style={ContentStyles.container}>{content}</View> : null;
return content ? <View style={ContentStyles.container} pointerEvents="box-none">{content}</View> : null;

};

Expand Down
12 changes: 3 additions & 9 deletions src/components/Image/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import ImageStyles from './Image.styles';
import StoryVideo from './video';

const StoryImage: FC<StoryImageProps> = ( {
stories, active, activeStory, defaultImage, isDefaultVideo, paused, videoProps,
stories, activeStory, defaultImage, isDefaultVideo, paused, videoProps,
onImageLayout, onLoad,
} ) => {

Expand All @@ -21,12 +21,6 @@ const StoryImage: FC<StoryImageProps> = ( {

const onImageChange = async () => {

if ( !active.value ) {

return;

}

const story = stories.find( ( item ) => item.id === activeStory.value )!;

if ( !story ) {
Expand All @@ -42,13 +36,13 @@ const StoryImage: FC<StoryImageProps> = ( {
} else {

loading.value = true;
setData( { uri: story?.sourceUrl, isVideo: story?.mediaType === 'video' } );
setData( { uri: story.sourceUrl, isVideo: story.mediaType === 'video' } );

}

const nextStory = stories[stories.indexOf( story ) + 1];

if ( nextStory ) {
if ( nextStory && nextStory.mediaType === 'image' ) {

Image.prefetch( nextStory.sourceUrl );

Expand Down
2 changes: 1 addition & 1 deletion src/components/InstagramStories/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const InstagramStories = forwardRef<InstagramStoriesPublicMethods, InstagramStor
);
const seenStory = story.stories[seenStoryIndex + 1] || story.stories[0];

return Image.prefetch( seenStory.sourceUrl );
return seenStory.mediaType === 'image' ? Image.prefetch( seenStory.sourceUrl ) : true;

} );

Expand Down
1 change: 0 additions & 1 deletion src/components/List/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const StoryList: FC<StoryListProps> = ( {
<Animated.View style={[ animatedStyles, ListStyles.container ]}>
<StoryImage
stories={stories}
active={isActive}
activeStory={activeStory}
defaultImage={stories[lastSeenIndex + 1]?.sourceUrl ?? stories[0].sourceUrl}
isDefaultVideo={( stories[lastSeenIndex + 1]?.mediaType ?? stories[0].mediaType ) === 'video'}
Expand Down
1 change: 0 additions & 1 deletion src/core/dto/componentsDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export interface AnimationProps {

export interface StoryImageProps {
stories: InstagramStoryProps['stories'];
active: SharedValue<boolean>;
activeStory: SharedValue<string>;
defaultImage: string;
isDefaultVideo: boolean;
Expand Down
Loading