GOWRI-SHANKAR07 / Thryft

Second-hand Items Marketplace (Seller)
MIT License
0 stars 0 forks source link

Code Review - Profile screen2 #5

Open snaveenkumardev opened 1 year ago

snaveenkumardev commented 1 year ago

Why you added the dependency - "permissionGranted, imageUri", I think it running one time is enough not to run for permissionGranted or imageUri state changes. useEffect(() => { // check whether the camera permission is granted const checkPermission = async () => { const { status } = await getCameraPermissionsAsync(); setPermissionGranted(status === 'granted'); }

checkPermission();

(async () => {
  const storedImageUri = await AsyncStorage.getItem('profileImage');
  if (storedImageUri) {
    setImageUri(storedImageUri);
  }
})();

}, [permissionGranted, imageUri]);

GOWRI-SHANKAR07 commented 1 year ago

Added the imageUri in the useEffect Dependency to fetch the profile pic which is changed after the screen is mounted. As discussed I created another useEffect to fetch the profile pic and also removed the permissionGranted from the dependency.