4.5.73 • Published 11 months ago

@hishprorg/vero-molestias v4.5.73

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

:point_up_2: Swiper FlatList component

supports iOS supports Android supports web npm npm Build Status license

Demo

Installation

yarn add @hishprorg/vero-molestias

or

npm install @hishprorg/vero-molestias --save

Notice

Version 2.x was re-implemented using React Hooks so it only works with version 0.59 or above

Version 3.x was re-implemented using Typescript and it works with react-native-web

@hishprorg/vero-molestiasreact-nativeDetox tests
1.x<= 0.58X
2.x>= 0.59X
3.x>= 0.59Build Status

Note: we are using the feature export type available in babel v7.9.0 https://github.com/babel/babel/pull/11171, you might have this issue with React Native between 0.60 and 0.63, please update babel to at least to v7.9.0

Examples

Expo example with renderItems, children and more

Expo example with children

React Native example with renderItems and custom pagination

React Native example with children

Code

Using renderItems and data run in expo snack

import React from 'react';
import { Text, Dimensions, StyleSheet, View } from 'react-native';
import { SwiperFlatList } from '@hishprorg/vero-molestias';

const colors = ['tomato', 'thistle', 'skyblue', 'teal'];

const App = () => (
  <View style={styles.container}>
    <SwiperFlatList
      autoplay
      autoplayDelay={2}
      autoplayLoop
      index={2}
      showPagination
      data={colors}
      renderItem={({ item }) => (
        <View style={[styles.child, { backgroundColor: item }]}>
          <Text style={styles.text}>{item}</Text>
        </View>
      )}
    />
  </View>
);

const { width } = Dimensions.get('window');
const styles = StyleSheet.create({
  container: { flex: 1, backgroundColor: 'white' },
  child: { width, justifyContent: 'center' },
  text: { fontSize: width * 0.5, textAlign: 'center' },
});

export default App;

Using children run in expo snack

import React from 'react';
import { Text, Dimensions, StyleSheet, View } from 'react-native';
import { SwiperFlatList } from '@hishprorg/vero-molestias';

const App = () => (
  <View style={styles.container}>
    <SwiperFlatList autoplay autoplayDelay={2} autoplayLoop index={2} showPagination>
      <View style={[styles.child, { backgroundColor: 'tomato' }]}>
        <Text style={styles.text}>1</Text>
      </View>
      <View style={[styles.child, { backgroundColor: 'thistle' }]}>
        <Text style={styles.text}>2</Text>
      </View>
      <View style={[styles.child, { backgroundColor: 'skyblue' }]}>
        <Text style={styles.text}>3</Text>
      </View>
      <View style={[styles.child, { backgroundColor: 'teal' }]}>
        <Text style={styles.text}>4</Text>
      </View>
    </SwiperFlatList>
  </View>
);

const { width } = Dimensions.get('window');

const styles = StyleSheet.create({
  container: { flex: 1, backgroundColor: 'white' },
  child: { width, justifyContent: 'center' },
  text: { fontSize: width * 0.5, textAlign: 'center' },
});

export default App;

Example project with Detox tests

Code example

To use react-native-gesture-handler instead of FlatList import the library like:

import { SwiperFlatListWithGestureHandler } from '@hishprorg/vero-molestias/WithGestureHandler';

Props

PropDefaultTypeDescription
datanot required if children is usedarrayData to use in renderItem
children-nodeChildren elements
renderItemnot required if children is usedFlatListProps<T>['renderItem']Takes an item from data and renders it into the list
onMomentumScrollEnd-(item: { index: number }, event: any)Called after scroll end and the first parameter is the current index
verticalfalsebooleanShow vertical swiper
index0numberIndex to start
renderAllfalsebooleanRender all the items before display it
Pagination
showPaginationfalsebooleanShow pagination
paginationDefaultColorgraystringPagination color
paginationActiveColorwhitestringPagination color
paginationStyle{}ViewStyleStyle object for the container
paginationStyleItem{}ViewStyleStyle object for the item (dot)
paginationStyleItemActive{}ViewStyleStyle object for the active item (dot)
paginationStyleItemInactive{}ViewStyleStyle object for the inactive item (dot)
onPaginationSelectedIndex-() => voidExecuted when the user presses the pagination index, similar properties onChangeIndex
PaginationComponentComponentnodeOverwrite Pagination component
Autoplay
autoplayfalsebooleanChange index automatically
autoplayDelay3numberDelay between every page in seconds
autoplayLoopfalsebooleanContinue playing after reach end
autoplayLoopKeepAnimationfalsebooleanShow animation when reach the end of the list
autoplayInvertDirectionfalsebooleanInvert auto play direction
disableGesturefalsebooleanDisable swipe gesture

More props

This is a wrapper around Flatlist, all their props works well and the inherited props too (from ScrollView and VirtualizedList)

Functions

NameTypeUse
scrollToIndex({ index: number, animated?: boolean}) => voidScroll to the index
getCurrentIndex() => numberReturns the current index
getPrevIndex() => numberReturns the previous index
onChangeIndex({ index: number, prevIndex: number}) => voidExecuted every time the index change, the index change when the user reaches 60% of the next screen
goToFirstIndex() => voidGo to the first index
goToLastIndex() => voidGo to the last index

