Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

make sure multiple default notes are not created

ammarahm-ed24d29d83e9c9
diff --git a/apps/mobile/App.js b/apps/mobile/App.js
index d75a01410..367a27372 100644
--- a/apps/mobile/App.js
+++ b/apps/mobile/App.js
@@ -51,7 +51,7 @@ const App = () => {
await MMKV.setItem(
'askForRating',
JSON.stringify({
- timestamp: Date.now() + (86400000 * 2),
+ timestamp: Date.now() + 86400000 * 2,
}),
);
}
@@ -104,6 +104,8 @@ const App = () => {
async function loadDefaultNotes() {
try {
+ const isCreated = await MMKV.getItem('defaultNoteCreated');
+ if (isCreated) return;
const notes = await http.get(
'https://app.notesnook.com/notes/index.json',
);
@@ -117,6 +119,7 @@ const App = () => {
content: {type: 'tiny', data: content},
});
}
+ await MMKV.setItem('defaultNoteCreated', 'yes');
} catch (e) {
console.log(e);
}
diff --git a/apps/mobile/src/components/SplashScreen/index.js b/apps/mobile/src/components/SplashScreen/index.js
index 92a11943b..d9b26db3b 100644
--- a/apps/mobile/src/components/SplashScreen/index.js
+++ b/apps/mobile/src/components/SplashScreen/index.js
@@ -245,7 +245,7 @@ const SplashScreen = () => {
width={isNext ? null : '100%'}
onPress={async () => {
if (isNext) {
- carouselRef.current?.snapToNext();
+ carouselRef.current?.snapToItem(currentIndex + 1,true,true);
currentIndex++;
if (currentIndex === 4) {
setIsNext(false);