0.7.1 • Published 7 months ago

@vidit-me/react-native-wheely v0.7.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

react-native-wheely

CircleCI npm package npm downloads

An all JavaScript, highly customizable wheel picker for react native.

Installation

Install with npm

npm install --save react-native-wheely

Install with yarn

yarn add react-native-wheely

Usage

import React, { useState } from 'react';
import WheelPicker from 'react-native-wheely';

function CityPicker() {
  const [selectedIndex, setSelectedIndex] = useState(0);

  return (
    <WheelPicker
      selectedIndex={selectedIndex}
      options={['Berlin', 'London', 'Amsterdam']}
      onChange={(index) => setSelectedIndex(index)}
    />
  );
}

Props

NameTypeDescription
optionsstring[]Options to be displayed in the wheel picker. Options are rendered from top to bottom, meaning the first item in the options will be at the top and the last at the bottom.
selectedIndexnumberIndex of the currently selected option.
onChange(index: number) => voidHandler that is called when the selected option changes.
visibleRestnumberAmount of additional options that are visible in each direction. Default is 2, resulting in 5 visible options.
itemHeightnumberHeight of each option in the picker. Default is 40.
itemStyleStyleProp<ViewStyle>Style for the option's container.
itemTextStyleStyleProp<TextStyle>Style for the option's text.
containerStyleStyleProp<ViewStyle>Style of the picker.
selectedIndicatorStyleStyleProp<ViewStyle>Style of overlaying selected-indicator in the middle of the picker.
rotationFunction(x: number) => numberFunction to determine the x rotation of items based on their current distance to the center (which is x). Default is rotation equation
scaleFunction(x: number) => numberFunction to determine the scale of items based on their current distance to the center (which is x). Default is scale quation
opacityFunction(x: number) => numberFunction to determine the opacity of items based on their current distance to the center (which is x). Default is opacity equation
decelerationRate"normal", "fast", numberHow quickly the underlying scroll view decelerates after the user lifts their finger. See the ScrollView docs. Default is "fast".
containerPropsViewPropsProps that are applied to the container which wraps the FlatList and the selected indicator.
flatListPropsFlatListPropsProps that are applied to the FlatList.

Memoization

The individual items in the picker (<WheelPickerItem />) are strictly memoized, meaning that they will not rerender after the initial render. Rerendering the picker items uncontrollably would lead to bad performance with large number of options. Item styles, animation functions and other parameters of items therefore must be static and changes to them after the initial render will have no effect.

