about summary refs log tree commit diff
path: root/src/view/screens/Composer.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/view/screens/Composer.tsx')
-rw-r--r--src/view/screens/Composer.tsx43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/view/screens/Composer.tsx b/src/view/screens/Composer.tsx
new file mode 100644
index 000000000..2de84583f
--- /dev/null
+++ b/src/view/screens/Composer.tsx
@@ -0,0 +1,43 @@
+import React, {useLayoutEffect, useRef} from 'react'
+// import {Text, TouchableOpacity} from 'react-native'
+// import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
+import {Composer as ComposerComponent} from '../com/composer/Composer'
+import {ScreenParams} from '../routes'
+
+export const Composer = ({params}: ScreenParams) => {
+  const {replyTo} = params
+  const ref = useRef<{publish: () => Promise<boolean>}>()
+
+  // TODO
+  // 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 <ComposerComponent ref={ref} replyTo={replyTo} />
+}