`@effect/ui-native` (Effect-TS/ui): `scroll` `ViewKind` forwards string `decelerationRate` (`"fast"` / `"normal"`) unconverted to Fabric `RCTScrollView`

Aperta
#11,090 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@effect-bot ci sta già lavorando.

Dal 29/11/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

partially generated with help of my ai friend - neon 4.4

Hi effect team,
I was trying out this package and wanted to report some bugs encountered while porting a library to effect native

What version of Effect is running?
  • effect: 4.1.7
  • @effect/ui & @effect/ui-native: Effect-TS/ui main at 77391ee50ae3d3175d670facbf675e9a819ba6a6
  • react-native: 0.88.1
What steps can reproduce the bug?
  1. Clone the minimal reproduction repository:
    git clone https://github.com/cliffordfajardo/effectui-native-error-reproductions.git
    cd effectui-native-error-reproductions
    pnpm install
    pnpm vitest run 04-scroll-deceleration-rate-string-not-converted
    
  2. Create a scroll element and set React Native's standard string preset decelerationRate: "fast" (or "normal"), e.g. for a snap-to-interval picker or carousel:
const scroll = host.createElement("scroll")
host.setProp(scroll, "decelerationRate", "fast")
host.insertBefore(root, scroll, undefined)
host.commit?.()
  1. Inspect the props passed to Fabric RCTScrollView via ui.createNode / ui.cloneNodeWithNewProps (see 04-scroll-deceleration-rate-string-not-converted/repro.test.ts).
What is the expected behavior?

Just like React Native's processDecelerationRate, setting decelerationRate to "fast" or "normal" on a scroll element should convert the string preset to the platform float expected by Fabric RCTScrollView:

  • iOS: "fast" -> 0.99, "normal" -> 0.998
  • Android: "fast" -> 0.9, "normal" -> 0.985

(And numeric values should continue to pass through unchanged.)

What do you see instead?

In packages/ui-native/src/internal/kinds.ts:68-91, the scroll ViewKind defines setters for horizontal, contentContainerStyle, and scrollEnabled, but has no setter for decelerationRate. As a result, "fast" / "normal" is forwarded raw as a string into Fabric RCTScrollView's props instead of a float.

Additionally, ScrollElement (packages/ui-native/src/Native.ts:1560-1624) does not yet expose typed prop helpers (or a ScrollProps interface) for common Fabric scroll props such as snapToInterval, snapToOffsets, decelerationRate, showsVerticalScrollIndicator, showsHorizontalScrollIndicator, bounces, and pagingEnabled.

Additional information

Possible fix in packages/ui-native/src/internal/kinds.ts:

decelerationRate(n, value, host) {
  const rate =
    value === "fast"
      ? host.os === "ios" ? 0.99 : 0.9
      : value === "normal"
        ? host.os === "ios" ? 0.998 : 0.985
        : value
  host.set(n, "decelerationRate", rate)
}
Lingua principale
TypeScript
Stelle
16.7k
Fork
808
Merge medio
21h 22m
PR unite (30g)
486

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Effect-TS/effect

Tutte le issue di Effect-TS/effect

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.