Skip to content

Commit

Permalink
Merge pull request #140 from birdwingo/fix/issues
Browse files Browse the repository at this point in the history
Fix/issues
  • Loading branch information
LukasFridmansky authored Feb 1, 2025
2 parents e9f7c92 + 4b506d4 commit 7c9bbeb
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/components/Avatar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const StoryAvatar: FC<StoryAvatarProps> = ( {
nameTextStyle,
nameTextProps,
renderAvatar,
avatarBorderRadius,
} ) => {

const loaded = useSharedValue( false );
Expand Down Expand Up @@ -68,7 +69,7 @@ const StoryAvatar: FC<StoryAvatarProps> = ( {
style={[
AvatarStyles.avatar,
imageAnimatedStyles,
{ width: size, height: size, borderRadius: size / 2 },
{ width: size, height: size, borderRadius: avatarBorderRadius ?? ( size / 2 ) },
]}
testID="storyAvatarImage"
onLoad={onLoad}
Expand Down
7 changes: 4 additions & 3 deletions src/components/AvatarList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { FC, memo } from 'react';
import { ScrollView } from 'react-native';
import StoryAvatar from '../Avatar';
import { StoryAvatarListProps } from '~/core/dto/componentsDTO';
import { InstagramStoryProps } from '~/core/dto/instagramStoriesDTO';
import { StoryAvatarListProps } from '../../core/dto/componentsDTO';
import { InstagramStoryProps } from '../../core/dto/instagramStoriesDTO';

let FlashList: any;

Expand All @@ -20,7 +20,7 @@ try {
const StoryAvatarList: FC<StoryAvatarListProps> = ( {
stories, loadingStory, seenStories, colors, seenColors, size,
showName, nameTextStyle, nameTextProps,
avatarListContainerProps, avatarListContainerStyle, onPress,
avatarListContainerProps, avatarListContainerStyle, avatarBorderRadius, onPress,
} ) => {

const renderItem = ( story: InstagramStoryProps ) => (
Expand All @@ -35,6 +35,7 @@ const StoryAvatarList: FC<StoryAvatarListProps> = ( {
showName={showName}
nameTextStyle={nameTextStyle}
nameTextProps={nameTextProps}
avatarBorderRadius={avatarBorderRadius}
key={`avatar${story.id}`}
/>
);
Expand Down
2 changes: 2 additions & 0 deletions src/components/InstagramStories/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const InstagramStories = forwardRef<InstagramStoriesPublicMethods, InstagramStor
closeIconColor = CLOSE_COLOR,
isVisible = false,
hideAvatarList = false,
avatarBorderRadius,
...props
}, ref ) => {

Expand Down Expand Up @@ -238,6 +239,7 @@ const InstagramStories = forwardRef<InstagramStoriesPublicMethods, InstagramStor
nameTextProps={nameTextProps}
avatarListContainerProps={avatarListContainerProps}
avatarListContainerStyle={avatarListContainerStyle}
avatarBorderRadius={avatarBorderRadius}
onPress={onPress}
/>
)}
Expand Down
5 changes: 4 additions & 1 deletion src/components/Modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const StoryModal = forwardRef<StoryModalPublicMethods, StoryModalProps>( ( {
const isLongPress = useSharedValue( false );
const hideElements = useSharedValue( false );
const lastViewed = useSharedValue<{ [key: string]:number }>( {} );
const firstRender = useSharedValue( true );

const userIndex = useDerivedValue( () => Math.round( x.value / WIDTH ) );
const storyIndex = useDerivedValue( () => stories[userIndex.value]?.stories.findIndex(
Expand Down Expand Up @@ -441,12 +442,14 @@ const StoryModal = forwardRef<StoryModalPublicMethods, StoryModalProps>( ( {

y.value = withTiming( 0, { duration: modalAnimationDuration } );

} else if ( currentStory.value !== undefined ) {
} else if ( currentStory.value !== undefined && !firstRender.value ) {

onHide?.( currentStory.value );

}

firstRender.value = false;

}, [ visible ] );

useAnimatedReaction(
Expand Down
2 changes: 2 additions & 0 deletions src/core/dto/componentsDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface StoryAvatarListProps {
nameTextProps: InstagramStoriesProps['nameTextProps'];
avatarListContainerStyle: InstagramStoriesProps['avatarListContainerStyle'];
avatarListContainerProps: InstagramStoriesProps['avatarListContainerProps'];
avatarBorderRadius?: number;
onPress: ( id: string ) => void;
}

Expand All @@ -31,6 +32,7 @@ export interface StoryAvatarProps extends InstagramStoryProps {
showName?: boolean;
nameTextStyle?: TextStyle;
nameTextProps?: TextProps;
avatarBorderRadius?: number;
}

export interface StoryLoaderProps {
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 @@ -62,6 +62,7 @@ export interface InstagramStoriesProps {
loopingStories?: 'none' | 'all' | 'onlyLast';
statusBarTranslucent?: boolean;
footerComponent?: ReactNode;
avatarBorderRadius?: number;
onShow?: ( id: string ) => void;
onHide?: ( id: string ) => void;
onSwipeUp?: ( userId?: string, storyId?: string ) => void;
Expand Down

0 comments on commit 7c9bbeb

Please sign in to comment.