Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
Fix no drop visible after logout-in & Other small fixes (#313)
Browse files Browse the repository at this point in the history
Fix #205 & Other small fixes
  • Loading branch information
celian-rib authored Nov 25, 2022
1 parent a4e80bd commit 1720b09
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 19 deletions.
6 changes: 4 additions & 2 deletions src/components/input/FormInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const FormInput = (props, ref) => {
const [partialValidity, setPartialValidity] = useState('');

useEffect(() => {
onEdited(value?.trim());
setValid(true);
if (isPassword || isEmail)
checkValidity(true, true);
Expand Down Expand Up @@ -95,7 +94,10 @@ const FormInput = (props, ref) => {
<TextInput
onFocus={() => 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}
Expand Down
25 changes: 13 additions & 12 deletions src/components/other/HomeScreenTabBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -208,9 +208,9 @@ const HomeScreenTabBar = ({ onMuseumOpenPressed, onMuseumClosePressed, museumVis
<TouchableOpacity style={styles.dropySelectionButton} onPress={handleTakePicture}>
<Entypo name='camera' size={30} color={Colors.grey} />
</TouchableOpacity>
<TouchableOpacity style={styles.dropySelectionButton} onPress={handleMusic}>
{/* <TouchableOpacity style={styles.dropySelectionButton} onPress={handleMusic}>
<Ionicons name='musical-notes-outline' size={30} color={Colors.grey} />
</TouchableOpacity>
</TouchableOpacity> */}
</DropyWheel>
</>
)}
Expand Down Expand Up @@ -262,7 +262,7 @@ const HomeScreenTabBar = ({ onMuseumOpenPressed, onMuseumClosePressed, museumVis
const DropyWheel = ({ menuAnimatedValue, children }) => (
<Animated.View style={{ ...styles.dropyWheelContainer, transform: [{ scale: menuAnimatedValue }] }}>
{children.map((child, index) => (
<DropyWheelItem key={index} index={index} childCount={children.length} size={100}>{child}</DropyWheelItem>
<DropyWheelItem key={index} index={index} childCount={children.length} size={110}>{child}</DropyWheelItem>
))}
</Animated.View>
);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useDropiesAroundSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const useDropiesAroundSocket = () => {

setDropiesAround(newDropies ?? []);
});
}, [userCoordinates?.geoHashs[0]]);
}, [userCoordinates?.geoHashs[0], user, dropySocket]);

useEffect(() => {
if (userCoordinates == null)
Expand Down
8 changes: 4 additions & 4 deletions src/screens/ProfileEditScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -258,10 +258,10 @@ const ProfileEditScreen = () => {

<FormSelect
ref={pronounsRef}
defaultIndex={Object.keys(PRONOUNS).indexOf(user.pronouns)}
defaultIndex={Math.max(Object.keys(PRONOUNS).indexOf(user.pronouns) + 1, 0)}
title='Pronouns'
onEdited={(edited) => edited && setEdited(true)}
options={Object.values(PRONOUNS)}
options={['I prefer not to tell', ...Object.values(PRONOUNS)]}
/>
</ScrollView>
</SafeAreaView>
Expand Down

0 comments on commit 1720b09

Please sign in to comment.