about summary refs log tree commit diff
path: root/src/view/screens/Notifications.tsx
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-05-25 21:17:11 -0500
committerPaul Frazee <pfrazee@gmail.com>2023-05-25 21:17:11 -0500
commit7b6948e6171b448e271f0564efd1f186ccadb9b8 (patch)
treee0d1b6e9f9c863cbff53f8832fd55d03cb670a83 /src/view/screens/Notifications.tsx
parent15c1b6ee157471807a723161066ba4ce5e12c0b5 (diff)
parente832352e9844002408b45291396a3c495be23276 (diff)
downloadvoidsky-7b6948e6171b448e271f0564efd1f186ccadb9b8.tar.zst
Merge branch 'custom-algos' into main
Diffstat (limited to 'src/view/screens/Notifications.tsx')
-rw-r--r--src/view/screens/Notifications.tsx21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/view/screens/Notifications.tsx b/src/view/screens/Notifications.tsx
index 8d6f7c83a..4db1d14ae 100644
--- a/src/view/screens/Notifications.tsx
+++ b/src/view/screens/Notifications.tsx
@@ -25,7 +25,8 @@ type Props = NativeStackScreenProps<
 export const NotificationsScreen = withAuthRequired(
   observer(({}: Props) => {
     const store = useStores()
-    const onMainScroll = useOnMainScroll(store)
+    const [onMainScroll, isScrolledDown, resetMainScroll] =
+      useOnMainScroll(store)
     const scrollElRef = React.useRef<FlatList>(null)
     const {screen} = useAnalytics()
 
@@ -37,7 +38,8 @@ export const NotificationsScreen = withAuthRequired(
 
     const scrollToTop = React.useCallback(() => {
       scrollElRef.current?.scrollToOffset({offset: 0})
-    }, [scrollElRef])
+      resetMainScroll()
+    }, [scrollElRef, resetMainScroll])
 
     const onPressLoadLatest = React.useCallback(() => {
       scrollToTop()
@@ -86,6 +88,9 @@ export const NotificationsScreen = withAuthRequired(
       ),
     )
 
+    const hasNew =
+      store.me.notifications.hasNewLatest &&
+      !store.me.notifications.isRefreshing
     return (
       <View testID="notificationsScreen" style={s.hContentRegion}>
         <ViewHeader title="Notifications" canGoBack={false} />
@@ -96,10 +101,14 @@ export const NotificationsScreen = withAuthRequired(
           onScroll={onMainScroll}
           scrollElRef={scrollElRef}
         />
-        {store.me.notifications.hasNewLatest &&
-          !store.me.notifications.isRefreshing && (
-            <LoadLatestBtn onPress={onPressLoadLatest} label="notifications" />
-          )}
+        {(isScrolledDown || hasNew) && (
+          <LoadLatestBtn
+            onPress={onPressLoadLatest}
+            label="Load new notifications"
+            showIndicator={hasNew}
+            minimalShellMode={true}
+          />
+        )}
       </View>
     )
   }),