Krizaka UI
Krizaka UI
Composants

Media picker

Photos and videos picked from the library or the camera, as a grid of tiles with a remove button and a count.

MobileBêtaMédias

Mobile uniquement — React Native, depuis @krizaka/ui/native/media-picker. Bêta : son API peut encore changer à une version mineure.

Pourquoi il est là. the native apps: Yasakia (PY4), Yororis (PYO2), Orochia mobile (PS6), Orazaka mobile: choosing or taking a photo.

Quand l’utiliser

  • The photos of a story, a post, a profile.
  • A proof of delivery for a challenge.

Quand ne pas l’utiliser

Installation

Installer

npx expo install react-native-svg
npm install @krizaka/ui

Importer

import { MediaPicker } from "@krizaka/ui/native/media-picker";

Enveloppez l’application une fois dans ThemeProvider de @krizaka/ui/native : chaque composant lit ses rôles de couleur.

Exemples

React Native n’a pas d’aperçu en direct sur le web : chaque exemple montre la capture de sa story, testée dans les deux thèmes, et le code à copier.

A story's photos

Up to four photos, from the library or the camera.

Media picker — A story's photos, tel que React Native le rendMedia picker — A story's photos, tel que React Native le rend

Props

Photos and videos picked from the library or the camera, as a grid of square tiles: an add tile (the system's picker, or a sheet to choose library or camera), a remove button on each tile, a count against max.

PropTypeDéfautDescription
labelsrequisMediaPickerLabels—The words, passed translated.
onValueChangerequis(media: PickedMedia[]) => void—Called with the new list.
valuerequisreadonly PickedMedia[]—The media picked (controlled).
accept"all" | "images" | "videos"imagesWhat can be picked. Default images.
camerabooleantrueOffer the camera beside the library. Default true.
maxnumber1The most that can be picked. Default 1.
onPermissionDenied(() => void)—Called when the camera is refused (show a PermissionPrompt).
styleStyleProp<ViewStyle>—Styles merged last.

Accessibilité

  • The add tile and each remove button are named (labels).
  • Refused camera: onPermissionDenied shows a PermissionPrompt.

Bonnes pratiques

  • Set max, and accept to what the feature takes.
  • Upload from the uri of each picked item (a Dropzone on the web).

Générée depuis le code de @krizaka/ui 3.9.0 : son meta.ts, ses exemples et ses types.Modifier cette documentation sur GitHub

Sur cette page