npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-fully-customizable-segmented-control

v1.0.1

Published

Fully customizable segmented control

Downloads

10

Readme

Alt Text

Installation

Add the dependency:

npm i react-native-fully-customizable-segmented-control

Peer Dependencies

"react": ">= 16.x.x",
"react-native": ">= 0.55.x",

Usage

Import

import {CustomSegmentedControl} from "react-native-fully-customizable-segmented-control";

Fundamental Usage

const [selectedIndex, setSelectedIndex] = useState(0);


<View style={{ padding: 15 }}>
  <CustomSegmentedControl
    segments={["Segment1", "Segment2", "Segment3"]}
    selected={0}
    height={55}
    borderWidth={1}
    borderColor={"#9d9d9d"}
    borderRadius={15}
    selectedSegmentColor={"#0082ff"}
    unselectedSegmentsColor={"#e7e5e5"}
    selectedTextColor={"#fff"}
    unselectedTextColor={"#000"}
    textFontSize={20}
    onChangeSegment={(index) => setSelectedIndex(index)}
  />
  <View style={{ marginTop: 15 }}>
    {selectedIndex == 0 ? (
      <View
        style={{
          width: "100%",
          backgroundColor: "red",
          height: 100,
          justifyContent: "center",
          alignItems: "center",
        }}
      >
        <Text>{selectedIndex}</Text>
      </View>
    ) : selectedIndex == 1 ? (
      <View
        style={{
          width: "100%",
          backgroundColor: "blue",
          height: 100,
          justifyContent: "center",
          alignItems: "center",
        }}
      >
        <Text>{selectedIndex}</Text>
      </View>
    ) : selectedIndex == 2 ? (
      <View
        style={{
          width: "100%",
          backgroundColor: "green",
          height: 100,
          justifyContent: "center",
          alignItems: "center",
        }}
      >
        <Text>{selectedIndex}</Text>
      </View>
    ) : null}
  </View>
</View>

Example Project 😍

You can checkout the example project 🥰

Simply run

  • npm i
  • react-native run-ios/android

should work of the example project.

Configuration - Props

| Property | Type | Default | Description | | -------------- | :-------: | :-------: | ---------------------------------------------------------------------- | | segments | array | ['first','second','third'] | set segmented control's text array | | selected | number | 0 | set segmented control's default selected value | | height | number | 50 | set segmented control's height | | textFontSize | number | 20 | set segmented control's text font size | | borderWidth | number | 1 | set segmented control's border with(if u dont wanna border u can pass 0 ) | | borderColor | string | "#9d9d9d" | set segmented control's border color | | borderRadius | number | 15 | set segmented control's radius | | selectedSegmentColor | string | "#0082ff" | set selected segment's background color | | unselectedSegmentsColor | string | "#e7e5e5" | set unselected segment's background color | | selectedTextColor | string | "#fff" | set selected segment's text color | | unselectedTextColor | string | "#000" | set unselected segment's text color | | onChangeSegment | function | null | returns when segment change index |

Future Plans

  • [x] ~~LICENSE~~
  • [ ] Animations

Change Log

Change log will be here !

Author

Talha Salt, [email protected]

License

This library is available under the MIT license. See the LICENSE file for more info.