Right To Left

This library support RTL languages, when I18nManager.isRTL is true.

Limitations

  • Vertical pagination is not supported on Android. Doc, that is way we have useReactNativeGestureHandler which is a workaround for this issue.

Author

Gustavo Gard

-0ec2flatES8extratoArraymoveshrinkwrapgesturescall-bindstyleguideTypedArrayposedom-testing-libraryaccessorsameValueZerovalidatorcallboundclientreact-hook-formes2018valid.enves5transpilerredux-toolkitcloudtrailenderbabel-coretoolkitobjcomparesettingsextendspawnMapcommand-lineclassnamesbabelbyteLengthcolorsminimalxhrtoSortedspinnersfromwritablesortedgetfast-deep-clonestringifiersharedhasOwnoptimistcloudsearchreact-testing-libraryloggingbundlingbeanstalkasyncglobalThisinspectcjkbddjwtefficientglobalselbpostcss-pluginstarterdateglacierlazyoptimizersetterenvcommandshebangfindhandlerslinkmacosprivateflattenhasOwnPropertydeleteauthenticationwhichjsonschemajson-schema-validationzxESBigUint64Arrayname@@toStringTagcryptwalkECMAScript 5workflowpinooutputnpmtypeerrorvaluespreserve-symlinkssetcore-jsnested cssmergeSettransportreal-timeflagsperformantgitignorefixed-widthECMAScript 2015immutableenvironmentmomentmakerulesvalidateArrayBuffercssURLSearchParamsSymbolserializationsymboleventEmitterbrowserslistclass-validatorservercoerciblefpsassertionstatelessastconstfluxstoragegatewayECMAScript 2018package.jsonsignalseslint-pluginutil.inspectinterruptsArray.prototype.filterdescriptionlivesyntaxerrordefinefull-widthlinuxshellacornquoteie0ponyfillcurlreact poseplugincertificateshooksassertsHyBiproxysimpledbreusepushprotohas-ownIteratorES6cachespringi18nRxvestArray.prototype.includes3dtypetelephoneFloat64ArrayRxJSinferencenegativetc39waflesscsskinesiserror-handlingvalidationhotcallbindgenericsidleWeakSeterrorbindObject.keysoptiondiffchildjsonasterisksharmonyselfnodejscolourpurestylesheetreducetranspilebytenopeYAMLclitrimEnditerationonceencryptionsyntaxMicrosoftformtraversea11yestreetscolumnindicatorurltypescriptemitpreprocessorpersistentexpressObservablebootstrap csscompilerObservablesTypeBoxAsyncIteratorreactutilless mixinsreadablestreames-shimsbrowserlistdraghookformtypesafecodesObject.getPrototypeOfback-endloadbalancingfantasy-landECMAScript 7ES2019ramdaStyleSheetES7less compilerclasseses2017invariantwritesigtermString.prototype.matchAllloggerimportInt8ArrayfsES2020WebSocketspathCSSStyleDeclarationReactiveExtensionsdeep-cloneio-tstddnumberoperating-systemtypeofglobaltrimStarttakevarlocationiamString.prototype.trimgraphqlStreamtypesbinyupirqtimeserializerdotenvRegExp.prototype.flagsautoprefixerequalitystableObject.isthreevariablesECMAScript 2019256utilsUint8Arrayprocessroute53propertyexitpoint-freecloudfrontviewtypedarraysES2022mapcss variablecollectionconcatPushUnderscorees2016deepcopyreact animationcommanderservicetrimRightrgblintObject.entriesqsshamconfigschemefunction.lengthgroupBypackage managerslicefastclonekoreanES2016packagesstructuredClonefile systemUint8ClampedArraytostringtagmkdircircularjoijapanesefunctionmkdirsstylessnsownfunctionalweaksetcallcss lessunicode_.extendarraycurriedargsruntimehandlerframerfileprotocol-buffers6to5dataviewhttpsawsprotobuftoStringTagcall-boundESnextjshintconsumecss-in-jstypedarrayArray.prototype.flatjson-schemaes8ECMAScript 3ebsES2018URLdayjsreadeslintpluginsomekeysstreamisphonecontainsexpressioneslintconfigmodulees7whatwginstallerlockfilehigher-orderbundlerrdssuperagentglobsetImmediaterandompnpm9jsdiffmixinsapihardlinksprivate datasharedarraybufferObject.definePropertyReflect.getPrototypeOfStreamsmatchcheckdependency managerECMAScript 2020binaryuser-streamsparserrapidUint32ArrayJSON-SchemaprunecoreartdefinePropertytoolstyped.gitignoresescss nestingwarningform-validationstringifyformsxtermdropsigintES5touchconfigurabletrimLeftkeysuperstructchannelworkspace:*collection.es6chaimanageraccessibilityeast-asian-widthes2015getoptvpctoobjectapollobannermkdirpfastifynativemock__proto__jestforkhasArrayBuffer.prototype.slicereduxreplaystateelmdescriptorsECMAScriptslottextincludesansiasciiregularES2015arraybufferECMAScript 2022forEachObjectairbnblocalprophashwaapiInt32Arraycensorfunctionsspeedvisualchineseinputfiltergetintrinsiccomputed-typespicomatchES2017electronBigInt64Arrayroutesidetyped arrayreact-hookssqsECMAScript 2023trimfigletconcatMapwidthexit-codepopmotionregexjssortbootstrap lessineslintqueuefindLastIndexlistenersgetterwindowvariables in csslogargvquerystringmake dirWebSocketregular expressionstylehelperPromisereadableequalECMAScript 2017formatajaxredactttyexecfilescheme-validationless.jsnegative zeroECMAScript 2016signaldirectorypromiserequestprettysafeworkeruploadawesomesaucejsxswfbrowserpipeArrayBuffer#slicesignedjson-schema-validatorSymbol.toStringTagTypeScriptRegExp#flagsopensslqueueMicrotaskautoscalingprogresstacitmetadatachromeconsoleUint16ArraymodulesfastcopysetPrototypeOfbuffersymlinksagentfront-endrecursivetslibeventsglobal this valueutilitiesecmascriptFunction.prototype.namecompile lessdomsymlinkimportexportexecutedataes-shim APIpasswordES3sequencefullwidthparsemockingECMAScript 6deepclonepropertiesutilityflagterminalrangeerrorformattingjsdomstyled-componentses-abstractemrhelpershttpObject.assignzoduninstallpyyamlclassnameprefixflatMaprobustwgetidentifiersweakmapstatuslessReactiveXfulliterateWeakMapendpointcloudwatchdataViewiteratorrequirenamesECMAScript 2021boundinternal slotresolveArrayschemareact-componentgdprmatchesremovel10nbyteOffsetredirectgetOwnPropertyDescriptormonorepogradients css3bcryptescryptodatastructuredirassertwaitlanguagegroupchromiumfindLastArray.prototype.findLastIndexless cssObject.fromEntriesvaluebuffersspecshimSystem.globalanimationamazonperformanceInt16ArrayJSONcloudformationobjectpositivematchAllenumerabledeterministictesterpatchargumentpredictableentriesintrinsiccolorauthroutingeffect-tses6Float32ArrayRFC-6455espreeisConcatSpreadableignoredescriptorfast-copymobileclonesymbolselasticacheajvArray.prototype.containslibphonenumbervarsArray.prototype.findLastassignzerostringprototypepolyfillwindowsdeepyamlomitarraysoffsetnodebinariesfetchcallbacklengths3lrutermfast-clonecreateinstallES2023fast-deep-copyfpeventDispatchercolumnsjQueryquerysubprocessCSSletgradients cssmrujavascriptinternalspinnereverytestES2021immer$.extendserializeObject.valuesbusyArray.prototype.flattenregular-expression
4.5.73

