1.0.2 • Published 4 years ago

mahdi-wheel v1.0.2

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
4 years ago

React native mahdi picker

A simple Wheel Picker

Example

You can clone the repo and run example from ./example folder

android Installation

npm install mahdi_wheel

npm.io

ios installation

npm install mahdi_wheel npm install @react-native-community/picker

npm.io

Usage

import {
  WheelPicker,
  TimePicker,
  DatePicker
} from "mahdi_wheel";
import React, { Component } from "react";
import { AppRegistry, StyleSheet, Text, View, Button } from "react-native";

const wheelPickerData = [
  "sunday",
  "monday",
  "tuesday",
  "wednesday",
  "thursday",
  "friday"
];

class MyPicker extends Component {
  state = {
    selectedItem: 0
  };

  onItemSelected = selectedItem => {
    this.setState({ selectedItem });
  };

  onPress = () => {
    this.setState({ selectedItem: 3 });
  };

  render() {
    return (
      <View style={styles.container}>
        <Button title={"Select third element"} onPress={this.onPress} />
        <Text>Selected position: {this.state.selectedItem}</Text>
        <WheelPicker
          selectedItem={this.state.selectedItem}
          data={wheelPickerData}
          onItemSelected={this.onItemSelected}
        />
      </View>
    );
  }
}

module.exports = MyPicker;

Props

PropDefaultTypeDescription
onItemSelected-funcReturns selected position
data-Array<string>Data array
isCyclicfalseboolMake Wheel Picker cyclic
selectedItemTextColorblackstringWheel Picker's selected Item text color
selectedItemTextSize16numberWheel Picker's selected Item text size
selectedItemTextFontFamily-font-familyWheel Picker's selected Item font
itemTextColorgreystringWheel Picker's Item Text Color
itemTextSize16numberWheel Picker's Item text size
itemTextFontFamily-font-familyWheel Picker's Item font
selectedItem0numberCurrent item position
initPosition0numberInitial item position
indicatorColorblackstringIndicator color
hideIndicator-booleanHide indicator
indicatorWidth1numberIndicator width
backgroundColortransparentstringWheel Picker background color
disabledundefindboolDisable picker selection
1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago