Enable image-only posts

zio/stable
Paul Frazee 2022-12-19 18:51:13 -06:00
parent e99eb7bfad
commit 3ae5f2886b
4 changed files with 47 additions and 30 deletions

View File

@ -117,7 +117,7 @@ export const ComposePost = observer(function ComposePost({
return return
} }
setError('') setError('')
if (text.trim().length === 0) { if (text.trim().length === 0 && selectedPhotos.length === 0) {
setError('Did you want to say anything?') setError('Did you want to say anything?')
return false return false
} }

View File

@ -159,14 +159,19 @@ export const PostThreadItem = observer(function PostThreadItem({
</View> </View>
</View> </View>
<View style={[s.pl10, s.pr10, s.pb10]}> <View style={[s.pl10, s.pr10, s.pb10]}>
{record.text ? (
<View <View
style={[styles.postTextContainer, styles.postTextLargeContainer]}> style={[
styles.postTextContainer,
styles.postTextLargeContainer,
]}>
<RichText <RichText
text={record.text} text={record.text}
entities={record.entities} entities={record.entities}
style={[styles.postText, styles.postTextLarge]} style={[styles.postText, styles.postTextLarge]}
/> />
</View> </View>
) : undefined}
<PostEmbeds embed={item.embed} style={s.mb10} /> <PostEmbeds embed={item.embed} style={s.mb10} />
{item._isHighlightedPost && hasEngagement ? ( {item._isHighlightedPost && hasEngagement ? (
<View style={styles.expandedInfo}> <View style={styles.expandedInfo}>
@ -271,6 +276,7 @@ export const PostThreadItem = observer(function PostThreadItem({
onCopyPostText={onCopyPostText} onCopyPostText={onCopyPostText}
onDeletePost={onDeletePost} onDeletePost={onDeletePost}
/> />
{record.text ? (
<View style={styles.postTextContainer}> <View style={styles.postTextContainer}>
<RichText <RichText
text={record.text} text={record.text}
@ -278,6 +284,9 @@ export const PostThreadItem = observer(function PostThreadItem({
style={[styles.postText]} style={[styles.postText]}
/> />
</View> </View>
) : (
<View style={{height: 5}} />
)}
<PostEmbeds embed={item.embed} style={{marginBottom: 10}} /> <PostEmbeds embed={item.embed} style={{marginBottom: 10}} />
<PostCtrls <PostCtrls
replyCount={item.replyCount} replyCount={item.replyCount}

View File

@ -175,6 +175,7 @@ export const Post = observer(function Post({
</Link> </Link>
</View> </View>
)} )}
{record.text ? (
<View style={styles.postTextContainer}> <View style={styles.postTextContainer}>
<RichText <RichText
text={record.text} text={record.text}
@ -182,6 +183,9 @@ export const Post = observer(function Post({
style={styles.postText} style={styles.postText}
/> />
</View> </View>
) : (
<View style={{height: 5}} />
)}
<PostEmbeds embed={item.embed} style={{marginBottom: 10}} /> <PostEmbeds embed={item.embed} style={{marginBottom: 10}} />
<PostCtrls <PostCtrls
replyCount={item.replyCount} replyCount={item.replyCount}

View File

@ -187,6 +187,7 @@ export const FeedItem = observer(function FeedItem({
</Link> </Link>
</View> </View>
)} )}
{record.text ? (
<View style={styles.postTextContainer}> <View style={styles.postTextContainer}>
<RichText <RichText
text={record.text} text={record.text}
@ -194,6 +195,9 @@ export const FeedItem = observer(function FeedItem({
style={styles.postText} style={styles.postText}
/> />
</View> </View>
) : (
<View style={{height: 5}} />
)}
<PostEmbeds embed={item.embed} style={styles.postEmbeds} /> <PostEmbeds embed={item.embed} style={styles.postEmbeds} />
<PostCtrls <PostCtrls
replyCount={item.replyCount} replyCount={item.replyCount}