11 months ago

4.5.72

11 months ago

4.5.71

11 months ago

4.5.70

11 months ago

4.5.69

11 months ago

4.5.68

11 months ago

4.5.67

11 months ago

4.4.67

11 months ago

3.4.67

11 months ago

3.4.66

11 months ago

3.4.65

11 months ago

3.4.64

11 months ago

3.4.63

11 months ago

3.4.62

11 months ago

3.4.61

11 months ago

3.4.60

11 months ago

3.4.59

11 months ago

3.4.58

11 months ago

3.4.57

11 months ago

3.4.56

11 months ago

3.4.55

12 months ago

3.4.54

12 months ago

3.4.53

12 months ago

3.4.52

12 months ago

3.4.51

12 months ago

3.4.50

12 months ago

3.4.49

12 months ago

3.4.48

12 months ago

3.4.47

12 months ago

3.4.46

12 months ago

3.4.45

12 months ago

3.4.44

12 months ago

3.4.43

12 months ago

3.4.42

12 months ago

3.4.41

12 months ago

3.4.40

12 months ago

3.4.39

12 months ago

3.4.38

12 months ago

3.4.37

12 months ago

3.4.36

12 months ago

2.4.36

1 year ago

2.4.35

1 year ago

2.4.34

1 year ago

2.4.33

1 year ago

2.4.32

1 year ago

2.4.31

1 year ago

1.4.31

1 year ago

1.4.30

1 year ago

1.3.30

1 year ago

1.3.29

1 year ago

1.3.28

1 year ago

1.3.27

1 year ago

1.3.26

1 year ago

1.3.25

1 year ago

1.3.24

1 year ago

1.3.23

1 year ago

1.2.23

1 year ago

1.2.22

1 year ago

1.2.21

1 year ago

1.2.20

1 year ago

1.2.19

1 year ago

1.2.18

1 year ago

1.1.18

1 year ago

1.1.17

1 year ago

1.1.16

1 year ago

1.1.15

1 year ago

1.1.14

1 year ago

1.1.13

1 year ago

1.1.12

1 year ago

1.1.11

1 year ago

1.1.10

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago