diff --git a/src/components/Avatar/index.tsx b/src/components/Avatar/index.tsx index e511f9b..d76a8d5 100644 --- a/src/components/Avatar/index.tsx +++ b/src/components/Avatar/index.tsx @@ -15,7 +15,6 @@ const AnimatedImage = Animated.createAnimatedComponent( Image ); const StoryAvatar: FC = ( { id, avatarSource, - imgUrl, name, stories, loadingStory, @@ -53,7 +52,7 @@ const StoryAvatar: FC = ( { = ( { stories, loadingStory, seenStories, colors, seenColors, size, - showName, nameTextStyle, nameTextProps, listContainerProps, listContainerStyle, + showName, nameTextStyle, nameTextProps, avatarListContainerProps, avatarListContainerStyle, onPress, } ) => { const renderItem = ( story: InstagramStoryProps ) => story.renderAvatar?.() - ?? ( ( story.avatarSource || story.imgUrl ) && ( + ?? ( story.avatarSource && ( = ( { return ( renderItem( item )} keyExtractor={( item: InstagramStoryProps ) => item.id} - contentContainerStyle={[ listContainerStyle, avatarListContainerStyle ]} + contentContainerStyle={avatarListContainerStyle} testID="storiesList" /> ); @@ -58,7 +57,7 @@ const StoryAvatarList: FC = ( { } return ( - + {stories.map( renderItem )} ); diff --git a/src/components/Header/index.tsx b/src/components/Header/index.tsx index 48b09b4..32010ab 100644 --- a/src/components/Header/index.tsx +++ b/src/components/Header/index.tsx @@ -9,7 +9,7 @@ import { StoryHeaderProps } from '../../core/dto/componentsDTO'; import Close from '../Icon/close'; const StoryHeader: FC = ( { - avatarSource, imgUrl, name, onClose, avatarSize, textStyle, closeColor, headerStyle, + avatarSource, name, onClose, avatarSize, textStyle, closeColor, headerStyle, headerContainerStyle, renderStoryHeader, onStoryHeaderPress, } ) => { @@ -35,9 +35,9 @@ const StoryHeader: FC = ( { ]} > onStoryHeaderPress?.()}> - {( Boolean( avatarSource ) || Boolean( imgUrl ) ) && ( + {( Boolean( avatarSource ) ) && ( - + )} {Boolean( name ) && {name}} diff --git a/src/components/Image/index.tsx b/src/components/Image/index.tsx index bfc0134..93558fc 100644 --- a/src/components/Image/index.tsx +++ b/src/components/Image/index.tsx @@ -57,9 +57,9 @@ const StoryImage: FC = ( { const nextStory = stories[stories.indexOf( story ) + 1]; - if ( nextStory && nextStory.mediaType !== 'video' && ( ( nextStory.source as any )?.uri || nextStory.sourceUrl ) ) { + if ( nextStory && nextStory.mediaType !== 'video' && ( nextStory.source as any )?.uri ) { - Image.prefetch( ( nextStory.source as any )?.uri ?? nextStory.sourceUrl ); + Image.prefetch( ( nextStory.source as any )?.uri ); } @@ -98,19 +98,19 @@ const StoryImage: FC = ( { - {( data.data?.source || data.data?.sourceUrl ) && ( + {data.data?.source && ( data.isVideo ? ( ) : ( void; } @@ -131,8 +129,7 @@ export interface StoryProgressItemProps extends Omit ReactNode; renderStoryHeader?: () => ReactNode; onStoryHeaderPress?: () => void; @@ -40,15 +32,7 @@ export interface InstagramStoriesProps { avatarSeenBorderColors?: string[]; avatarSize?: number; storyAvatarSize?: number; - /** - * @deprecated Use {@link avatarListContainerStyle} instead. - */ - listContainerStyle?: ScrollViewProps['contentContainerStyle']; avatarListContainerStyle?: ScrollViewProps['contentContainerStyle']; - /** - * @deprecated Use {@link avatarListContainerProps} instead. - */ - listContainerProps?: ScrollViewProps | Partial>; avatarListContainerProps?: ScrollViewProps | Partial>; containerStyle?: ViewStyle; textStyle?: TextStyle; diff --git a/tests/index.test.js b/tests/index.test.js index 1a72502..7061993 100644 --- a/tests/index.test.js +++ b/tests/index.test.js @@ -31,10 +31,10 @@ jest.spyOn( Storage, 'setProgressStorage' ).mockImplementation( () => ( {} ) ); const stories = [ { id: '1', name: 'John Doe', - avatarSource: 'https://picsum.photos/200/300', + avatarSource: { uri: 'https://picsum.photos/200/300' }, stories: [ { id: '1', - sourceUrl: 'https://picsum.photos/200/300', + source: { uri: 'https://picsum.photos/200/300' }, renderContent: () => , } ], } ]; @@ -42,50 +42,50 @@ const stories = [ { const stories2 = [ { id: '1', name: 'John Doe', - imgUrl: 'https://picsum.photos/200/300', + avatarSource: { uri: 'https://picsum.photos/200/300' }, stories: [ { id: '1', - sourceUrl: 'https://picsum.photos/200/300', + source: { uri: 'https://picsum.photos/200/300' }, } ], }, { id: '2', name: 'John Doe 2', - imgUrl: 'https://picsum.photos/200/300', + avatarSource: { uri: 'https://picsum.photos/200/300' }, stories: [ { id: '1', - sourceUrl: 'https://picsum.photos/200/300', + source: { uri: 'https://picsum.photos/200/300' }, } ], } ]; const stories3 = [ { id: '1', name: 'John Doe', - imgUrl: 'https://picsum.photos/200/300', + avatarSource: { uri: 'https://picsum.photos/200/300' }, stories: [ { id: '1', - sourceUrl: 'https://picsum.photos/200/300', + source: { uri: 'https://picsum.photos/200/300' }, }, { id: '2', - sourceUrl: 'https://picsum.photos/200/300', + source: { uri: 'https://picsum.photos/200/300' }, } ], } ]; const stories4 = [ { id: '1', name: 'John Doe', - imgUrl: 'https://picsum.photos/200/300', + avatarSource: { uri: 'https://picsum.photos/200/300' }, stories: [ { id: '1', - sourceUrl: 'https://picsum.photos/200/300', + source: { uri: 'https://picsum.photos/200/300' }, mediaType: 'video', } ], }, { id: '2', name: 'John Doe 2', - imgUrl: 'https://picsum.photos/200/300', + avatarSource: { uri: 'https://picsum.photos/200/300' }, stories: [ { id: '1', - sourceUrl: 'https://picsum.photos/200/300', + source: { uri: 'https://picsum.photos/200/300' }, mediaType: 'video', } ], } ]; @@ -214,10 +214,10 @@ describe( 'Instagram Stories test', () => { ref.current.spliceStories( [ { id: '2', name: 'John Doe 2', - imgUrl: 'https://picsum.photos/200/300', + avatarSource: { uri: 'https://picsum.photos/200/300' }, stories: [ { id: '1', - sourceUrl: 'https://picsum.photos/200/300', + source: { uri: 'https://picsum.photos/200/300' }, } ], } ] ); @@ -226,10 +226,10 @@ describe( 'Instagram Stories test', () => { ref.current.spliceStories( [ { id: '3', name: 'John Doe 3', - imgUrl: 'https://picsum.photos/200/300', + avatarSource: { uri: 'https://picsum.photos/200/300' }, stories: [ { id: '1', - sourceUrl: 'https://picsum.photos/200/300', + source: { uri: 'https://picsum.photos/200/300' }, } ], } ], -1 ); @@ -237,19 +237,19 @@ describe( 'Instagram Stories test', () => { ref.current.spliceUserStories( [ { id: '2', - sourceUrl: 'https://picsum.photos/200/300', + source: { uri: 'https://picsum.photos/200/300' }, } ], '1' ); await sleep(); ref.current.spliceUserStories( [ { id: '2', - sourceUrl: 'https://picsum.photos/200/300', + source: { uri: 'https://picsum.photos/200/300' }, } ], '2', 2 ); ref.current.spliceUserStories( [ { id: '2', - sourceUrl: 'https://picsum.photos/200/300', + source: { uri: 'https://picsum.photos/200/300' }, } ], '20', 2 ); await sleep(); @@ -462,7 +462,7 @@ describe( 'Instagram Stories test', () => { render( ); @@ -530,7 +530,7 @@ describe( 'Story Image test', () => { const onLoad = jest.fn(); render(