From bf0807ba8c66417010c48bb85da07b8f2e0f44cf Mon Sep 17 00:00:00 2001 From: Adolfo Reyna Date: Fri, 23 Dec 2022 00:17:36 -0500 Subject: [PATCH] Profile Settings --- App.js | 7 +++- Views/Menu.js | 30 ++++++++--------- Views/ProfileSettings.js | 51 +++++++++++++++++++++++++++++ Views/Search.js | 7 ++-- components/ProfileCardHorizontal.js | 31 ++++++++++-------- 5 files changed, 90 insertions(+), 36 deletions(-) create mode 100644 Views/ProfileSettings.js diff --git a/App.js b/App.js index 7d1916d..c8c86fc 100644 --- a/App.js +++ b/App.js @@ -20,6 +20,7 @@ import i18n from "./i18nMessages.js"; import NewPostView from './Views/NewPost.js'; import { TouchableOpacity, View } from 'react-native'; import MenuView from './Views/Menu.js'; +import ProfileSettings from './Views/ProfileSettings.js'; const Tab = createBottomTabNavigator(); @@ -156,7 +157,7 @@ const MainNavigation = () => { + { +let MenuView = ({navigation})=>{ const [value, setValue] = React.useState('es'); - React.useEffect(()=>{ - i18n.locale = value; - Moment.updateLocale(i18n.locale); - }, [value]) + let changeLang = (locale) =>{ + i18n.locale = locale; + Moment.locale(locale); + setValue(locale); + } return ( + {navigation.navigate("ProfileSettings")}} left={props => } /> } /> } /> + + } /> - - setValue(newValue)} value={value}> - - Español - - - - English - - + + Lenguage: + changeLang(newValue)} value={value}> + + diff --git a/Views/ProfileSettings.js b/Views/ProfileSettings.js new file mode 100644 index 0000000..cc51d4a --- /dev/null +++ b/Views/ProfileSettings.js @@ -0,0 +1,51 @@ +import React from "react"; +import { View } from "react-native"; +import { Text, TextInput, RadioButton, Divider } from "react-native-paper"; +import i18n from "../i18nMessages.js"; +import Moment from 'moment'; +import 'moment/min/locales'; +import ProfileCardHorizontal from "../components/ProfileCardHorizontal.js"; +Moment.locale(i18n.locale); +import { useSnapshot } from 'valtio'; +import GlobalState from '../contexts/GlobalState.js'; + + +let ProfileSettings = ()=>{ + const gState = useSnapshot(GlobalState); + const viewer = gState.me; + return ( + + Profile Settings + + setText(text)} + /> + setText(text)} + /> + + setText(text)} + /> + + + + + + ) +} + +export default ProfileSettings; \ No newline at end of file diff --git a/Views/Search.js b/Views/Search.js index 0d437aa..15418ef 100644 --- a/Views/Search.js +++ b/Views/Search.js @@ -40,12 +40,11 @@ const Search = () => { return (); }); return ( - + { searchQuery.length ? @@ -56,16 +55,14 @@ const Search = () => { renderItem={renderProfile} keyExtractor={item => item._id} /> : - <> - Current Following: item} + ListHeaderComponent={Current Following} /> - } ) diff --git a/components/ProfileCardHorizontal.js b/components/ProfileCardHorizontal.js index 317d10b..75b7a98 100644 --- a/components/ProfileCardHorizontal.js +++ b/components/ProfileCardHorizontal.js @@ -28,7 +28,7 @@ const getName = async (key) => { } } -let ProfileCardHorizontal = ({ profileid, hideIcon, profileObj }) => { +let ProfileCardHorizontal = ({ profileid, hideIcon, profileObj, skipFollow, skiptOnPress }) => { let [profile, setProfile] = useState(profileObj || {}); const navigation = useNavigation(); @@ -54,13 +54,14 @@ let ProfileCardHorizontal = ({ profileid, hideIcon, profileObj }) => { let photoUrl = profile.profile?.photo ? 'https://social.emmint.com/' + profile.profile.photo : DefaultPhoto; const onPress = () => { + if(skiptOnPress) return 0; return navigation.navigate('Profile', { profileid: profile._id }) } return ( - + @@ -74,18 +75,20 @@ let ProfileCardHorizontal = ({ profileid, hideIcon, profileObj }) => { - - - + {skipFollow ? <> : + + + + } );