From 1720b0944a076a54660d4caf1134b8708db1e3d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9lian=20Riboulet?= Date: Fri, 25 Nov 2022 18:11:14 +0100 Subject: [PATCH] Fix no drop visible after logout-in & Other small fixes (#313) Fix #205 & Other small fixes --- src/components/input/FormInput.js | 6 ++++-- src/components/other/HomeScreenTabBar.js | 25 ++++++++++++------------ src/hooks/useDropiesAroundSocket.js | 2 +- src/screens/ProfileEditScreen.js | 8 ++++---- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/components/input/FormInput.js b/src/components/input/FormInput.js index c4c7ceae..4f928344 100644 --- a/src/components/input/FormInput.js +++ b/src/components/input/FormInput.js @@ -34,7 +34,6 @@ const FormInput = (props, ref) => { const [partialValidity, setPartialValidity] = useState(''); useEffect(() => { - onEdited(value?.trim()); setValid(true); if (isPassword || isEmail) checkValidity(true, true); @@ -95,7 +94,10 @@ const FormInput = (props, ref) => { setSelected(true)} onBlur={() => setSelected(false)} - onChangeText={(text) => setValue(text)} + onChangeText={(text) => { + setValue(text); + onEdited(text); + }} style={{ ...Fonts.regular(12, Colors.darkGrey), ...styles.textInput, textAlignVertical: 'top' }} placeholder={placeholder} placeholderTextColor={Colors.grey} diff --git a/src/components/other/HomeScreenTabBar.js b/src/components/other/HomeScreenTabBar.js index 7e630ec9..e9e99e4c 100644 --- a/src/components/other/HomeScreenTabBar.js +++ b/src/components/other/HomeScreenTabBar.js @@ -123,14 +123,14 @@ const HomeScreenTabBar = ({ onMuseumOpenPressed, onMuseumClosePressed, museumVis setDropyMenuIsOpen(false); }; - const handleMusic = () => { - setDropyMenuIsOpen(false); - sendAlert({ - title: 'Not available yet', - description: 'Creating musical drops will soon be possible.', - validateText: 'OK !', - }); - }; + // const handleMusic = () => { + // setDropyMenuIsOpen(false); + // sendAlert({ + // title: 'Not available yet', + // description: 'Creating musical drops will soon be possible.', + // validateText: 'OK !', + // }); + // }; const onPressGlassButton = async () => { if (canEmitDropy) { @@ -208,9 +208,9 @@ const HomeScreenTabBar = ({ onMuseumOpenPressed, onMuseumClosePressed, museumVis - + {/* - + */} )} @@ -262,7 +262,7 @@ const HomeScreenTabBar = ({ onMuseumOpenPressed, onMuseumClosePressed, museumVis const DropyWheel = ({ menuAnimatedValue, children }) => ( {children.map((child, index) => ( - {child} + {child} ))} ); @@ -273,7 +273,8 @@ const DropyWheelItem = ({ children, index, childCount, size }) => { const handleLayout = (event) => { const { layout } = event.nativeEvent; - const angle = ((index * Math.PI) / (childCount - 1)) + (Math.PI / 2); + const itemAngleDiff = (index * Math.PI / 2); + const angle = (itemAngleDiff / (childCount - 1)) + (3 * Math.PI / 4); let x = (Math.sin(angle) * size); let y = (Math.cos(angle) * size); diff --git a/src/hooks/useDropiesAroundSocket.js b/src/hooks/useDropiesAroundSocket.js index fa875965..2c4042cf 100644 --- a/src/hooks/useDropiesAroundSocket.js +++ b/src/hooks/useDropiesAroundSocket.js @@ -81,7 +81,7 @@ const useDropiesAroundSocket = () => { setDropiesAround(newDropies ?? []); }); - }, [userCoordinates?.geoHashs[0]]); + }, [userCoordinates?.geoHashs[0], user, dropySocket]); useEffect(() => { if (userCoordinates == null) diff --git a/src/screens/ProfileEditScreen.js b/src/screens/ProfileEditScreen.js index d2c83f7a..8cb11328 100644 --- a/src/screens/ProfileEditScreen.js +++ b/src/screens/ProfileEditScreen.js @@ -164,7 +164,7 @@ const ProfileEditScreen = () => { const displayName = displayNameInputRef.current?.getValue(); const about = aboutInputRef.current?.getValue(); - const pronouns = Object.keys(PRONOUNS)[pronounsRef.current?.getValue()]; + const pronouns = Object.keys(PRONOUNS)[pronounsRef.current?.getValue() - 1]; const response = await API.postProfileInfos(about, pronouns, displayName); const profile = response.data; @@ -176,7 +176,7 @@ const ProfileEditScreen = () => { title: 'Oh no...', description: 'We could\'nt update your profile\nCheck your internet connection!', }); - console.error('Error while updatng profile', error?.response?.data || error); + console.error('Error while updating profile', error?.response?.data || error); } finally { setInfosUploading(false); setEdited(false); @@ -258,10 +258,10 @@ const ProfileEditScreen = () => { edited && setEdited(true)} - options={Object.values(PRONOUNS)} + options={['I prefer not to tell', ...Object.values(PRONOUNS)]} />