ImagePicker mediaTypes for launchImageLibraryAsync does not work

Looking over:

https://docs.expo.io/versions/latest/sdk/imagepicker.html#mediatypes-string--choose-what-type-of-media-to-pick-usage-imagepickermediatypeoptionstype-where-type-is-one-of-images-videos-all

Trying to use ImagePicker.MediaTypeOptions. by ImagePicker.MediaTypeOptions is undefined.

How can i restrict user from picking videos?

What’s in your app.json and package.json? Make sure you’re using the latest version of expo and are on SDK 24.

I upgraded to 24 last week, but rolled back to 23 because I ran in to issues with react-navigation which I was not able to resolve. Also I followed the steps in the upgrade from 22 to 23, but the XDE still displays version 22.

{
  "expo": {
    "name": "SpaceIQ",
    "icon":
      "https://s3-us-west-1.amazonaws.com/effective-prod/assets/mobile/app_icon_hires.png",
    "version": "1.0.1",
    "slug": "ares",
    "sdkVersion": "23.0.0",
    "scheme": "spaceiq",
    "splash": {
      "image": "./images/auth_bg.png",
      "resizeMode": "cover"
    },
    "ios": {
      "bundleIdentifier": "com.spaceiq.spaceiq"
    },
    "android": {
      "package": "com.spaceiq.spaceiq",
      "versionCode": 3
    },
    "hooks": {
      "postPublish": [
        {
          "file": "sentry-expo/upload-sourcemaps",
          "config": {
            "organization": "SpaceIQ",
            "project": "SpaceIQ",
            "authToken": "token"
          }
        }
      ]
    }
  }
}

{
  "name": "ares",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "jest-expo": "^23.0.0",
    "react-native-scripts": "1.5.0",
    "react-test-renderer": "16.0.0-alpha.12"
  },
  "main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
  "scripts": {
    "start": "react-native-scripts start",
    "eject": "react-native-scripts eject",
    "android": "react-native-scripts android",
    "ios": "react-native-scripts ios",
    "test": "node node_modules/jest/bin/jest.js --watch"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "eslint-plugin-graphql": "^1.4.0-1",
    "expo": "^23.0.0",
    "graphiql": "^0.11.5",
    "graphql-tools": "^2.5.1",
    "jwt-decode": "^2.2.0",
    "lodash": "^4.17.4",
    "qs": "^6.5.1",
    "react": "16.0.0",
    "react-apollo": "^1.4.16",
    "react-native": "https://github.com/expo/react-native/archive/sdk-23.0.0.tar.gz",
    "react-native-action-sheet": "https://github.com/EOdOW/react-native-action-sheet/archive/0.2.2.tar.gz",
    "react-native-arkit": "^0.4.4",
    "react-native-canvas": "^0.1.20",
    "react-native-iphone-x-helper": "^1.0.1",
    "react-native-maps": "^0.17.0",
    "react-native-pinch-zoom-view": "^0.1.2",
    "react-native-transformable-image": "https://github.com/EOdOW/react-native-transformable-image/archive/v0.0.21.tar.gz",
    "react-native-view-transformer": "https://github.com/EOdOW/react-native-view-transformer/archive/v0.0.24.tar.gz",
    "react-navigation": "^1.0.0-beta.14",
    "sentry-expo": "^1.7.0"
  }
}

After changing your package.json did you rm -rf node_modules and reinstall?

Yes I followed the instructions as they are on the release notes.

did you remove yarn.lock or npm-lock.json? :stuck_out_tongue:

Nope =). You think I am running old SDK? Would the Expo XDE display the correct version, or there is somewhere else I can check?

yes, you are using the old sdk for sure! :slight_smile: you need to delete yarn.lock or npm-lock.json anytime you update versions in package.json

Than you, will give it a try :+1:

Upgraded and everything works in the new version

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.