diff --git a/API.js b/API.js
index 4bd087c..72b879e 100644
--- a/API.js
+++ b/API.js
@@ -135,6 +135,10 @@ const API = {
if (userid) return getCall("/post/usr/" + userid);
return getCall("/post/");
},
+ getPostsWithTag(userid, tag = "images") {
+ if (userid) return getCall("/post/usr/" + userid + "/" + tag);
+ return getCall("/post/" + tag);
+ },
getPost(postid) {
return getCall("/post/" + postid);
},
diff --git a/Views/Profile.js b/Views/Profile.js
index e2f649e..9998df9 100644
--- a/Views/Profile.js
+++ b/Views/Profile.js
@@ -1,6 +1,7 @@
import { StatusBar } from 'expo-status-bar';
import React, { useState, useEffect } from 'react';
import { View, ActivityIndicator, StyleSheet, SafeAreaView, FlatList } from 'react-native';
+import { Button, IconButton } from 'react-native-paper';
import API from './../API.js';
import Post from './../components/Post.js';
import NewPost from "./../components/NewPost.js";
@@ -31,12 +32,14 @@ const getProfilePosts = async (profileid) => {
let Profile = ({ navigation, route }) => {
let [Posts, setPosts] = useState([]);
let [profile, setProfile] = useState({});
+ const [showNewPost, setShowNewPost] = useState(false);
+ const [tag, setTag] = useState('');
useEffect(() => {
let subscribed = true;
const getData = async () => {
setPosts([]);
- if (route.params && route.params.profileid) {
+ if (route.params && route.params.profileid && tag == '') {
console.log('Loading Cache Profile:' + route.params.profileid);
await API.getUserProfile(route.params.profileid).then((profileObj) => {
if(!subscribed) return 0;
@@ -53,14 +56,32 @@ let Profile = ({ navigation, route }) => {
console.log('Store Cache Profile:' + route.params.profileid);
});
} else {
- navigation.navigate('Feed')
+ if(route.params && route.params.profileid){
+ console.log('Getting posts with tag', tag)
+ API.getPostsWithTag(route.params.profileid, tag).then((data) => {
+ if(!subscribed) return 0;
+ setPosts(data.posts);
+ });
+ } else {
+ // if no profile information is pressent should load feed
+ navigation.navigate('Feed')
+ }
}
}
getData();
return ()=>{
subscribed = false;
}
- }, [route.params?.profileid]);
+ }, [tag, route.params?.profileid]);
+
+ const getTagPosts = ()=>{
+ API.getPostsWithTag(tag).then((data) => {
+ //if(!subscribed) return 0;
+ console.log(data.posts);
+ setPosts(data.posts);
+ });
+ }
+
const renderPost = (({ item }) => {
if (item.nonOrganicType)
return (<>>);
@@ -69,7 +90,42 @@ let Profile = ({ navigation, route }) => {
const header = (
- setPosts([newPost, ...Posts])} />
+
+
+ {
+ setShowNewPost(!showNewPost);
+ }} />
+
+
+
+
+
+ { showNewPost ?
+ setPosts([newPost, ...Posts])} />
+ : <>>
+ }
)
diff --git a/Views/ProfileSettings.js b/Views/ProfileSettings.js
index 71b923f..2a0ded3 100644
--- a/Views/ProfileSettings.js
+++ b/Views/ProfileSettings.js
@@ -1,6 +1,6 @@
import React from "react";
import { View, ImageBackground, ScrollView } from "react-native";
-import { Text, TextInput, Button, Divider } from "react-native-paper";
+import { Text, TextInput, Button, Divider, Checkbox } from "react-native-paper";
import i18n from "../i18nMessages.js";
import Moment from 'moment';
import 'moment/min/locales';
@@ -125,6 +125,51 @@ let ProfileSettings = ()=>{
+
+ Optional:
+
+
+
+
+
+ setName(text)}
+ />
+ setLastName(text)}
+ />
+
+ setLastName(text)}
+ />
+ setLastName(text)}
+ />
+ setLastName(text)}
+ />
+ setLastName(text)}
+ />
+
)