Krizaka UI
Krizaka UI
Composants

Pull to refresh

The platform's pull to refresh in the theme's accent, for any ScrollView or FlatList — or BrandedRefresh, where the product's own mark is drawn as you pull and turns while it refreshes.

MobileBêtaRetours

Mobile uniquement — React Native, depuis @krizaka/ui/native. 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: lists and feeds (and BrandedRefresh, krizaka-ui#137).

Quand l’utiliser

  • A ScrollView or a FlatList the app draws itself: a feed, a profile.

Quand ne pas l’utiliser

  • In a List: its onRefresh draws it already.À la place : List

Installation

Installer

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

Importer

import { PullToRefresh, BrandedRefresh } from "@krizaka/ui/native";

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 feed

The spinner at the top of a ScrollView, in the accent.

Pull to refresh — A feed, tel que React Native le rendPull to refresh — A feed, tel que React Native le rend

The product's mark

BrandedRefresh: Orochia's mark grows into place as you pull and turns while it refreshes; announced when it starts.

Pull to refresh — The product's mark, tel que React Native le rendPull to refresh — The product's mark, tel que React Native le rend

Props

PullToRefresh

The platform's pull to refresh in the theme's accent: the refreshControl of a ScrollView or a FlatList. List draws it already with onRefresh.

PropTypeDéfautDescription
labelstring—The words of the pull (“Pull to refresh”) — passed translated; shown on iOS under the spinner.

BrandedRefresh

The product's mark as the pull-to-refresh: it grows and turns into place as the person pulls (iOS, where the content overscrolls) and keeps its own motion while it refreshes (iOS and Android). The platform's control still does the gesture, so the system announces it too; ours announces label when the refresh starts. Under reduced motion the mark is still and appears without the growing.

PropTypeDéfautDescription
childrenrequis(scroll: BrandedRefreshScrollProps) => ReactElement<unknown, string | JSXElementConstructor<any>>—The scrollable, given the props to spread: {(scroll) => <ScrollView {...scroll}>…</ScrollView>}.
labelrequisstring—The words announced when the refresh starts (“Refreshing your videos”) — passed translated.
onRefreshrequis() => void—Called when the person pulls past the threshold.
productrequisBrandId—The product whose mark is drawn as the person pulls and turns while it refreshes.
refreshingrequisboolean—Whether the data is refreshing: keep it true until the new data is there.
thresholdnumber72The pull (in points) at which the mark is complete. Default 72.

Accessibilité

  • The platform's control: announced by the system while it refreshes; BrandedRefresh keeps that control (transparent) and adds an announcement of its label when the refresh starts.
  • On Android the mark appears when the refresh starts (the platform does not report the pull); on iOS it is drawn as you pull.
  • Reduced motion: the mark is still and appears without growing.
  • Offer a refresh button too where pulling is hard (a short screen).

Bonnes pratiques

  • BrandedRefresh where the product's mark should wait with the person: spread the props it gives on the ScrollView ({(scroll) => <ScrollView {...scroll} />}).
  • Keep refreshing true until the new data is there.
  • Do not refresh on every focus: a pull is the person's choice.

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