0.0.12 • Published 5 years ago

react-native-multi-segmented-control v0.0.12

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

react-native-multi-segmented-control

npm version CircleCI js-standard-style Dependency Status devDependencies Status typings included npm

Multi segmented control for iOS & Android

Status

Installation

0. Setup Swift and Kotlin

  • Open your iOS project in Xcode and create empty Swift file and bridging header to enable Swift support
  • Modify android/build.gradle:

    buildscript {
      ext {
        ...
    +   kotlinVersion = "1.3.50"
      }
    ...
    
      dependencies {
    +   classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
        ...

1. Install latest version from npm

$ npm i react-native-multi-segmented-control -S

2. Install pods

$ cd ios && pod install && cd ..

3. Final step

Modify android/build.gradle again:

...

allprojects {
  repositories {
    ...
+   maven { url 'https://jitpack.io' }
  }
}

Demo

AndroidiOS

Example

import * as React from 'react'
import { MultiSegmentedControl } from 'react-native-multi-segmented-control'

export const Control = () => (
  <MultiSegmentedControl
    style={{ height: 55, width: '100%' }}
    values={['cat', 'dog', 'fox', 'pig', 'cow']}
    onChange={({ nativeEvent }) => console.warn(nativeEvent.changedIndex)}
    selectedIndices={[1, 2]}
  />
)

Reference

MultiSegmentedControl and SingleSegmentedControl components support all of View props and share some common props. MultiSegmentedControl additionally has maxSelected and selectedIndices props, and SingleSegmentedControl has additional selectedIndex prop.

0.0.12

5 years ago

0.0.10

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago