Skip to content
a pure js picker, each option item customizable
JavaScript
Branch: master
Clone or download
Latest commit a041b0f Sep 4, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
res add example pic Sep 29, 2016
.gitignore init Sep 21, 2016
LICENSE Initial commit Sep 21, 2016
index.js updated readme.md Sep 2, 2019
package.json update version Sep 4, 2019
readme.md Update readme.md Sep 2, 2019

readme.md

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 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'
    }
}
You can’t perform that action at this time.