Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-segmented-control-tab

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-segmented-control-tab

A react native component with the same concept of react native's SegmantedControlIOS, Primarily built to support both IOS and Android.

  • 3.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18K
increased by8.21%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-segmented-control-tab(for Android/iOS) 🚀

npm

A react native component with the same concept of react native's SegmantedControlIOS, Primarily built to support both IOS and Android. 💡

ScreenShots

screen1

screen2

[Screen3

Install

npm install react-native-segmented-control-tab --save

Usage

IMPORTANT

This has been made into a controlled component from 3.0. Those who are familiar with 2.0, read below for the updated usage.

import SegmentedControlTab from 'react-native-segmented-control-tab'

class ConsumerComponent extends Component {

    constructor(){
      super()
      this.state = {
        selectedIndex: 0,
      };
    }

    handleIndexChange = (index) => {
      this.setState({
        ...this.state,
        selectedIndex: index,
      });
    }

    render() {
        return (
            <View>
                <SegmentedControlTab
                    values={['First', 'Second', 'Third']}
                    selectedIndex={this.state.selectedIndex}
                    onTabPress={this.handleIndexChange}
                    />
            </View>
        );
    }
}

Props

NameDescriptionDefaultType
valuestitles of tabs['One', 'Two', 'Three']array
selectedIndexindex of tab item to be selected initially[0]number
selectedIndicesArray of indices of tab items to be selected initially - when multiple prop is true else it will take selectedIndex[0]arrayOf(PropTypes.number)
multipleBoolean which enables the multiple selection optionfalsebool
borderRadiusborderRadius of whole tab5number
tabsContainerStyleexternal styles can be passed to override the default styles of the segmentedControl wrapperbase styles added in SegmentedControlTab.jsobject(styles)
tabStyleexternal styles can be passed to override the default styles of the tabsbase styles added in SegmentedControlTab.jsobject(styles)
tabTextStyleexternal styles can be passed to override the default styles of the tab titlebase styles added in SegmentedControlTab.jsobject(styles)
activeTabStyleexternal styles can be passed to override the default styles of the active tabbase styles added in SegmentedControlTab.jsobject(styles)
activeTabTextStyleexternal styles can be passed to override the default styles of the active tab textbase styles added in SegmentedControlTab.jsobject(styles)
onTabPresscall-back function when a tab is selected() => {}func

Custom styling

    <SegmentedControlTab tabsContainerStyle={styles.tabsContainerStyle}
        tabStyle={styles.tabStyle}
        tabTextStyle={styles.tabTextStyle}
        activeTabStyle={styles.activeTabStyle}
        activeTabTextStyle={styles.activeTabTextStyle}
        selectedIndex={1}
        values={['First', 'Second', 'Third']}
        onPress= {index => this.setState({selected:index})}
        />

    const styles = StyleSheet.create({
        tabsContainerStyle: {
          //custom styles
        },
        tabStyle: {
          //custom styles
          },
        tabTextStyle: {
          //custom styles
        },
        activeTabStyle: {
          //custom styles
          },
        activeTabTextStyle: {
          //custom styles
        },

    })

P.S.

🙏 credits to all the other devs who had built the similar concept, had referred some of the their components on the github, to get a fair idea 💡 to build this.😊 If you have any idea in implementing this further, let me know or you can update it and raise a PR.😊🚀

License

MIT

Keywords

FAQs

Package last updated on 03 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc