馃殌 React Native Segmented Control, Pure Javascript for iOS and Android

Overview

React Native Segmented Control 2

React Native Segmented Control 2

npm version npm Platform - Android and iOS License: MIT styled with prettier

React Native Segmented Control 2

Installation

Add the dependency:

npm i react-native-segmented-control-2

Peer Dependencies

Zero Dependency 馃コ

Usage

Import

import SegmentedControl from "react-native-segmented-control-2";

Fundamental Usage

 <SegmentedControl
    tabs={["Label 1", "Label 2", "Label 3"]}
    onChange={(index: number) => console.log("Index: ", index)}
/>

Customized Usage

<SegmentedControl
    style={{ marginTop: 32, backgroundColor: "#ffe0e0" }}
    activeTabColor="#ff2929"
    activeTextColor="#fff"
    tabs={["Label 1", "Label 2", "Label 3"]}
    onChange={(index: number) => console.log("Index: ", index)}
/>

Any Component Usage

You can use the segmented control with any component. All you need to do is that put any component into the tabs props. Please check out the example for its usage

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

Fundamentals

Property Type Default Description
tabs any[] undefined set the array for tabs
onChange function undefined set your own logic when the tab is pressed / changed

Customization (Optionals)

Property Type Default Description
style ViewStyle default set or override the style object for the main container
width number ScreenWidth * 0.9 change the width of the main segmented control
initialIndex number 0 set the initial index
activeTextColor string #000 change the active tab's text color
activeTabColor string #FFF change the active tab's color
tabStyle ViewStyle default set or override the style object for the tab
textStyle TextStyle default set or override the style object for tab's text

Future Plans

  • LICENSE
  • Write an article about the lib on Medium

Credits

Heavily inspired by these libraries:

I created this library because they're really not maintain actively and this is a pure javascript written library

Author

FreakyCoder, [email protected]

License

React Native Segmented Control 2 is available under the MIT license. See the LICENSE file for more info.

You might also like...
A demo for Android font typeface support in React Native!
A demo for Android font typeface support in React Native!

A Step-by-step Guide to a Consistent Multi-Platform Font Typeface Experience in React Native Goal Be able to use font typeface modifiers such as fontW

Library to read incoming SMS in Android for Expo (React Native)

react-native-expo-read-sms Maintainers maniac-tech Active maintainer Installation Install this in your managed Expo project by running this command: $

GeckoView implementation on android for React Native.

react-native-geckoview A fully functional implementation of GeckoView on android for react native. The component supports two-way messaging similar to

Simple library to decompress files .zip, .rar, .cbz, .cbr in React Native.
Simple library to decompress files .zip, .rar, .cbz, .cbr in React Native.

Uncompress React Native Simple library to decompress files .zip, .rar, .cbz and .cbr in React Native. Installation yarn add uncompress-react-native o

A react native interface for integrating payments using PayPal

react-native-paypal Getting started Installation npm install react-native-paypal Android Specific Add this to your build.gradle maven { url "https:

Make SIP calls from react-native using Linphone SDK

react-native-sip Make SIP calls from react-native using Linphone SDK Installation npm install react-native-sip Usage import { multiply } from "react-n

A framework for building native applications using React

React Native Learn once, write anywhere: Build mobile apps with React. Getting Started 路 Learn the Basics 路 Showcase 路 Contribute 路 Community 路 Suppor

Wrapper for Kustomer SDK v2.0 for react native
Wrapper for Kustomer SDK v2.0 for react native

This is a wrapper for Kustomer v2 Sdk for react native. This implements the kust

 A music picker library for React Native. Provides access to the system's UI for selecting songs from the phone's music library.
A music picker library for React Native. Provides access to the system's UI for selecting songs from the phone's music library.

Expo Music Picker A music picker library for React Native. Provides access to the system's UI for selecting songs from the phone's music library. Supp

Comments
  • size too big for android

    size too big for android

    A虊nh chu蹋p Ma虁n hi虁nh 2022-09-01 lu虂c 00 03 01

    Hi can u help my problem, here is my code:

     <SegmentedControl
                style={{
                    backgroundColor:'whitesmoke'
                }}
                tabs={[language.AllCallHistory, language.MissingCallOnly]}
                onChange={(index) => {
                    console.log('on change', index)
                }}
                activeTextColor={'white'}
                activeTabColor={'orange'}
            />
    
    opened by fukemy 1
Releases(0.1.0)
Owner
FreakyCoder
Mobile Dev, React Native Dev, Game Dev, Designer, Blogger, Animal Lover
FreakyCoder
NativeScript empowers you to access native platform APIs from JavaScript directly. Angular, Capacitor, Ionic, React, Svelte, Vue and you name it compatible.

NativeScript empowers you to access native APIs from JavaScript directly. The framework currently provides iOS and Android runtimes for rich mobile de

NativeScript 22k Dec 31, 2022
React-native-user-interface - Change React Native userinterface at runtime

react-native-user-interface change RN userinterface at runtime. Installation npm

Ahmed Eid 0 Jan 11, 2022
A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.

Ionic Ionic is an open source app development toolkit for building modern, fast, top-quality cross-platform native and Progressive Web Apps from a sin

Ionic 48.4k Jan 3, 2023
Matomo wrapper for React-Native. Supports Android and iOS. Fixed issues for native platforms build that are present in the official package.

@mccsoft/react-native-matomo Matomo wrapper for React-Native. Supports Android and iOS. Fixed issues for native platforms build that are present in th

MCC Soft 4 Dec 29, 2022
馃柤 Supports loading profile images with segmented style, shapes, borders, indicators, and initials for Android.

AvatarView AvatarView supports loading profile images with segmented style, borders, indicators, and initials for Android. Download Gradle Add the bel

Stream 395 Dec 22, 2022
Initiate immediate phone call for React Native on iOS and Android.

react-native-immediate-call-library Initiate immediate phone call for React Native on iOS and Android. Getting started Using npm: npm install react-na

null 7 Sep 7, 2022
A 2020s compatible React Native keyboard avoiding view for Android and iOS that just works.

react-native-keyboard-shift Example Snack coming soon Until then: Clone this repo: git clone https://github.com/FullStackCraft/react-native-keyboard-s

Full Stack Craft 66 Aug 16, 2022
An Animated Scrolling View for React Native applications, supported on both iOS and Android

react-native-focused-scroll An Animated Scrolling View for React Native applications, supported on both iOS and Android Preview react-native-focus-scr

Fatemeh Marzoughi (Saba) 3 Aug 12, 2022
馃寗 Photo editor using native modules for iOS and Android. Inherit from 2 available libraries, Brightroom (iOS) and PhotoEditor (Android)

React Native Photo Editor (RNPE) ?? Image editor using native modules for iOS and Android. Inherit from 2 available libraries, Brightroom (iOS) and Ph

Baron Ha. 242 Dec 28, 2022
React Native Stone SDK Implementation (Support for both Mobile and POS versions)

react-native-stone-pos Stone Android POS Native Module Installation Stone has a private packageCloud repository, so we need to have your token before

8Sistemas 9 Dec 10, 2022