From 5d75938e57ccf4c0cc0b8396a17bb6b65c687428 Mon Sep 17 00:00:00 2001 From: Roman Smal <46260542+G-Ro-Man@users.noreply.github.com> Date: Fri, 22 Oct 2021 12:11:10 +0300 Subject: [PATCH] fixes after code review --- src/components/input/index.tsx | 2 +- src/features/profile/index.tsx | 25 ++++++++++++------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/components/input/index.tsx b/src/components/input/index.tsx index d7e690d..c9d8742 100644 --- a/src/components/input/index.tsx +++ b/src/components/input/index.tsx @@ -26,7 +26,7 @@ export const Input = ({ const [isError, setIsError] = useState(false); const _onChangeText = (value: string) => { - onChangeText && onChangeText(value); + onChangeText(value); setIsError(!rule.test(value)); }; diff --git a/src/features/profile/index.tsx b/src/features/profile/index.tsx index 22419fd..33c1014 100644 --- a/src/features/profile/index.tsx +++ b/src/features/profile/index.tsx @@ -37,20 +37,17 @@ export const ProfileScreen = () => { useEffect(() => { (async () => { - if (Platform.OS !== 'web') { - const { status } = - await ImagePicker.requestMediaLibraryPermissionsAsync(); - if (status !== 'granted') { - alert('Sorry, we need camera roll permissions to make this work!'); - } + const { status } = + await ImagePicker.requestMediaLibraryPermissionsAsync(); + if (status !== 'granted') { + alert('Sorry, we need camera roll permissions to make this work!'); } })(); }, []); const pickImage = async () => { let permission = await ImagePicker.getMediaLibraryPermissionsAsync(); - console.log('permission: ', permission); - if (permission.status !== 'denied') { + if (permission.granted) { let result = await ImagePicker.launchImageLibraryAsync({ allowsEditing: true, aspect: [1, 1], @@ -58,13 +55,12 @@ export const ProfileScreen = () => { limited: true, accessPrivileges: 'limited', }); - console.log(result); if (!result.cancelled) { setImage(result.uri); } } else { - alert('Sorry, we need camera roll permissions to make this work!'); + alert('Sorry, we need library permissions to make this work!'); } }; @@ -79,9 +75,7 @@ export const ProfileScreen = () => { Profile - +