Gathering detailed insights and metrics for react-native-switch-selector
Gathering detailed insights and metrics for react-native-switch-selector
Gathering detailed insights and metrics for react-native-switch-selector
Gathering detailed insights and metrics for react-native-switch-selector
npm install react-native-switch-selector
Typescript
Module System
Node Version
NPM Version
84.5
Supply Chain
99.5
Quality
78.2
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
45 Stars
194 Commits
27 Forks
1 Watchers
1 Branches
1 Contributors
Updated on Jun 28, 2025
Latest Version
2.3.0
Package Id
react-native-switch-selector@2.3.0
Unpacked Size
228.67 kB
Size
194.35 kB
File Count
13
NPM Version
8.19.2
Node Version
16.18.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Switch Selector to React Native.
1yarn add react-native-switch-selector
or
1npm i react-native-switch-selector --save
1import SwitchSelector from "react-native-switch-selector";
1const options = [ 2 { label: "01:00", value: "1" }, 3 { label: "01:30", value: "1.5" }, 4 { label: "02:00", value: "2" } 5];
you can also add testID
and accessibilityLabel
to each option:
1const options = [ 2 { label: "01:00", value: "1", testID: "switch-one", accessibilityLabel: "switch-one" }, 3 { label: "01:30", value: "1.5", testID: "switch-one-thirty", accessibilityLabel: "switch-one-thirty" }, 4 { label: "02:00", value: "2", testID: "switch-two", accessibilityLabel: "switch-two" } 5];
1<SwitchSelector 2 options={options} 3 initial={0} 4 onPress={value => console.log(`Call onPress with value: ${value}`)} 5/>
1<SwitchSelector 2 initial={0} 3 onPress={value => this.setState({ gender: value })} 4 textColor={colors.purple} //'#7a44cf' 5 selectedColor={colors.white} 6 buttonColor={colors.purple} 7 borderColor={colors.purple} 8 hasPadding 9 options={[ 10 { label: "Feminino", value: "f", imageIcon: images.feminino }, //images.feminino = require('./path_to/assets/img/feminino.png') 11 { label: "Masculino", value: "m", imageIcon: images.masculino } //images.masculino = require('./path_to/assets/img/masculino.png') 12 ]} 13 testID="gender-switch-selector" 14 accessibilityLabel="gender-switch-selector" 15/>
Prop | Type | Default | Required | Note |
---|---|---|---|---|
options | array | null | true | Items array to render. Each item has a label and a value and optionals icons |
options[].label | string | null | true | Label from each item |
options[].value | string | null | true | Value from each item |
options[].customIcon | Jsx element ou Function | null | false | Optional custom icon from each item |
options[].imageIcon | string | null | false | Source from a image icon form each item. Has the same color then label in render |
options[].activeColor | string | null | false | Color from each item when is selected |
options[].testID | string | undefined | false | Test ID for each item used for testing (e.g. with Appium) |
options[].accessibilityLabel | string | undefined | false | Accessibility Label for each item used for testing (e.g. with Appium) |
options[].disabled | boolean | false | false | Disables an item |
initial | number | -1 | false | Item selected in initial render |
value | number | undefined | false | The switch value (will call onPress) |
onPress | function | console.log | true | Callback function called after change value. |
disableValueChangeOnPress | bool | false | false | Disables the onPress call when the value is manually changed |
fontSize | number | null | false | Font size from labels. If null default fontSize of the app is used. |
selectedColor | string | '#fff' | false | Color text of the item selected |
buttonMargin | number | 0 | false | Margin of the item selected to component |
buttonColor | string | '#BCD635' | false | Color bg of the item selected |
textColor | string | '#000' | false | Color text of the not selecteds items |
backgroundColor | string | '#ffffff' | false | Color bg of the component |
borderColor | string | '#c9c9c9' | false | Border Color of the component |
borderRadius | number | 50 | false | Border Radius of the component |
hasPadding | bool | false | false | Indicate if item has padding |
animationDuration | number | 250 | false | Duration of the animation |
valuePadding | number | 1 | false | Size of padding |
height | number | 40 | false | Height of component |
bold | bool | false | false | Indicate if text has fontWeight bold |
textStyle | object | {} | false | Text style |
selectedTextStyle | object | {} | false | Selected text style |
textContainerStyle | object | {} | false | Style for text (and icon) container (TouchableOpacity) |
selectedTextContainerStyle | object | {} | false | Style for selected text (and icon) container (TouchableOpacity) |
imageStyle | object | {} | false | Image style |
style | object | {} | false | Container style |
returnObject | bool | false | false | Indicate if onPress function return an option instead of option.value |
disabled | bool | false | false | Disables the switch |
borderWidth | number | 1 | false | Define border width |
testID | string | null | false | Test ID used for testing (e.g. with Appium) |
accessibilityLabel | string | null | false | Accessibility Label used for testing (e.g. with Appium) |
touchableProps | object | {} | false | Custom props for TouchableOpacity element |
Contributions are always welcome! Create a new Pull Request
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
Found 5/22 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
10 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More