Rewrite the post composer as a modal
This commit is contained in:
parent
41bbe2b60b
commit
cb310ab1c1
12 changed files with 207 additions and 144 deletions
|
@ -1,43 +0,0 @@
|
|||
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} />
|
||||
}
|
|
@ -5,6 +5,7 @@ import {Feed} from '../com/feed/Feed'
|
|||
import {FAB} from '../com/util/FloatingActionButton'
|
||||
import {useStores} from '../../state'
|
||||
import {FeedViewModel} from '../../state/models/feed-view'
|
||||
import {ComposePostModel} from '../../state/models/shell'
|
||||
import {ScreenParams} from '../routes'
|
||||
import {s} from '../lib/styles'
|
||||
|
||||
|
@ -30,7 +31,7 @@ export const Home = observer(function Home({visible}: ScreenParams) {
|
|||
}, [visible, store])
|
||||
|
||||
const onComposePress = () => {
|
||||
store.nav.navigate('/compose')
|
||||
store.shell.openModal(new ComposePostModel())
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue