Socket
Book a DemoInstallSign in
Socket

expo-image-picker-hook

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expo-image-picker-hook

Convenient hook for expo-image-picker

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

npm TypeScript PRs Welcome npm

expo-image-picker-hook

Convenient hook for expo-image-picker.

Supports blob and base64.

💿 Installation

expo install expo-image-picker-hook expo-image-picker

📖 Usage

function MyComponent() {
  const ImagePicker = useImagePicker({
    aspect: [2, 1],
    quality: 0.9,
    permissionNotGrantedText: 'You need to give the app permission to select the image.',
  })

  const pick = () => {
    ImagePicker.pick()
      .catch(err => Alert.alert('Error', err.message))
  }

  const upload = () => {
    ImagePicker.upload({ fun: (image) => myApi.uploadImage(image) }, { mode: 'base64' })
      .catch(err => Alert.alert('Error', err.message))
  }

  return (
    <View>
      <Image source={{ uri: ImagePicker.imageUri }}>
      <Button onPress={pick}>
      <Button onPress={upload} disabled={!ImagePicker.isPicked}>
    </View>
  )
}

📰 Changelog

FAQs

Package last updated on 12 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts