Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Unable to move the thumb position from outside the slider when having a custom thumbImage

Đang mở
#712 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
react-native, typescript
Lĩnh vực
mobile

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện ví dụ Slider được kiểm soát với thumbImage tùy chỉnh và so sánh với hành vi thumb mặc định. Theo dõi cách các thay đổi giá trị từ bên ngoài được áp dụng khi thumbImage được thiết lập; hoàn thành có nghĩa là khi nhấn nút, thumb tùy chỉnh di chuyển đến vị trí 0 giống như khi không có hình ảnh tùy chỉnh.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug report

Environment

  • react-native info output:
// react-native info
Expo v53
  • are you using the new architecture?
    yes

  • which version of react & react-native are you using?
    React 19 and React Native v0.79.2

Description

When having a custom thumbImage, the position of the thumb is not able to be updated from outside the Slider. For example, if you have a useEffect that change the value of the slider, the thumb position is being moved when thumbImage is by default. However, with a custom thumbImage, it's not the case.

Reproducible Demo

If you have something like this, clicking the button should move well the thumb position to position 0:

const [value, setValue] = useState<number>(20)
return (
    <>
          <Button
            title={'Change value'}
            onPress={(): void => setValue(0)}
          />
          <View style={tw`justify-center`}>
            <Slider
              minimumValue={0}
              maximumValue={100}
              step={5}
              value={value}
              onValueChange={handleChange}
              minimumTrackTintColor="#62A6E433"
              maximumTrackTintColor="#62A6E433"
              thumbTintColor={'#62A6E4'}
            />
    </>
)

However, if you add a custom thumbImage, when clicking the button, the thumb position does not go to position 0:

const [value, setValue] = useState<number>(20)
return (
    <>
          <Button
            title={'Change value'}
            onPress={(): void => setValue(0)}
          />
          <View style={tw`justify-center`}>
            <Slider
              minimumValue={0}
              maximumValue={100}
              step={5}
              value={value}
              onValueChange={handleChange}
              minimumTrackTintColor="#62A6E433"
              maximumTrackTintColor="#62A6E433"
              StepMarker={(): ReactElement => <View style={tw`h-5`}></View>}
              thumbTintColor={'#62A6E4'}
              thumbImage={require('@src/assets/images/SliderThumb.png') as ImageURISource}
            />
    </>
)
Ngôn ngữ chính
TypeScript
Star
1.4k
Fork
295
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của callstack/react-native-slider

Tất cả issue của callstack/react-native-slider

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.