Skip to content

Commit 83f73be

Browse files
committed
preserve Layout when opening novel image
1 parent d9e2df2 commit 83f73be

File tree

2 files changed

+44
-39
lines changed

2 files changed

+44
-39
lines changed

src/screens/novel/components/Info/NovelInfoComponents.tsx

Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -84,47 +84,48 @@ const NovelThumbnail = ({
8484
}: NovelThumbnailProps) => {
8585
const [expanded, setExpanded] = useState(false);
8686

87-
if (!expanded) {
88-
return (
89-
<TouchableWithoutFeedback onPress={() => setExpanded(!expanded)}>
87+
return (
88+
<TouchableWithoutFeedback
89+
onPress={() => setExpanded(!expanded)}
90+
style={styles.novelThumbnailContainer}
91+
>
92+
{!expanded ? (
9093
<Image source={source} style={styles.novelThumbnail} />
91-
</TouchableWithoutFeedback>
92-
);
93-
} else {
94-
return (
95-
<Portal>
96-
<IconButton
97-
icon="pencil-outline"
98-
style={{
99-
position: 'absolute',
100-
top: StatusBar.currentHeight ?? 0 + 10,
101-
right: 10,
102-
zIndex: 10,
103-
}}
104-
iconColor={theme.onBackground}
105-
onPress={setCustomNovelCover}
106-
/>
107-
<Pressable
108-
style={{
109-
position: 'absolute',
110-
width: Dimensions.get('window').width,
111-
height: Dimensions.get('window').height + 60,
112-
justifyContent: 'center',
113-
backgroundColor: 'rgba(0,0,0,0.7)',
114-
}}
115-
onPress={() => setExpanded(false)}
116-
>
117-
<Image
118-
source={source}
94+
) : (
95+
<Portal>
96+
<IconButton
97+
icon="pencil-outline"
11998
style={{
120-
width: Dimensions.get('window').width,
121-
height: (Dimensions.get('window').width * 3) / 2,
99+
position: 'absolute',
100+
top: StatusBar.currentHeight ?? 0 + 10,
101+
right: 10,
102+
zIndex: 10,
122103
}}
104+
iconColor={theme.onBackground}
105+
onPress={setCustomNovelCover}
123106
/>
124-
</Pressable>
125-
</Portal>
126-
);
127-
}
107+
<Pressable
108+
style={{
109+
position: 'absolute',
110+
width: Dimensions.get('window').width,
111+
height: Dimensions.get('window').height + 60,
112+
justifyContent: 'center',
113+
backgroundColor: 'rgba(0,0,0,0.7)',
114+
}}
115+
onPress={() => setExpanded(false)}
116+
>
117+
<Image
118+
source={source}
119+
style={{
120+
width: Dimensions.get('window').width,
121+
height: (Dimensions.get('window').width * 3) / 2,
122+
}}
123+
/>
124+
</Pressable>
125+
</Portal>
126+
)}
127+
</TouchableWithoutFeedback>
128+
);
128129
};
129130

130131
const NovelTitle = ({
@@ -286,10 +287,14 @@ const styles = StyleSheet.create({
286287
linearGradient: {
287288
flex: 1,
288289
},
289-
novelThumbnail: {
290+
novelThumbnailContainer: {
290291
height: 150,
291292
width: 100,
292293
marginHorizontal: 4,
294+
},
295+
novelThumbnail: {
296+
height: 150,
297+
width: 100,
293298
borderRadius: 6,
294299
backgroundColor: coverPlaceholderColor,
295300
},

src/screens/novel/components/Info/ReadButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const ReadButton = ({
2828
};
2929

3030
if (!useFabForContinueReading) {
31-
return chapters.length > 0 ? (
31+
return chapters.length > 0 || lastRead ? (
3232
<Animated.View entering={ZoomIn.duration(150)}>
3333
<Button
3434
title={

0 commit comments

Comments
 (0)