about summary refs log tree commit diff
path: root/src/view/screens/stacks/Composer.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/stacks/Composer.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/stacks/Composer.tsx')
-rw-r--r--src/view/screens/stacks/Composer.tsx50
1 files changed, 0 insertions, 50 deletions
diff --git a/src/view/screens/stacks/Composer.tsx b/src/view/screens/stacks/Composer.tsx
deleted file mode 100644
index e1b36567a..000000000
--- a/src/view/screens/stacks/Composer.tsx
+++ /dev/null
@@ -1,50 +0,0 @@
-import React, {useLayoutEffect, useRef} from 'react'
-import {Text, TouchableOpacity} from 'react-native'
-import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
-import {Shell} from '../../shell'
-import type {RootTabsScreenProps} from '../../routes/types'
-import {Composer as ComposerComponent} from '../../com/composer/Composer'
-
-export const Composer = ({
-  navigation,
-  route,
-}: RootTabsScreenProps<'Composer'>) => {
-  const {replyTo} = route.params
-  const ref = useRef<{publish: () => Promise<boolean>}>()
-
-  useLayoutEffect(() => {
-    navigation.setOptions({
-      headerShown: true,
-      headerTitle: replyTo ? 'Reply' : 'New Post',
-      headerLeft: () => (
-        <TouchableOpacity onPress={() => navigation.goBack()}>
-          <FontAwesomeIcon icon="x" />
-        </TouchableOpacity>
-      ),
-      headerRight: () => (
-        <TouchableOpacity
-          onPress={() => {
-            if (!ref.current) {
-              return
-            }
-            ref.current.publish().then(
-              posted => {
-                if (posted) {
-                  navigation.goBack()
-                }
-              },
-              err => console.error('Failed to create post', err),
-            )
-          }}>
-          <Text>Post</Text>
-        </TouchableOpacity>
-      ),
-    })
-  }, [navigation, replyTo, ref])
-
-  return (
-    <Shell>
-      <ComposerComponent ref={ref} replyTo={replyTo} />
-    </Shell>
-  )
-}