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 tabiew #939

Merged
merged 4 commits into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
81 changes: 42 additions & 39 deletions src/screens/library/LibraryScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,44 +85,47 @@ const LibraryScreen = ({ navigation }: LibraryScreenProps) => {

const renderTabBar = (
props: SceneRendererProps & { navigationState: State },
) => (
<TabBar
{...props}
scrollEnabled
indicatorStyle={{ backgroundColor: theme.primary }}
style={[
{
backgroundColor: theme.surface,
borderBottomColor: color(theme.isDark ? '#FFFFFF' : '#000000')
.alpha(0.12)
.string(),
},
styles.tabBar,
]}
renderLabel={({ route, color }) => (
<Row>
<Text style={{ color }}>{route.title}</Text>
{showNumberOfNovels && (
<View
style={[
styles.badgeCtn,
{ backgroundColor: theme.surfaceVariant },
]}
>
<Text
style={[styles.badgetText, { color: theme.onSurfaceVariant }]}
) =>
library.length ? (
<TabBar
{...props}
scrollEnabled
indicatorStyle={{ backgroundColor: theme.primary, height: 3 }}
style={[
{
backgroundColor: theme.surface,
borderBottomColor: color(theme.isDark ? '#FFFFFF' : '#000000')
.alpha(0.12)
.string(),
},
styles.tabBar,
]}
tabStyle={{ width: 'auto' }}
gap={8}
renderLabel={({ route, color }) => (
<Row>
<Text style={{ color, fontWeight: '600' }}>{route.title}</Text>
{showNumberOfNovels && (
<View
style={[
styles.badgeCtn,
{ backgroundColor: theme.surfaceVariant },
]}
>
{(route as any)?.novels.length}
</Text>
</View>
)}
</Row>
)}
inactiveColor={theme.secondary}
activeColor={theme.primary}
pressColor={theme.rippleColor}
/>
);
<Text
style={[styles.badgetText, { color: theme.onSurfaceVariant }]}
>
{(route as any)?.novels.length}
</Text>
</View>
)}
</Row>
)}
inactiveColor={theme.secondary}
activeColor={theme.primary}
android_ripple={{ color: theme.rippleColor }}
/>
) : null;

const searchbarPlaceholder =
selectedNovelIds.length === 0
Expand Down Expand Up @@ -314,7 +317,6 @@ const styles = StyleSheet.create({
globalSearchBtn: {
margin: 16,
},

fab: {
position: 'absolute',
margin: 16,
Expand All @@ -324,8 +326,9 @@ const styles = StyleSheet.create({
badgeCtn: {
position: 'relative',
borderRadius: 50,
marginHorizontal: 6,
marginLeft: 2,
paddingHorizontal: 6,
paddingVertical: 2,
},
badgetText: {
fontSize: 12,
Expand Down
10 changes: 4 additions & 6 deletions src/services/backup/legacy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const restoreBackup = async (filePath?: string) => {
let novelsString = '';

if (backup.type === 'success') {
novelsString = await StorageAccessFramework.readAsStringAsync(backup.uri);
novelsString = await RNFS.readFile(backup.uri);
} else if (filePath) {
if (!(await RNFS.exists(filePath))) {
showToast(getString('backupScreen.legacy.noErrorNovel'));
Expand Down Expand Up @@ -105,11 +105,6 @@ export const restoreBackup = async (filePath?: string) => {
if (BackgroundService.isRunning()) {
const plugin = getPlugin(novels[i].pluginId);
if (!plugin) {
showToast(
getString('backupScreen.legacy.pluginNotExist', {
id: novels[i].pluginId,
}),
);
errorNovels.push(novels[i]);
continue;
}
Expand Down Expand Up @@ -169,6 +164,9 @@ export const restoreBackup = async (filePath?: string) => {
}
});
}
}).finally(() => {
MMKVStorage.delete(BACKGROUND_ACTION);
BackgroundService.stop();
});

if (novels.length > 0) {
Expand Down
Loading