about summary refs log tree commit diff
path: root/src/view/screens/tabroots/Notifications.tsx
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2022-08-31 14:36:50 -0500
committerGitHub <noreply@github.com>2022-08-31 14:36:50 -0500
commit97f52b6a03ab36dcbf21256cc0137b550b10f174 (patch)
treec632b69f038d33ea82c3378451f72177dc136cfe /src/view/screens/tabroots/Notifications.tsx
parentd1470bad6628022eda66c658d228cc7646abc746 (diff)
downloadvoidsky-97f52b6a03ab36dcbf21256cc0137b550b10f174.tar.zst
New navigation model (#1)
* Flatten all routing into a single stack

* Replace router with custom implementation

* Add shell header and titles

* Add tab selector

* Add back/forward history menus on longpress

* Fix: don't modify state during render

* Add refresh() to navigation and reroute navigations to the current location to refresh instead of add to history

* Cache screens during navigation to maintain scroll position and improve load-time for renders
Diffstat (limited to 'src/view/screens/tabroots/Notifications.tsx')
-rw-r--r--src/view/screens/tabroots/Notifications.tsx71
1 files changed, 0 insertions, 71 deletions
diff --git a/src/view/screens/tabroots/Notifications.tsx b/src/view/screens/tabroots/Notifications.tsx
deleted file mode 100644
index ea7576799..000000000
--- a/src/view/screens/tabroots/Notifications.tsx
+++ /dev/null
@@ -1,71 +0,0 @@
-import React, {useState, useEffect, useLayoutEffect} from 'react'
-import {Image, StyleSheet, TouchableOpacity, View} from 'react-native'
-import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
-import {Shell} from '../../shell'
-import {Feed} from '../../com/notifications/Feed'
-import type {RootTabsScreenProps} from '../../routes/types'
-import {useStores} from '../../../state'
-import {AVIS} from '../../lib/assets'
-
-export const Notifications = ({
-  navigation,
-}: RootTabsScreenProps<'NotificationsTab'>) => {
-  const [hasSetup, setHasSetup] = useState<boolean>(false)
-  const store = useStores()
-  useEffect(() => {
-    console.log('Fetching home feed')
-    store.notesFeed.setup().then(() => setHasSetup(true))
-  }, [store.notesFeed])
-
-  const onNavigateContent = (screen: string, props: Record<string, string>) => {
-    // @ts-ignore it's up to the callers to supply correct params -prf
-    navigation.navigate(screen, props)
-  }
-
-  useEffect(() => {
-    return navigation.addListener('focus', () => {
-      if (hasSetup) {
-        console.log('Updating home feed')
-        store.notesFeed.update()
-      }
-    })
-  }, [navigation, store.notesFeed, hasSetup])
-
-  useLayoutEffect(() => {
-    navigation.setOptions({
-      headerShown: true,
-      headerTitle: 'Notifications',
-      headerLeft: () => (
-        <TouchableOpacity
-          onPress={() => navigation.push('Profile', {name: 'alice.com'})}>
-          <Image source={AVIS['alice.com']} style={styles.avi} />
-        </TouchableOpacity>
-      ),
-      headerRight: () => (
-        <TouchableOpacity
-          onPress={() => {
-            navigation.push('Composer', {})
-          }}>
-          <FontAwesomeIcon icon="plus" style={{color: '#006bf7'}} />
-        </TouchableOpacity>
-      ),
-    })
-  }, [navigation])
-
-  return (
-    <Shell>
-      <View>
-        <Feed view={store.notesFeed} onNavigateContent={onNavigateContent} />
-      </View>
-    </Shell>
-  )
-}
-
-const styles = StyleSheet.create({
-  avi: {
-    width: 20,
-    height: 20,
-    borderRadius: 10,
-    resizeMode: 'cover',
-  },
-})