Skip to content

Commit

Permalink
img picker done
Browse files Browse the repository at this point in the history
  • Loading branch information
medomy committed Jan 30, 2023
1 parent 8b4cd82 commit 0c57fa4
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
4 changes: 2 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:remove="android:maxSdkVersion"/>
<!-- <uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:remove="android:maxSdkVersion"/> -->



Expand Down
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"react": "18.2.0",
"react-native": "0.71.1",
"react-native-image-crop-picker": "^0.39.0",
"react-native-image-picker": "^5.0.1",
"react-native-safe-area-context": "^4.5.0",
"react-native-screens": "^3.19.0",
"react-native-splash-screen": "^3.3.0",
Expand Down
19 changes: 13 additions & 6 deletions src/components/profileComponents/profileCircle/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from 'react'
import { COLORS, SIZES } from '../../../constants'
import Icon from 'react-native-vector-icons/FontAwesome'
import ImagePicker from 'react-native-image-crop-picker';
import { launchCamera, launchImageLibrary } from 'react-native-image-picker';
interface props {
profilePic: string,
changeProfilePic: (uri: string) => void,
Expand All @@ -11,12 +12,18 @@ const ProfileCircle = ({ profilePic, changeProfilePic }: props) => {

const openImgPicker = async () => {
try {
const img = await ImagePicker.openPicker({
width: 300,
height: 300,
cropping: true
})
changeProfilePic(img.path);
// const img = await ImagePicker.openPicker({
// width: 300,
// height: 300,
// cropping: true
// })
// changeProfilePic(img.path);
const result = await launchImageLibrary({
mediaType: "photo"
});
if (result.assets) {
changeProfilePic(result!.assets[0]!.uri!)
}
} catch (err) { console.warn(err) }
}
return (
Expand Down

0 comments on commit 0c57fa4

Please sign in to comment.