Skip to content

veizz/react-native-picker-scrollview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-picker-scrollview

a pure js picker, each option item customizable

example

usage

npm install react-native-picker-scrollview --save
import React, {Component} from 'react';
import {View, Text} from 'react-native';
import ScrollPicker from 'react-native-picker-scrollview';

export default class SimpleExample extends Component {

    render() {
        return(
            <ScrollPicker
                ref={(sp) => {this.sp = sp}}

                dataSource={[
                    'a',
                    'b',
                    'c',
                    'd',
                ]}
                selectedIndex={0}
                itemHeight={50}
                wrapperHeight={250}
		        wrapperColor={'#ffffff'}
                highlightColor={'#d8d8d8'}
                renderItem={(data, index, isSelected) => {
                    return(
                        <View>
                            <Text>{data}</Text>
                        </View>
                    )
                }}
                onValueChange={(data, selectedIndex) => {
                    //
                }}
            />
        )
    }


    //
    someOtherFunc(){
        this.sp.scrollToIndex(2);   // select 'c'
        let selectedValue = this.sp.getSelected();  // returns 'c'
    }
}

About

a pure js picker, each option item customizable

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published