Skip to content

Commit cb9a2d1

Browse files
author
vacom
committed
chore: fix loading activities
1 parent 316ab3c commit cb9a2d1

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

app.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "Diary",
66
"description": "Reflect on your daily events and save beautiful moments with Diary by Storytics.",
77
"slug": "diary-by-storytics",
8-
"version": "1.0.6",
8+
"version": "1.0.9",
99
"orientation": "portrait",
1010
"icon": "./assets/icon.png",
1111
"backgroundColor": "#ffffff",
@@ -23,7 +23,7 @@
2323
}
2424
},
2525
"android": {
26-
"versionCode": 6,
26+
"versionCode": 9,
2727
"enableDangerousExperimentalLeanBuilds": false,
2828
"backgroundColor": "#ffffff",
2929
"adaptiveIcon": {

src/database/Page.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import * as SQLite from "expo-sqlite";
22
// Types
33
import { PageProps } from "types/page";
44
// DB Connection
5-
import { BookProps } from "types/book";
65
import Connection from "./DatabaseConnection";
76

87
export const getAllPagesByBookId = async (
@@ -85,7 +84,7 @@ export const deletePageById = async (id: string): Promise<string> =>
8584
);
8685
});
8786

88-
export const getPageById = async (id: string): Promise<BookProps[]> =>
87+
export const getPageById = async (id: string): Promise<PageProps[]> =>
8988
new Promise((resolve, reject) => {
9089
Connection.transaction(
9190
(tx: SQLite.SQLTransaction) => {

src/screens/Diary/index.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@ import React, {
66
useEffect,
77
} from "react";
88
import { useTheme } from "styled-components/native";
9-
import { ScrollView } from "react-native";
109
import { useFocusEffect } from "@react-navigation/native";
1110
import AsyncStorage from "@react-native-async-storage/async-storage";
1211
// Components
1312
import Container from "components/Container";
1413
import NoteBook from "components/NoteBook";
1514
import CustomSafeArea from "components/CustomSafeArea";
16-
import BookLines from "components/BookLines";
1715
// Utils
1816
import { unescapeHtml } from "utils/functions";
1917
import dayjs from "dayjs";
@@ -78,8 +76,6 @@ const DiaryScreen: React.FC<DiaryNavigationProps> = ({
7876
(page: PageProps) => page.id === params.activityPageId
7977
);
8078

81-
console.log("activityIndex = ", activityIndex);
82-
8379
setBookPages([...pages, defaultPage]);
8480
setPageNumber(activityIndex === -1 ? pages.length : activityIndex);
8581

@@ -106,12 +102,14 @@ const DiaryScreen: React.FC<DiaryNavigationProps> = ({
106102

107103
useEffect(() => {
108104
if (!isEditorLoading) {
109-
RichTextViewRef.current?.setContentHTML(
110-
unescapeHtml(currentPage.content)
111-
);
105+
setTimeout(() => {
106+
RichTextViewRef.current?.setContentHTML(
107+
unescapeHtml(currentPage.content)
108+
);
109+
}, 50);
112110
setEditorLoading(false);
113111
}
114-
}, [currentPage, isEditorLoading, RichTextViewRef, params.activityPageId]);
112+
}, [currentPage.content, isEditorLoading, RichTextViewRef]);
115113

116114
const onPrevPage = () => {
117115
const prevPage = pageNumber - 1;

0 commit comments

Comments
 (0)