{"id":15034924,"url":"https://github.com/callstack/react-native-slider","last_synced_at":"2025-05-13T00:19:46.421Z","repository":{"id":37847859,"uuid":"169433395","full_name":"callstack/react-native-slider","owner":"callstack","description":"React Native component exposing Slider from iOS and SeekBar from Android","archived":false,"fork":false,"pushed_at":"2025-04-29T08:51:27.000Z","size":31698,"stargazers_count":1277,"open_issues_count":48,"forks_count":282,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-05-11T03:36:30.224Z","etag":null,"topics":["react-native","seekbar","slider"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/callstack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-02-06T16:03:45.000Z","updated_at":"2025-05-08T10:37:23.000Z","dependencies_parsed_at":"2024-04-09T19:33:14.435Z","dependency_job_id":"07b8eace-19be-4265-803e-8dafadc0d7d7","html_url":"https://github.com/callstack/react-native-slider","commit_stats":{"total_commits":456,"total_committers":133,"mean_commits":"3.4285714285714284","dds":0.8070175438596492,"last_synced_commit":"6008042777b155557674fff71906c0b8656bcc3f"},"previous_names":["react-native-community/react-native-slider"],"tags_count":62,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/callstack%2Freact-native-slider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/callstack%2Freact-native-slider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/callstack%2Freact-native-slider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/callstack%2Freact-native-slider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/callstack","download_url":"https://codeload.github.com/callstack/react-native-slider/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253740969,"owners_count":21956728,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["react-native","seekbar","slider"],"created_at":"2024-09-24T20:26:49.583Z","updated_at":"2025-05-13T00:19:46.397Z","avatar_url":"https://github.com/callstack.png","language":"TypeScript","readme":"\u003cp align=\"center\"\u003e\n  \u003ch1 align=\"center\"\u003e \u003ccode\u003e@react-native-community/slider\u003c/code\u003e \u003c/h1\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://www.npmjs.com/package/@react-native-community/slider\"\u003e\n        \u003cimg src=\"https://img.shields.io/npm/v/@react-native-community/slider.svg\" alt=\"Latest version released on npmjs\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/callstack/react-native-slider/actions/workflows/ReactNativeSlider-CI.yml\"\u003e\n        \u003cimg src=\"https://github.com/callstack/react-native-slider/actions/workflows/ReactNativeSlider-CI.yml/badge.svg?branch=main\" alt=\"Build on GitHub Actions\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/callstack/react-native-slider\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/platforms-android%20|%20ios%20|%20windows%20|%20web-lightgrey.svg\" alt=\"Supported platforms\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/callstack/react-native-slider/blob/main/LICENSE.md\"\u003e\n        \u003cimg src=\"https://img.shields.io/npm/l/@react-native-community/slider.svg\" alt=\"License\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  React Native component used to select a single value from a range of values.\n  \u003cbr\u003eCurrently supported on following platforms:\n\u003c/p\u003e\n\n|iOS|Android|Windows|Web|\n|:-:|:-:|:-:|:-:|\n|![iOS Screenshot](.github/Examples/Slider-iOS-Example.gif)|![Android Screenshot](.github/Examples/Slider-Android-Example.gif)|![Windows Screenshot](.github/Examples/Slider-Windows-Example.gif)|![Web Screenshot](.github/Examples/Slider-Web-Example.gif)|\n\n## Installation \u0026 Usage\n\nTo install this module `cd` to your project directory and enter the following command:\n```\nyarn add @react-native-community/slider\n```\nor\n```\nnpm install @react-native-community/slider --save\n```\nIf using iOS please remember to install cocoapods by running: `npx pod-install`\n\nThe following code presents the basic usage scenario of this library:\n```javascript\nimport Slider from '@react-native-community/slider';\n\n\u003cSlider\n  style={{width: 200, height: 40}}\n  minimumValue={0}\n  maximumValue={1}\n  minimumTrackTintColor=\"#FFFFFF\"\n  maximumTrackTintColor=\"#000000\"\n/\u003e\n```\n\nCheck out the [example project](example) for more examples.\n\n### Reach out on Discord\n\nIf you have any questions, issues or any other topic that you need an advise in, reach out to us on our channel on Discord under this 👉 [link](https://discord.com/channels/426714625279524876/1339942689524678737).\n\u003cbr/\u003eSee you there!\n\n## React Native Compatibility\nTo use this library you need to ensure you are using the correct version of React Native.\n\n| `@react-native-community/slider` version | Required React Native Version |\n| ---------------------------------------- | ---------------------------- |\n| `4.5.1`                                  | `\u003e=0.69`                     |\n| `4.3.0`                                  | `\u003e=0.64`                     |\n| `4.x.x`                                  | `\u003e=0.60`; `\u003e=0.62` (on Windows); |\n| `3.1.x`                                  | `\u003e=0.60`                     |\n| `2.x.x`                                  | `\u003e= 0.60`                    |\n| [`1.x.x`](https://github.com/react-native-community/react-native-slider/tree/937f0942f1fffc6ed88b5cf7c88d73b7878f00f0) | `\u003c= 0.59` |\n\n\n## Properties\n\n| Property | Description | Type | Platform |\n| -------- | ----------- | ---- | -------- |\n| `style` | Used to style and layout the `Slider`. See `StyleSheet.js` and `ViewStylePropTypes.js` for more info. | View.style | |\n| `disabled`| If true the user won't be able to move the slider.\u003cbr/\u003eDefault value is false. | bool | |\n| `maximumValue` | Initial maximum value of the slider.\u003cbr/\u003eDefault value is 1. | number | |\n| `minimumTrackTintColor` | The color used for the track to the left of the button.\u003cbr/\u003eOverrides the default blue gradient image on iOS. | [color](https://reactnative.dev/docs/colors) | |\n| `minimumValue` | Initial minimum value of the slider.\u003cbr/\u003eDefault value is 0. | number | |\n| `lowerLimit` | Slide lower limit. The user won't be able to slide below this limit. | number | Android, iOS, Web |\n| `upperLimit` | Slide upper limit. The user won't be able to slide above this limit. | number | Android, iOS, Web |\n| `onSlidingStart` | Callback that is called when the user picks up the slider.\u003cbr/\u003eThe initial value is passed as an argument to the callback handler. | function | |\n| `onSlidingComplete` | Callback that is called when the user releases the slider, regardless if the value has changed.\u003cbr/\u003eThe current value is passed as an argument to the callback handler. | function | |\n| `onValueChange` | Callback continuously called while the user is dragging the slider. | function | |\n| `step` | Step value of the slider. The value should be between 0 and (maximumValue - minimumValue). Default value is 0.\u003cbr/\u003eOn Windows OS the default value is 1% of slider's range (from `minimumValue` to `maximumValue`). | number | |\n| `maximumTrackTintColor` | The color used for the track to the right of the button.\u003cbr/\u003eOverrides the default gray gradient image on iOS. | [color](https://reactnative.dev/docs/colors) | |\n| `testID` | Used to locate this view in UI automation tests. | string | |\n| `value` | Write-only property representing the value of the slider. Can be used to programmatically control the position of the thumb. Entered once at the beginning still acts as an initial value. Changing the value programmatically does not trigger any event.\u003cbr/\u003eThe value should be between minimumValue and maximumValue, which default to 0 and 1 respectively. Default value is 0.\u003cbr/\u003e_This is not a controlled component_, you don't need to update the value during dragging. | number | |\n| `tapToSeek` | Permits tapping on the slider track to set the thumb position.\u003cbr/\u003eDefaults to false on iOS. No effect on Android or Windows. | bool | iOS |\n| `inverted` | Reverses the direction of the slider.\u003cbr/\u003eDefault value is false. | bool | |\n| `vertical` | Changes the orientation of the slider to vertical, if set to `true`.\u003cbr/\u003eDefault value is false. | bool | Windows |\n| `thumbTintColor` | Color of the foreground switch grip.\u003cbr/\u003e**NOTE:** This prop will override the `thumbImage` prop set, meaning that if both `thumbImage` and `thumbTintColor` will be set, image used for the thumb may not be displayed correctly! | [color](https://reactnative.dev/docs/colors) | Android |\n| `maximumTrackImage` | Assigns a maximum track image. Only static images are supported. The leftmost pixel of the image will be stretched to fill the track. | Image\u003cbr/\u003e.propTypes\u003cbr/\u003e.source | iOS |\n| `minimumTrackImage` | Assigns a minimum track image. Only static images are supported. The rightmost pixel of the image will be stretched to fill the track. | Image\u003cbr/\u003e.propTypes\u003cbr/\u003e.source | iOS |\n| `thumbImage` | Sets an image for the thumb. Only static images are supported. Needs to be a URI of a local or network image; base64-encoded SVG is not supported. | Image\u003cbr/\u003e.propTypes\u003cbr/\u003e.source | |\n| `trackImage` | Assigns a single image for the track. Only static images are supported. The center pixel of the image will be stretched to fill the track. | Image\u003cbr/\u003e.propTypes\u003cbr/\u003e.source | iOS |\n| [`StepMarker`](#stepmarker) | Component to be rendered for each step on the track,\u003cbr/\u003ewith the possibility to change the styling, when thumb is at that given step | `FC\u003cMarkerProps\u003e` | iOS, Android, Windows |\n| [`renderStepNumber`](#renderstepnumber) | Turns on the displaying of numbers of steps.\u003cbr/\u003eNumbers of steps are displayed under the track | bool | iOS, Android, Windows |\n| `ref` | Reference object. | MutableRefObject | web |\n| `View` | [Inherited `View` props...](https://github.com/facebook/react-native-website/blob/master/docs/view.md#props) | | |\n\n## Custom step marker and step numbers\n\nIt is possible to render default step numbers under your slider and to render custom step component and step marker.\n\u003cbr/\u003eThis can be achieved by using:\n\n### `renderStepNumber`\n\nTurns on the displaying of numbers of steps.\u003cbr/\u003eNumbers of steps are displayed under the track.\n\u003cbr/\u003eTwo font sizes are available and they will be selected automatically depending on the overall number of steps.\n\n### `StepMarker`\n\nYour custom component rendered for every step on the Slider, both the thumb and the rest of steps along the Slider's whole length.\n\u003cbr/\u003eThis `StepMarker` prop accepts your custom component and provides it with the following parameters:\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd\u003e\n\n```typescript\n  stepMarked: boolean;\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nIndicates whether that custom step is the one that the thum is currently on.\n\u003cbr/\u003eIf user drags or clicks on that step, thumb will be moved there and the `stepMarked` parameter will be set to `true`.\n\u003cbr/\u003eUse it, to differentiate between rendering your custom thumb component, or your custom step marker.\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\n\n```typescript\n  currentValue: number;\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\nContains the `number` type saying at which value of the Slider the thumb currently is.\n\u003cbr/\u003eUse it, for example, to render the Slider value on every step marker, or to render different step marker's variant depending on the Thumb position.\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\n\n```typescript\n  index: number;\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nContains the index at which this exact instantiation of your custom step marker was rendered at.\n\u003cbr/\u003eUse it if you would like to render step number within the step marker, or, for example, if you want to render many variants of step marker depending on their positions along the Slider's width.\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\n\n```typescript\n  min: number;\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nMinimum value of the Slider. It is equal to `minimumValue` and has the same default if not set.\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\n\n```typescript\n  max: number;\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nMaximum value of the Slider. It is equal to `maximumValue` and has the same default if not set.\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n## Roadmap and Progress\n\nThere's a Project board available [here](https://github.com/callstack/react-native-slider/projects/1) which contains all reported issues organized into columns regarding their status.\n\nIf you are interested in knowing whether the issue you reported is handled or just to check the status of a feature you would like to have in Slider, please check the board.\n\n## Contributing\n\nThe main package implementation is done in the `package/` directory.\nSo when implementing changes there, make sure your code passes ESLint and the tests. Run the following to verify:\n```sh\ncd package/\nnpm run lint\nnpm run test\n```\n\n* Remember to cover your changes with tests if possible.\n\nWhen [creating an issue](https://github.com/callstack/react-native-slider/issues/new/choose) please remember to specify the platform which the issue occurs on.\n\n## Running the example app\nWhile developing, you can run the example app to test your changes.\n\n### Setup\n\n- Clone the repository\n- Run `npm install` in the root directory to install dependencies.\n- Run `npm run example-\u003cplatform\u003e`, where platform can be: `ios`, `android`, `windows`\n\nYou can also do this manually by:\n- Installing node modules for example app\n- Installing pods for iOS app\n- Running example app like always: `npx react-native run-\u003cplatform\u003e`\n\n### New architecture setup (Fabric)\n\nIn order to use the new architecture some extra steps are needed.\n#### iOS\n- Install pods with new arch flag inside `example/ios` folder: `RCT_NEW_ARCH_ENABLED=1 pod install`\n- Run `npm run example-ios`\n\n#### Android\n- Set `newArchEnabled` to true inside `example/android/gradle.properties`\n- Run `npm run example-android`\n\n\u003cdetails\u003e\n\u003csummary\u003e\nIf you are using React Native version lower than 0.70, you need to setup manual linking for Android to work.\n\u003c/summary\u003e\n\nInside `example/android/app/src/main/jni/Android.mk` add these lines:\n\n```diff\n+ include $(NODE_MODULES_DIR)/@react-native-community/slider/android/build/generated/source/codegen/jni/Android.mk\ninclude $(CLEAR_VARS)\n```\n\n```diff\n    libreact_codegen_rncore \\\n+   libreact_codegen_ReactSlider \\\n    libreact_debug \\\n```\n\nInside `example/android/app/src/main/jni/MainComponentsRegistry.cpp` update these lines:\n\n```diff\n#include \u003creact/renderer/components/rncore/ComponentDescriptors.h\u003e\n+ #include \u003creact/renderer/components/ReactSlider/ComponentDescriptors.h\u003e\n\n...\n\nMainComponentsRegistry::sharedProviderRegistry() {\n  auto providerRegistry = CoreComponentsRegistry::sharedProviderRegistry();\n\n  // Custom Fabric Components go here. You can register custom\n  // components coming from your App or from 3rd party libraries here.\n  //\n  // providerRegistry-\u003eadd(concreteComponentDescriptorProvider\u003c\n  //        AocViewerComponentDescriptor\u003e());\n+ providerRegistry-\u003eadd(concreteComponentDescriptorProvider\u003cRNCSliderComponentDescriptor\u003e());\n\n  return providerRegistry;\n}\n```\n\n\u003c/details\u003e\n\n## Maintainers\n\n- [Bartosz Klonowski](https://github.com/BartoszKlonowski) - [Callstack](https://callstack.com/)\n- [Maciej Łodygowski](https://github.com/draggie) - [Callstack](https://callstack.com/)\n\n## Contributors\n\nThis module was extracted from `react-native` core. Please, refer to [contributors graph](https://github.com/react-native-community/react-native-slider/graphs/contributors) for the complete list of contributors.\n\n---\n\n## Made with ❤️ at Callstack\n\n`@callstack/react-native-slider` is an open source project and will always remain free to use. If you think it's cool, please star it 🌟. [Callstack](https://callstack.com/) is a group of React and React Native geeks, contact us at [hello@callstack.com](mailto:hello@callstack.com) if you need any help with these or just want to say hi!\n\nLike the project? ⚛️ [Join the team](https://callstack.com/careers) who does amazing stuff for clients and drives React Native Open Source! 🔥\n","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcallstack%2Freact-native-slider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcallstack%2Freact-native-slider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcallstack%2Freact-native-slider/lists"}