expo / expo

An open-source framework for making universal native apps with React. Expo runs on Android, iOS, and the web.
https://docs.expo.dev
MIT License
34.41k stars 5.51k forks source link

Expo Image Picker Not working on Android 14 SDK 50 #28640

Closed sevketaydogdu closed 6 months ago

sevketaydogdu commented 6 months ago

Summary

on clear project image picker is working good but in my project doest open gallery

error occurs only on android. Edit: not giving any error. permission status is coming null

my dependencies

{
  "name": "x app",
  "main": "expo-router/entry",
  "version": "1.0.0",
  "scripts": {
    "start": "expo start",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web",
    "test": "jest --watchAll",
    "postinstall": "patch-package"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "@expo/vector-icons": "^14.0.0",
    "@fawazahmed/react-native-read-more": "^3.0.3",
    "@hookform/resolvers": "^3.3.4",
    "@invertase/react-native-apple-authentication": "^2.3.0",
    "@miblanchard/react-native-slider": "^2.6.0",
    "@microsoft/signalr": "^7.0.12",
    "@react-native-async-storage/async-storage": "^1.18.2",
    "@react-native-community/netinfo": "11.1.0",
    "@react-native-firebase/analytics": "^19.2.2",
    "@react-native-firebase/app": "^19.2.2",
    "@react-native-firebase/auth": "^19.2.2",
    "@react-native-google-signin/google-signin": "^11.0.1",
    "@react-navigation/drawer": "^6.6.15",
    "@react-navigation/material-top-tabs": "^6.6.13",
    "@react-navigation/native": "^6.0.2",
    "@reduxjs/toolkit": "^2.2.3",
    "@shopify/flash-list": "1.6.3",
    "@tamagui/babel-plugin": "^1.96.0",
    "@tamagui/font-inter": "^1.96.0",
    "@tamagui/themes": "^1.96.0",
    "axios": "^1.6.8",
    "expo": "~50.0.17",
    "expo-application": "~5.8.4",
    "expo-av": "~13.10.6",
    "expo-build-properties": "~0.11.1",
    "expo-constants": "~15.4.6",
    "expo-dev-client": "~3.3.11",
    "expo-device": "~5.9.4",
    "expo-document-picker": "~11.10.1",
    "expo-file-system": "~16.0.9",
    "expo-font": "~11.10.3",
    "expo-haptics": "~12.8.1",
    "expo-image": "~1.10.6",
    "expo-linear-gradient": "~12.7.2",
    "expo-linking": "~6.2.2",
    "expo-localization": "~14.8.4",
    "expo-notifications": "~0.27.7",
    "expo-router": "~3.4.10",
    "expo-secure-store": "~12.8.1",
    "expo-splash-screen": "~0.26.5",
    "expo-sqlite": "~13.4.0",
    "expo-status-bar": "~1.11.1",
    "expo-system-ui": "~2.9.4",
    "expo-updates": "~0.24.12",
    "expo-video-thumbnails": "~7.9.0",
    "expo-web-browser": "~12.8.2",
    "fast-xml-parser": "^4.3.6",
    "html-entities": "^2.5.2",
    "humanize-duration": "^3.32.0",
    "i18n-js": "^4.4.3",
    "jwt-decode": "^4.0.0",
    "lodash": "^4.17.21",
    "moment": "^2.30.1",
    "patch-package": "^8.0.0",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-hook-form": "^7.51.3",
    "react-native": "0.73.6",
    "react-native-gesture-handler": "~2.14.0",
    "react-native-get-random-values": "~1.8.0",
    "react-native-pager-view": "6.2.3",
    "react-native-reanimated": "~3.6.2",
    "react-native-receive-sharing-intent": "^2.0.0",
    "react-native-render-html": "^6.3.4",
    "react-native-safe-area-context": "4.8.2",
    "react-native-screens": "~3.29.0",
    "react-native-slider": "^0.11.0",
    "react-native-svg": "14.1.0",
    "react-native-svg-transformer": "^1.3.0",
    "react-native-tab-view": "^3.5.2",
    "react-native-web": "~0.19.6",
    "react-native-xml2js": "^1.0.3",
    "react-redux": "^9.1.2",
    "redux-persist": "^6.0.0",
    "swr": "^2.2.5",
    "tamagui": "^1.96.0",
    "yup": "^1.4.0",
    "expo-image-picker": "~14.7.1"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@types/lodash": "^4.17.1",
    "@types/react": "~18.2.45",
    "jest": "^29.2.1",
    "jest-expo": "~50.0.4",
    "react-test-renderer": "18.2.0",
    "typescript": "^5.1.3"
  },
  "private": true
}

What platform(s) does this occur on?

Android

SDK Version

50

Environment

expo-env-info 1.2.0 environment info: System: OS: macOS 14.4.1 Shell: 5.9 - /bin/zsh Binaries: Node: 20.12.2 - /usr/local/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 10.5.0 - /usr/local/bin/npm Watchman: 2024.04.22.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.15.2 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 23.4, iOS 17.4, macOS 14.4, tvOS 17.4, visionOS 1.1, watchOS 10.4 IDEs: Xcode: 15.3/15E204a - /usr/bin/xcodebuild npmPackages: expo: ~50.0.17 => 50.0.17 expo-router: ~3.4.10 => 3.4.10 react: 18.2.0 => 18.2.0 react-dom: 18.2.0 => 18.2.0 react-native: 0.73.6 => 0.73.6 react-native-web: ~0.19.6 => 0.19.11 npmGlobalPackages: eas-cli: 7.8.4 Expo Workflow: bare

Minimal reproducible example

import * as ImagePicker from 'expo-image-picker';
 import { useState } from 'react';
import { Keyboard, Alert } from 'react-native'; 

interface IUsePickImagesProps extends ImagePicker.ImagePickerAsset {
  previewUri?: string;
}

export const usePickImages = () => {
   const [image, setImage] = useState<IUsePickImagesProps | null>(null);
  const [imageIsLoading, setImageIsLoading] = useState<boolean>(false);
  const [status, requestPermission] = ImagePicker.useMediaLibraryPermissions();

  async function pickImage({ mediaTypes }: { mediaTypes?: ImagePicker.MediaTypeOptions }) {
    if (!status?.granted) {
      requestPermission();
    } else {
      // No permissions request is necessary for launching the image library
      let result = await ImagePicker.launchImageLibraryAsync({
        mediaTypes: mediaTypes,
        quality: 1,
      });

      console.log(result);

      if (!result.canceled) {
        setImage(result.assets[0]);
      }
    }
  }

  return { pickImage, image, imageIsLoading, setImage };
};

<>
<Button onPress={() => pickImage({mediaTypes:MediaTypeOptions.All})}>pick image</Button>
</>
sevketaydogdu commented 6 months ago

uninstalled "expo-sqlite" and started work there was a problem in sqlite before removing sqlite fonts were not loading also can someone pay attention for sqlite package in sdk 50 please

Chayma-Soussi commented 6 months ago

expo image picker dont work in expo go sdk 51

socheatleang commented 2 weeks ago

Why does this issue close?. I'm also running an issue with android. Expo-Image-Picker@15.0.7 with Expo@51. iOS is pretty fine. Only Android has issue.