Skip to content

Commit

Permalink
allow posts with just links or images
Browse files Browse the repository at this point in the history
  • Loading branch information
econnerty committed Apr 6, 2023
1 parent f62331b commit 2e918c0
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/PostsScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,9 @@ export function PostsScreen({navigation}) {

const CreatePost = async () => {
if (
postText &&
(postText &&
postText.length < 1000 &&
postText.split(/\r\n|\r|\n/).length <=
25 /*this last one checks that there are not too many lines */
postText.split(/\r\n|\r|\n/).length <= 25) || (image && !postText) || (postText.search(/(?:https?|ftp):\/\/[\n\S]+/g, '') > 0 && postText.length < 1000 && postText.split(/\r\n|\r|\n/).length <= 25)
) {
setPostUploading(true)
if (image) {await uploadPic()}
Expand Down Expand Up @@ -492,7 +491,7 @@ export function PostsScreen({navigation}) {
Promise.all(promises).then(() => {
setPosts(posts.filter(Boolean)); // Remove any empty slots from the array
setImages(images);
setRefreshList(!refresh);
//setRefreshList(!refresh);
setLoading(false);
});
});
Expand Down Expand Up @@ -1135,8 +1134,6 @@ export function PostsScreen({navigation}) {
// onEndReachedThreshold={.9}
data={posts}
ref={list}
key={refresh}
extraData={refresh}
renderItem={renderPost}
keyExtractor={item => item.key}
refreshing={refreshing}
Expand Down

0 comments on commit 2e918c0

Please sign in to comment.