acornacceptsabsolute-pathacorn-jsxabort-controlleransi-fragmentsajvansi-regexansi-stylesanseranymatchappdirsjsarr-diffargparsearr-flattenarr-unionarray-reducearray-filterarray-maparray-includesarray-unionarray-uniquearray.prototype.flatmapasapassign-symbolsasync-limiterbabel-plugin-syntax-trailing-function-commasastral-regexasyncast-typesbabel-plugin-dynamic-import-nodeatobbalanced-matchbabel-preset-fbjsbase64-jsbasebig-integerbrowserslistbserbrace-expansioncache-basebplist-parsercall-bindbytesbplist-creatorcaller-callsitecaller-pathbuffer-fromcapture-exitchalkcamelcaseci-infocallsitescli-spinnersbracesclonecaniuse-litecolorettecli-cursorclass-utilscollection-visitcliuicolor-convertcommand-existscolorscolor-namecommondircommandercomponent-emittercompressiblecopy-descriptorconvert-source-mapconnectcore-util-isconcat-mapcsstypecosmiconfigcross-spawndebugdecamelizedeep-isdeepmergedefaultsdefine-propertydefine-propertiesdayjsdecode-uri-componentdenodeifydoctrinedestroyelectron-to-chromiumcompressiondir-globee-firstemoji-regexerror-exend-of-streamenvinfoerror-stack-parseres-to-primitivedepdes-abstractescaladeescape-htmlescape-string-regexpeslint-plugin-react-native-globalseslint-scopeeslint-utilseslint-visitor-keyserrorhandlerespreeesprimaesutilsesrecurseestraverseevent-target-shimextglobetagencodeurlexecaesqueryexec-shextend-shallowexpand-bracketsfast-globfb-watchmanfast-deep-equalfast-json-stable-stringifyfastqfill-rangefile-entry-cachefinalhandlerfast-levenshteinfind-cache-dirflat-cachefor-inflattedfreshfind-upfunction-bindfragment-cacheflow-parserfunctional-red-black-treeget-caller-fileget-intrinsicgensyncget-streamget-valueget-symbol-descriptionglobalsglob-parentgraceful-fsglobhasfs-extrahas-bigintsglobbyhas-valuehas-valueshermes-enginehas-tostringtagfs.realpathhermes-parserhas-symbolshttp-errorshermes-profile-transformerimage-sizeignorehas-flagimurmurhashinternal-slotipis-boolean-objectinvariantinheritsis-arrayishis-bigintis-bufferis-callableis-ciis-core-moduleis-data-descriptoris-date-objectis-accessor-descriptorimport-freshis-extendableinflightis-directoryis-extglobis-fullwidth-code-pointis-numberis-plain-objectis-negative-zerois-number-objectis-globis-stringis-symbolis-streamis-wslis-shared-array-bufferis-weakrefjest-get-typeis-regexisobjectjest-haste-mapis-descriptorjest-serializerisarrayjest-utiljest-validateis-windowsjest-regex-utilisexejest-workerjetifierjs-tokensjoijson-parse-better-errorsjsescjscodeshiftjsc-androidjsonfilejson-stable-stringify-without-jsonifyjs-yamljson-schema-traversejsonifyklawjsx-ast-utilskind-ofkleurlevnlevenlodash.mergelocate-pathjson5lodash.throttlelog-symbolsmake-dirloose-envifylru-cachelodashmap-visitmap-cachemerge2merge-streammetro-babel-registermetro-babel-transformermetrologkittymakeerrormetro-cachemetro-configmetro-cache-keymetro-react-native-babel-presetmetro-react-native-babel-transformermetro-minify-uglifymetro-hermes-compilermetro-resolvermetro-runtimemetro-inspector-proxymetro-transform-pluginsmetro-source-mapmetro-transform-workermetro-coremicromatchmimemetro-symbolicatemime-dbmime-typesnanomatchmimic-fnmsminimatchnegotiatornatural-compareminimistmixin-deepmkdirpnice-trynode-fetchnode-stream-zipnode-releasesnormalize-pathneo-asyncnode-int64node-modules-regexpnode-dirnullthrowsnocacheob1object-inspectobject-assignobject.assignobject-copyobject-visitnpm-run-pathobject.pickobject.fromentriesobject-keysonceon-finishedobject.hasownonetimeobject.entriesopenoptionsobject.valuesoraon-headersp-locateos-tmpdiroptionatorp-tryparse-jsonp-limitpascalcasepath-is-absoluteparseurlp-finallypath-keyparent-modulepath-parsepath-existspicocolorspiratespifyprocess-nextick-argspicomatchprelude-lspkg-dirplistpath-typepromptspumpprop-typesposix-character-classesreact-devtools-corepretty-formatreact-ispunycoderange-parserreadlinequeue-microtaskreadable-streamregeneraterecastreact-refreshregenerator-runtimeregenerate-unicode-propertiesregenerator-transformregexpu-coreregex-notregexp.prototype.flagsreact-native-codegenregjsgenregexppremove-trailing-separatorrepeat-elementrequire-directoryregjsparserpromiserequire-main-filenameresolve-fromretresolverestore-cursorresolve-urlrepeat-stringrsvpsafe-regexrun-parallelrimrafsafe-bufferschedulersanereusifysendsemverserialize-errorsetprototypeofset-blockingset-valuesaxshebang-regexshell-quoteshebang-commandsimple-plistside-channelsisteransiserve-staticsignal-exitslashslice-ansisnapdragon-utilsnapdragon-nodesnapdragonsplit-stringsource-mapsource-map-urlsprintf-jsstacktrace-parserstatic-extendsource-map-supportstring-widthstackframestatusessource-map-resolvestring.prototype.matchallstring_decoderstream-buffersstring.prototype.trimstartstrip-json-commentsstrip-eofsudo-promptsupports-colorstring.prototype.trimendtext-tablestrip-ansitemptmplthrough2to-object-pathto-regexto-regex-rangeto-fast-propertiestoidentifierthroattr46type-festtslibuglify-esunicode-match-property-ecmascripttsutilsunbox-primitiveunicode-canonical-property-names-ecmascripttype-checkunicode-match-property-value-ecmascriptunion-valueuniversalifyunset-valueurixuuidutils-mergeuseunicode-property-aliases-ecmascriptunpipeuse-subscriptionultronv8-compile-cachevaryvlqutil-deprecateuri-jswebidl-conversionswcwidthwhatwg-urlwhich-moduleword-wrapwhatwg-fetchwrap-ansiwrappywhichwhich-boxed-primitivewrite-file-atomicwalkerwsxcodextendxmldocy18nxmlbuilderyallistyargs-parseryargs
0.7.1

7 months ago

0.7.0

7 months ago