iOS: negative min value and 0 as maximum value turns maximum to 1

未关闭
#780 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
65/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
ios, react-native
领域
mobile

调研方向

首先在 iOS 上复现报告中的 slider configuration,并与 Android 进行比较。跟踪 iOS Slider 的实现,了解 maximumValue 为 0 时如何处理 minimumValue 和 maximumValue,然后为负最小值、零最大值的情况添加或更新测试覆盖。完成标准是 Slider 在 iOS 上能够达到 0,同时不改变提供的最大值。

由索引模型根据 Issue 内容生成。

描述

bug report

Environment

  • react-native info output:
System:
  OS: macOS 26.3
  CPU: (12) arm64 Apple M2 Pro
  Memory: 109.70 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.19.5 // also tried node 24
    path: /Users/.../.nvm/versions/node/v20.19.5/bin/node
  npm:
    version: 10.9.4
    path: /Users/.../node_modules/.bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 25.2
      - iOS 26.2
      - macOS 26.2
      - tvOS 26.2
      - visionOS 26.2
      - watchOS 26.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2025.1 AI-251.26094.121.2513.14007798
  Xcode:
    version: 26.3/17C529
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.17
    path: /Users/.../Library/Java/JavaVirtualMachines/corretto-17.0.17/Contents/Home/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.1.3
    wanted: 15.1.3
  react:
    installed: 19.1.0
    wanted: 19.1.0
  react-native:
    installed: 0.81.5
    wanted: 0.81.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Description

When creating a slider with minimumValue = -10 and maximumValue = 0, the application in android works as expected, but on iOS the maximumValue gets overwritten to 1.

Reproducible Demo

<Slider
      value={-5}
      minimumValue={-10}
      maximumValue={0} 
      step={0.5}
      onValueChange={(value) => {console.log('CURENTLY AT: ', value)}}
      onSlidingComplete=={(value) => {console.log('COMPLETE AT: ', value)}}
      tapToSeek={false}
/>

Using this slider the logs will show CURRENTLY AT 1 when sliding fully to the right on iOS and 0 on Android

My current workaround

I set maximum to 0.1 and for my business logic in onSlidingComplete I do Math.min(value, 0)

主要语言
TypeScript
星标
1.4k
派生
295
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

callstack/react-native-slider 的其他 Issue

查看 callstack/react-native-slider 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。