Coder Social home page Coder Social logo

react-native-horizontal-picker's People

Contributors

3ahat0p avatar badkos avatar dependabot[bot] avatar garamani avatar vdor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

react-native-horizontal-picker's Issues

Question about defaultIndex

HI, Vseslav Dorofeev

i`m experiencing problem with default index.

I will attach screenshots to be more clear and i will provide simple example of what i should do and what is the actual behavior.

That`s my code:

const Items = Array.from(Array(10).keys());

const rednerItem = (item, index) => (
<View style={[styles.item], { width: 80, borderWidth: 1, borderColor: 'red' }}>
<Text style={{textAlign: 'center'}}>
{ item }


);

This is how it looks on mount of the component:
image

This is what i espect to be on mount of the component:

image

Thanks in advance!

Component throws onChange twice or more times, depending on where the scroll stopped

Hey!
Got a question about your very useful component ๐Ÿ‘

So, I see that at certain point horizontal picker makes 2 stops and throws 2 onChange event. For instance when you scroll either slow enough, or scroll far enough. Like onChange scrollview stops in the some place (between the items), then correctly centers on a particular item and throws onChange again.

Do you happen to know how to avoid that first onChange? so that I only get a single event when the scrollview complately stopped and correctly centered?

Thanks in advance!

Change value dynamically

Hi,

Is it possible to use the scrollTo function or something else to change the value dynamically?
I want to change the selected value/position after the component is already loaded.

please add default value to props

This is the only working horizontal picker that I've tried. The default value for editing forms is necessary. Please add the following lines to 'index.tsx':

componentDidMount() { const x = this.props.defaultValue * this.props.itemWidth; setTimeout(() => { this.refScrollView.current.scrollTo({ x, y: 0, animated: false }); }, 1) }

Also,

defaultValue: number,

to

export interface HorizontalPickerProps extends ScrollViewProps { data: any[], renderItem: (item: any, index: number) => ReactNode, itemWidth: number, defaultValue: number, snapTimeout?: number onChange?: (position: number) => void };

Thanks to vdor for this simple and useful picker

onScroll instead by this.onScroll

<HorizontalPicker
onScroll={(e)=> {}}
/>

onScroll can block private onScroll in HorizontalPicker

onScroll={this.onScroll}
{...props}

to

{...props}
onScroll={this.onScroll}

other properties also have the problem

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.