Skip to content

Latest commit

 

History

History
59 lines (45 loc) · 1.01 KB

README.md

File metadata and controls

59 lines (45 loc) · 1.01 KB

react-native-expo-wheel-picker

picker

Installation

npm install react-native-expo-wheel-picker

Usage

import React, { useCallback, useState } from 'react';

import { View, Text } from 'react-native';
import WheelPicker from 'react-native-expo-wheel-picker';

function createDemoSet(n: number) {
  const items = [];
  for (let i = 0; i < n; i++) {
    items.push({
      id: i,
      name: `Item ${i}`,
      value: i,
    });
  }
  return items;
}

const example = createDemoSet(50);

export default function App() {
  const [value, _] = useState(10);
  const handleChange = useCallback((index) => {
    console.log('change', index);
  }, []);

  return (
    <View>
      <Text>Demo</Text>
      <WheelPicker
        numberOfVisibleRows={7}
        value={value}
        onChange={handleChange}
        items={example}
      />
    </View>
  );
}

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT