New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.

2.0.1
Source
npm
Version published
Maintainers
1
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.png screen2.png

Install

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

Usage

class ConsumerComponent extends Component {

    render() {
        return (
            <View>
                <SegmentedControlTab
                    values={['First', 'Second', 'Third']}
                    onTabPress= {index => console.log(index))}
                    />
            </View>)
    }
}

Props

NameDescriptionDefaultType
valuestitles of tabs['One', 'Two', 'Three']array
selectedIndexindex of tab item to be selected initially0number
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 for each item() => {}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

react-native

FAQs

Package last updated on 12 Oct 2016

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