<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Angela Mbakwe  on Medium]]></title>
        <description><![CDATA[Stories by Angela Mbakwe  on Medium]]></description>
        <link>https://medium.com/@mbakweangela96?source=rss-556651750fc4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*KKzuxmaDf-VCJArN</url>
            <title>Stories by Angela Mbakwe  on Medium</title>
            <link>https://medium.com/@mbakweangela96?source=rss-556651750fc4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 22:06:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mbakweangela96/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[INTEGRATING EXPO IMAGE PICKER IN REACT NATIVE APPLICTION]]></title>
            <link>https://medium.com/@mbakweangela96/integrating-expo-image-picker-in-react-native-appliction-95059f9086fe?source=rss-556651750fc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/95059f9086fe</guid>
            <category><![CDATA[expo]]></category>
            <category><![CDATA[react-native-app]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Angela Mbakwe ]]></dc:creator>
            <pubDate>Mon, 07 Jul 2025 10:12:30 GMT</pubDate>
            <atom:updated>2025-07-07T10:12:30.419Z</atom:updated>
            <content:encoded><![CDATA[<p>When building a React Native app with expo-image-picker, I ran into a frustrating issue: <strong>every time I clicked on the button “Take a picture,” which was supposed to trigger my camera to open, my app crashed and closed immediately.</strong></p><p>No logs, no errors — just <em>poof</em>. Gone.</p><p>After hours of debugging, I finally figured it out — and here’s how I solved it.</p><h3>The Problem</h3><p>i was using expo-image-picker like this:</p><pre>const result = await ImagePicker.launchCameraAsync({<br>  mediaTypes: ImagePicker.MediaTypeOptions.Images,<br>  allowsEditing: true,<br>  quality: 1,<br>});</pre><p>Whenever I clicked the button to <strong>take a photo</strong>, the camera would try to open… then the app would just <strong>close</strong>.</p><p>No helpful logs, just the dreaded [Unhandled promise rejection: Error: camera permission not granted] in some cases — or nothing at all.</p><h3>Root Cause</h3><p>There were <strong>two key issues</strong>:</p><ol><li>I wasn’t checking for camera permissions before launching the camera.</li><li>ImagePicker.MediaTypeOptions is deprecated — it&#39;s now recommended to use ImagePicker.MediaType.</li></ol><h3>The Fix</h3><h4>1. Request Camera Permissions First</h4><pre>const [statusCamera, requestPermissionCamera] = ImagePicker.useCameraPermissions();<br><br>const takeAPicture = async (setFieldValue: any) =&gt; {<br>  try {<br>    if (!statusCamera?.granted) {<br>      const permission = await requestPermissionCamera();<br>      if (!permission.granted) {<br>        Alert.alert(&quot;Permission to access camera is required!&quot;);<br>        return;<br>      }<br>    }<br><br>    const result = await ImagePicker.launchCameraAsync({<br>      mediaTypes: [ImagePicker.MediaType.IMAGE],<br>      allowsEditing: true,<br>      quality: 1,<br>    });<br><br>    if (!result.canceled) {<br>      const uri = result.assets[0].uri;<br>      setFieldValue(&quot;image&quot;, uri);<br>    }<br>  } catch (error) {<br>    console.error(&quot;Camera Error&quot;, error);<br>    Alert.alert(&quot;Error&quot;, &quot;Something went wrong while accessing the camera.&quot;);<br>  }<br>};</pre><p><strong>For Gallery upload, do the same process:</strong></p><pre> const [status, requestPermission] = ImagePicker.useMediaLibraryPermissions();<br><br> const galleryUpload = async (setFieldValue: any) =&gt; {<br>    try {<br>      if (!status?.granted) {<br>        const permission = await requestPermission();<br>        if (!permission.granted) {<br>          Alert.alert(&quot;Permission to access gallery is required!&quot;);<br>          return;<br>        }<br>      }<br><br>      const result = await ImagePicker.launchImageLibraryAsync({<br>        mediaTypes: [ImagePicker.MediaType.IMAGE],<br>        allowsEditing: true,<br>        quality: 1,<br>      });<br><br>      if (!result.canceled) {<br>        const uri = result.assets[0].uri;<br>        setImagePath(uri);<br>        setFieldValue(&quot;Image&quot;, uri);<br>      }<br>    } catch (error) {<br>      console.error(&quot;Gallery Error&quot;, error);<br>      Alert.alert(&quot;Error&quot;, &quot;Something went wrong while accessing the gallery.&quot;);<br>    }<br>  };</pre><p>2. <strong>Use the New MediaType Format</strong></p><pre>mediaTypes: [ImagePicker.MediaType.IMAGE]</pre><p>Make sure your app.json has the right permissions:</p><pre>&quot;ios&quot;: {<br>  &quot;infoPlist&quot;: {<br>    &quot;NSCameraUsageDescription&quot;: &quot;This app uses the camera to let you take profile pictures&quot;,<br>    &quot;NSPhotoLibraryUsageDescription&quot;: &quot;This app needs access to your photo library to upload images.&quot;,<br>    &quot;NSPhotoLibraryAddUsageDescription&quot;: &quot;This app needs permission to save photos to your library.&quot;<br>  }<br>},<br>&quot;android&quot;: {<br>  &quot;permissions&quot;: [&quot;CAMERA&quot;, &quot;READ_EXTERNAL_STORAGE&quot;, &quot;WRITE_EXTERNAL_STORAGE&quot;]<br>}</pre><p>Once I implemented permission checking and updated the deprecated syntax, <strong>the camera opened smoothly and image selection worked without any crashes</strong>.</p><p>If you’re facing a similar issue where your React Native app closes when accessing the camera — I hope this helps you save hours of debugging!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95059f9086fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>