Skip to content

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

fix navigation

ammarahm-ed80a61e7bea71
diff --git a/apps/mobile/patches/react-native+0.64.2.patch b/apps/mobile/patches/react-native+0.64.2.patch
new file mode 100644
index 000000000..6e69f6bd9
--- /dev/null
+++ b/apps/mobile/patches/react-native+0.64.2.patch
@@ -0,0 +1,31 @@
+diff --git a/node_modules/react-native/React/Views/ScrollView/RCTScrollView.m b/node_modules/react-native/React/Views/ScrollView/RCTScrollView.m
+index c52f449..9075edd 100644
+--- a/node_modules/react-native/React/Views/ScrollView/RCTScrollView.m
++++ b/node_modules/react-native/React/Views/ScrollView/RCTScrollView.m
+@@ -624,7 +624,18 @@ - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView
+ : MAX(0, _scrollView.contentSize.height - viewportSize.height);
+
+ // Calculate the snap offsets adjacent to the initial offset target
+- CGFloat targetOffset = isHorizontal ? targetContentOffset->x : targetContentOffset->y;
++ //CGFloat targetOffset = isHorizontal ? targetContentOffset->x : targetContentOffset->y;
++ /**
++ * https://github.com/facebook/react-native/pull/30033/files/af9c24639073e57f4e309851893e96da2e54271d..52a3d8d87778614b84a113f9198b88fc152a5a26
++ */
++ CGFloat targetOffset = targetContentOffset->y;
++ if (isHorizontal) {
++ // Use current scroll offset to determine the next index to snap to when momentum disabled
++ targetOffset = self.disableIntervalMomentum ? scrollView.contentOffset.x : targetContentOffset->x;
++ } else {
++ targetOffset = self.disableIntervalMomentum ? scrollView.contentOffset.y : targetContentOffset->y;
++ }
++
+ CGFloat smallerOffset = 0.0;
+ CGFloat largerOffset = maximumOffset;
+
+diff --git a/node_modules/react-native/scripts/.packager.env b/node_modules/react-native/scripts/.packager.env
+new file mode 100644
+index 0000000..361f5fb
+--- /dev/null
++++ b/node_modules/react-native/scripts/.packager.env
+@@ -0,0 +1 @@
++export RCT_METRO_PORT=8081
diff --git a/apps/mobile/src/components/AppLoader/index.js b/apps/mobile/src/components/AppLoader/index.js
index e0c79e90e..8bba6030d 100644
--- a/apps/mobile/src/components/AppLoader/index.js
+++ b/apps/mobile/src/components/AppLoader/index.js
@@ -42,7 +42,10 @@ const AppLoader = ({onLoad}) => {
editing.isRestoringState = true;
//setNoteOnly(appState.note);
editing.currentlyEditing = true;
- tabBarRef.current?.goToPage(1);
+ if (!DDS.isTab) {
+ tabBarRef.current?.goToPage(1);
+ }
+
eSendEvent('loadingNote', appState.note);
}
}
diff --git a/apps/mobile/src/components/NoteItem/wrapper.js b/apps/mobile/src/components/NoteItem/wrapper.js
index 4a7c4dcce..9276c2521 100644
--- a/apps/mobile/src/components/NoteItem/wrapper.js
+++ b/apps/mobile/src/components/NoteItem/wrapper.js
@@ -44,7 +44,7 @@ export const NoteWrapper = React.memo(({item, index}) => {
} else {
eSendEvent(eOnLoadNote, _note);
}
- if (DDS.isPhone || DDS.isSmallTab) {
+ if (!DDS.isTab) {
tabBarRef.current?.goToPage(1);
}
};
diff --git a/apps/mobile/src/views/Editor/Functions.js b/apps/mobile/src/views/Editor/Functions.js
index a3bc277f8..93494c75b 100644
--- a/apps/mobile/src/views/Editor/Functions.js
+++ b/apps/mobile/src/views/Editor/Functions.js
@@ -573,7 +573,9 @@ async function restoreEditorState() {
editing.isRestoringState = true;
eSendEvent('loadingNote', appState.note);
editing.currentlyEditing = true;
- tabBarRef.current?.goToPage(1);
+ if (!DDS.isTab) {
+ tabBarRef.current?.goToPage(1);
+ }
setTimeout(() => {
eSendEvent(eOnLoadNote, appState.note);
}, 100);
diff --git a/apps/mobile/src/views/Home/index.js b/apps/mobile/src/views/Home/index.js
index ffaf4d032..da189b452 100755
--- a/apps/mobile/src/views/Home/index.js
+++ b/apps/mobile/src/views/Home/index.js
@@ -84,7 +84,7 @@ export const Home = ({navigation}) => {
};
const _onPressBottomButton = React.useCallback(async () => {
- if (!DDS.isLargeTablet()) {
+ if (!DDS.isTab) {
eSendEvent(eOnLoadNote, {type: 'new'});
tabBarRef.current?.goToPage(1);
} else {
diff --git a/apps/mobile/src/views/Notes/index.js b/apps/mobile/src/views/Notes/index.js
index 22de9ccc3..d013a48a2 100644
--- a/apps/mobile/src/views/Notes/index.js
+++ b/apps/mobile/src/views/Notes/index.js
@@ -168,7 +168,7 @@ export const Notes = ({route, navigation}) => {
const _onPressBottomButton = () => {
setActionAfterFirstSave();
- if (DDS.isPhone || DDS.isSmallTab) {
+ if (!DDS.isTab) {
tabBarRef.current?.goToPage(1);
} else {
eSendEvent(eOnLoadNote, {type: 'new'});