expo
expo copied to clipboard
expo-image-picker launchImageLibraryAsync keeps closing on force on iOS
Minimal reproducible example
https://snack.expo.dev/@airple-developer/expo-image-picker-ios
Summary
launchImageLibraryAsync from "expo-image-picker" keeps closing on its own on iOS. I have tried all the permissions check and all possible parameters, including quality and presentationStyle, but the imagepicker window keeps closing on its own automatically still.
Environment
expo-env-info 1.0.5 environment info: System: OS: macOS 14.1 Shell: 5.9 - /bin/zsh Binaries: Node: 21.2.0 - /opt/homebrew/bin/node Yarn: 1.22.21 - /usr/local/bin/yarn npm: 10.2.3 - /opt/homebrew/bin/npm Watchman: 2023.11.20.00 - /opt/homebrew/bin/watchman SDKs: iOS SDK: Platforms: DriverKit 23.0, iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0 IDEs: Android Studio: 2022.3 AI-223.8836.35.2231.11090377 Xcode: 15.0.1/15A507 - /usr/bin/xcodebuild npmPackages: @expo/webpack-config: ^18.0.4 => 18.0.4 expo: ^48.0.10 => 48.0.10 react: 18.2.0 => 18.2.0 react-dom: ^18.2.0 => 18.2.0 react-native: 0.71.14 => 0.71.14 react-native-web: ^0.18.12 => 0.18.12 Expo Workflow: managed
"dependencies": { "@hashiprobr/expo-pdf-reader": "^1.0.8", "@openspacelabs/react-native-zoomable-view": "^2.1.5", "@react-native-async-storage/async-storage": "1.17.11", "@react-native-community/datetimepicker": "6.7.3", "@react-native-community/masked-view": "^0.1.11", "@react-native-firebase/app": "18.2.0", "@react-native-firebase/auth": "^18.3.0", "@react-native-firebase/messaging": "^18.2.0", "@react-native-google-signin/google-signin": "^10.0.1", "@react-navigation/material-bottom-tabs": "^6.2.12", "@react-navigation/native": "^6.1.3", "@react-navigation/stack": "^6.3.12", "@reduxjs/toolkit": "^1.9.2", "@shopify/flash-list": "1.4.0", "axios": "^1.4.0", "date-fns": "^2.30.0", "expo": "^48.0.10", "expo-application": "~5.1.1", "expo-av": "~13.2.1", "expo-build-properties": "~0.6.0", "expo-camera": "~13.2.1", "expo-clipboard": "~4.1.2", "expo-constants": "~14.2.1", "expo-crypto": "~12.2.1", "expo-dev-client": "~2.2.1", "expo-device": "~5.2.1", "expo-file-system": "~15.2.2", "expo-font": "~11.1.1", "expo-image": "~1.0.2", "expo-image-loader": "^4.4.0", "expo-image-manipulator": "~11.1.1", "expo-image-picker": "~14.1.1", "expo-location": "~15.1.1", "expo-media-library": "~15.2.3", "expo-navigation-bar": "~2.1.1", "expo-notifications": "~0.18.1", "expo-screen-orientation": "~5.1.1", "expo-sharing": "~11.2.2", "expo-splash-screen": "~0.18.2", "expo-status-bar": "~1.4.4", "expo-updates": "~0.16.4", "fbjs": "^3.0.4", "moment": "^2.29.4", "parse": "^3.4.0", "react": "18.2.0", "react-dom": "^18.2.0", "react-native": "0.71.14", "react-native-app-intro-slider": "^4.0.4", "react-native-base64": "^0.2.1", "react-native-calendars": "^1.1298.0", "react-native-gesture-handler": "~2.9.0", "react-native-global-props": "^1.1.5", "react-native-google-places-autocomplete": "^2.5.1", "react-native-maps": "1.3.2", "react-native-paper": "^5.1.4", "react-native-qrcode-svg": "^6.2.0", "react-native-radio-buttons-group": "^2.3.1", "react-native-raw-bottom-sheet": "^2.2.0", "react-native-render-html": "^6.3.4", "react-native-safe-area-context": "4.5.0", "react-native-safe-area-view": "^1.1.1", "react-native-screens": "~3.20.0", "react-native-svg": "13.4.0", "react-native-vector-icons": "^9.2.0", "react-native-view-shot": "3.5.0", "react-native-web": "^0.18.12", "react-native-webview": "11.26.0", "react-redux": "^8.0.5", "redux": "^4.2.1", "redux-thunk": "^2.4.2", "rn-pdf-reader-js": "^4.1.1" }, "devDependencies": { "@babel/core": "^7.12.9", "@expo/webpack-config": "^18.0.4", "eslint-plugin-react-hooks": "^4.6.0" },
Hi - I've run your snack and don't see the issue. It's working as expected. I've changed the snack to display the picked image and that is working too. Can you create a minimal project that presents the issue?
I'm having this problem too, but it's not always present.
I get some warnings when I call launchImageLibraryAsync
Attempt to present <PHPickerViewController: 0x1277c3aa0> on <RCTModalHostViewController: 0x135b51fe0> (from <RCTModalHostViewController: 0x135b51fe0>) whose view is not in the window hierarchy.
This issue is stale because it has been open for 90 days with no activity. If there is no activity in the next 7 days, the issue will be closed.
This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem.
@zhiqingchen 这个问题我调试分析是由于taro-rn里的chooseImage方法中的new RootSiblings后的的真实dom还没有销毁渲染导致的,需要等到渲染后再调用原生ios的ImagePicker.launchImageLibraryAsyns的方法,希望提供的对你有帮助。 I debugged and analyzed this issue because the real DOM after the new RootSiblings in the chooseImage method in taro rn has not been destroyed by rendering. You need to wait until rendering before calling the native iOS ImagePicker.launchImageLibraryAsyns method. I hope this is helpful to you