Skip to content

Commit

Permalink
App is done
Browse files Browse the repository at this point in the history
  • Loading branch information
adityapawar1 committed Apr 24, 2024
1 parent 6a70c4f commit 6db60b7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
5 changes: 1 addition & 4 deletions src/app/(tabs)/story/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ function StoryScreen() {
<FlatList
style={styles.genres}
horizontal
showsHorizontalScrollIndicator={false}
data={story.genre_medium}
keyExtractor={(_, index) => index.toString()} // Add a key extractor for performance optimization
renderItem={({ item, index }) => (
Expand Down Expand Up @@ -127,10 +128,6 @@ function StoryScreen() {
baseStyle={styles.story}
/>

<TouchableOpacity>
<Icon type="share_outline" />
</TouchableOpacity>

<Text style={styles.authorProcess}>Author's Process</Text>

<RenderHTML
Expand Down
12 changes: 6 additions & 6 deletions src/components/FavoriteStoryButton/FavoriteStoryButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useState } from 'react';
import { useEffect, useMemo, useState } from 'react';
import { TouchableOpacity } from 'react-native-gesture-handler';
import Svg, { Path } from 'react-native-svg';

Expand Down Expand Up @@ -55,7 +55,7 @@ export default function FavoriteStoryButton({
}
};

const renderFavoritedIcon = () => {
const renderFavoritedIcon = useMemo(() => {
return (
<Svg width="30" height="30" viewBox="0 0 30 30" fill="none">
<Path
Expand All @@ -64,9 +64,9 @@ export default function FavoriteStoryButton({
/>
</Svg>
);
};
}, []);

const renderNotFavoritedIcon = () => {
const renderNotFavoritedIcon = useMemo(() => {
return (
<Svg width="30" height="30" viewBox="0 0 30 30" fill="none">
<Path
Expand All @@ -75,11 +75,11 @@ export default function FavoriteStoryButton({
/>
</Svg>
);
};
}, []);

return (
<TouchableOpacity onPress={() => favoriteStory(!storyIsFavorited)}>
{storyIsFavorited ? renderFavoritedIcon() : renderNotFavoritedIcon()}
{storyIsFavorited ? renderFavoritedIcon : renderNotFavoritedIcon}
</TouchableOpacity>
);
}
12 changes: 6 additions & 6 deletions src/components/SaveStoryButton/SaveStoryButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useState } from 'react';
import { useEffect, useMemo, useState } from 'react';
import { TouchableOpacity } from 'react-native-gesture-handler';
import Svg, { Path } from 'react-native-svg';

Expand Down Expand Up @@ -52,7 +52,7 @@ export default function SaveStoryButton({
}
};

const renderSavedStoryImage = () => {
const renderSavedStoryImage = useMemo(() => {
return (
<Svg width="30" height="30" viewBox="0 0 30 30" fill="none">
<Path
Expand All @@ -61,9 +61,9 @@ export default function SaveStoryButton({
/>
</Svg>
);
};
}, []);

const renderSaveStoryImage = () => {
const renderSaveStoryImage = useMemo(() => {
return (
<Svg width="30" height="30" viewBox="0 0 30 30" fill="none">
<Path
Expand All @@ -72,11 +72,11 @@ export default function SaveStoryButton({
/>
</Svg>
);
};
}, []);

return (
<TouchableOpacity onPress={() => saveStory(!storyIsSaved)}>
{storyIsSaved ? renderSavedStoryImage() : renderSaveStoryImage()}
{storyIsSaved ? renderSavedStoryImage : renderSaveStoryImage}
</TouchableOpacity>
);
}

0 comments on commit 6db60b7

Please sign in to comment.