0.1.0 • Published 1 year ago

@_nomtek/react-native-shimmer-animation v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react-native-shimmer-animation

Shimmering placeholder for iOS and Android based on Reanimated

Installation

Using npm

npm install react-native-shimmer-animation

Using yarn

yarn add react-native-shimmer-animation

Installing dependencies

This library uses react-native-reanimated and react-native-linear-gradient as peer dependencies - ensure you have them installed in your project.

Using npm

npm install react-native-reanimated react-native-linear-gradient

Using yarn

yarn add react-native-reanimated react-native-linear-gradient

Usage

import { ShimmeringPlaceholder } from 'react-native-reanimated-shimmering';

// use standalone placeholder component

<ShimmeringPlaceholder size={{ width: 100, height: 100 }} />

// or a wrapper around your component which is loading its content

const [isLoading, setLoading] = useState(false);

<ShimmeringWrapper visible={isLoading}>
    <Image
        source={{ uri: 'https://reactnative.dev/img/tiny_logo.png' }}
        onLoadStart={() => setLoading(true)}
        onLoadEnd={() => setLoading(false)}
        style={{ width: 100, height: 100 }}
    />
</ShimmeringWrapper>

Synchronized animation between multiple components

Check out the example app for more usage examples.

Props

ShimmeringPlaceholder

PropDescriptionTypeDefault
sizePlaceholder size{ width: number; height: number }-
durationAnimation duration (in milliseconds)number1000
gradientWidthWidth of the gradientnumbersize.width
gradientColorsArray of gradient colors[string, string, string]['#ebebeb', '#c5c5c5', '#ebebeb']
gradientLocationsArray of gradient locations[number, number, number][0.3, 0.5, 0.7]
easingAnimation easing function(t: number) => numberEasing.linear
stylePlaceholder styleStyleProp<ViewStyle>undefined
inputInterpolation input rangenumber[][-1, 1]
outputInterpolation output rangenumber[][-size.width, size.width]

ShimmeringWrapper

PropDescriptionTypeDefault
visibleIs ShimmeringPlaceholder visibleboolean-
sizeShimmeringPlaceholder size{ width: number; height: number }-
styleContainer styleStyleProp<ViewStyle>undefined
shimmerStyleShimmeringPlaceholder styleStyleProp<ViewStyle>undefined
durationAnimation duration (in milliseconds)number1000
gradientWidthWidth of the gradientnumbersize.width
gradientColorsArray of gradient colors[string, string, string]['#ebebeb', '#c5c5c5', '#ebebeb']
gradientLocationsArray of gradient locations[number, number, number][0.3, 0.5, 0.7]
easingAnimation easing function(t: number) => numberEasing.linear
inputInterpolation input rangenumber[][-1, 1]
outputInterpolation output rangenumber[][-size.width, size.width]

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

absolute-pathJSONStreamacceptsacornacorn-walkagent-baseacorn-jsxadd-streamajvaggregate-errorabort-controlleransi-escapesansi-alignansi-regexansi-stylesarganymatchansi-fragmentsappdirsjsargparsearr-diffarr-flattenarr-unionanserarray-ifyarray-unionarray-includesarray.prototype.flatmaparrifyarray-uniqueasapassign-symbolsast-typesastral-regexasyncasync-limiterarray.prototype.mapasync-retryasynckitbabel-plugin-polyfill-corejs2babel-jestbabel-plugin-dynamic-import-nodebabel-corebabel-plugin-istanbulatobbabel-plugin-jest-hoistbabel-plugin-polyfill-regeneratorbabel-plugin-syntax-trailing-function-commasbabel-preset-current-node-syntaxbabel-preset-fbjsbig-integerbabel-preset-jestbasebalanced-matchbabel-plugin-polyfill-corejs3base64-jsblbplist-creatorbefore-after-hookboxenbrace-expansionbracesbrowserslistbufferbytesbuffer-frombsercacheable-lookupcall-bindcache-basebplist-parsercaller-pathchalkcallsitescaller-callsitecamelcase-keyscamelcasechar-regexcaniuse-litecacheable-requestclass-utilsci-infochardetcli-cursorclean-stackcli-spinnerscjs-module-lexercli-boxesclone-deepclonecollect-v8-coveragecli-widthcocliuicolor-convertcolorettecombined-streamcolor-namecollection-visitcommondircommandercommand-existscompare-funccomponent-emittercompressiblecompressionconcat-mapconfig-chainconcat-streamconfigstoreconventional-changelogconnectconventional-changelog-atomconventional-changelog-angularconventional-changelog-codemirrorconventional-changelog-conventionalcommitsconventional-changelog-coreconventional-changelog-eslintconventional-changelog-jqueryconventional-changelog-emberconventional-changelog-expressconventional-changelog-jshintconventional-changelog-preset-loaderconventional-commits-filterconventional-changelog-writerconvert-source-mapconventional-recommended-bumpcore-js-compatcosmiconfig-typescript-loaderconventional-commits-parsercosmiconfigcore-util-iscreate-requirecross-spawncsstypecopy-descriptordargscrypto-random-stringdateformatdata-uri-to-bufferdebugdecamelizedecompress-responsedecode-uri-componentdayjsdecamelize-keysdeep-isdedentdeepmergedefine-propertiesdeep-extenddefine-lazy-propdefaultsdefer-to-connectdeldelayed-streamdefine-propertydenodeifydegeneratordeprecated-react-native-prop-typesdeprecationdepddestroydetect-newlinediff-sequencesdiffdir-globdoctrinedot-propee-firsteastasianwidthencodeurlemitteryemoji-regexenvinfoelectron-to-chromiumerrorhandlererror-exes-get-iteratorerror-stack-parseres-array-method-boxes-properlyend-of-streames-abstractes-to-primitiveescaladeescape-goatescodegenes-shim-unscopablesescape-string-regexpeslint-plugin-eslint-commentsescape-htmleslint-plugin-ft-floweslint-plugin-react-hookseslint-plugin-jesteslint-plugin-react-nativeeslint-scopeeslint-plugin-react-native-globalsesprimaeslint-utilsesrecurseeslint-plugin-reacteslint-visitor-keysespreeestraverseesutilsevent-target-shimetagexpand-bracketsexpectexecaesqueryexitextend-shallowexternal-editorfast-globextglobfast-deep-equalfb-watchmanfast-levenshteinfast-difffetch-blobfastqfiguresfile-uri-to-pathfile-entry-cachefinalhandlerfill-rangefind-upfast-json-stable-stringifyflat-cacheflattedflow-parserform-datafor-inform-data-encoderformdata-polyfillfragment-cachefind-cache-dirfs-extrafreshfs.realpathftpfunction-bindfunction.prototype.namefseventsfunctions-have-namesget-caller-fileget-intrinsicgensyncget-pkg-repoget-package-typeget-valueget-symbol-descriptionget-streamgit-upget-urigit-raw-commitsgit-semver-tagsgitconfiglocalgit-url-parseglob-parentglobglobbygraceful-fsglobal-dirsgit-remote-origin-urlgotglobalsgrapheme-splitterhandlebarshard-rejectionhas-bigintshas-property-descriptorshashas-flaghas-symbolshas-tostringtaghas-valuehermes-enginehermes-estreehermes-parserhas-yarnhttp-errorshttp-cache-semanticshermes-profile-transformerhosted-git-infohtml-escaperhttp-proxy-agenthttp2-wrapperhttps-proxy-agentignorehas-valueshuman-signalsieee754iconv-liteimage-sizeindent-stringimport-lazyinheritsimport-localimurmurhashinflightimport-freshinternal-slotiniinquirerinterpretis-absoluteipinvariantis-accessor-descriptoris-argumentsis-bigintis-arrayishis-core-moduleis-callableis-ciis-boolean-objectis-descriptoris-directoryis-data-descriptoris-date-objectis-extendableis-dockeris-fullwidth-code-pointis-bufferis-git-repositoryis-extglobis-globis-git-dirtyis-negative-zerois-generator-fnis-interactiveis-installed-globallyis-numberis-mapis-number-objectis-objis-npmis-path-insideis-plain-objectis-plain-objis-path-cwdis-regexis-setis-relativeis-shared-array-bufferis-streamis-stringis-symbolis-text-pathis-typedarrayis-unc-pathis-weakrefis-unicode-supportedis-windowsis-yarn-globalis-sshis-wslisexeisarrayisobjectistanbul-lib-coverageistanbul-lib-instrumentistanbul-reportsiterate-iteratoristanbul-lib-reportistanbul-lib-source-mapsjest-changed-filesjest-clijest-circusiterate-valuejest-diffjest-configjest-get-typejest-leak-detectorjest-haste-mapjest-eachjest-matcher-utilsjest-docblockjest-environment-nodejest-message-utiljest-pnp-resolverjest-resolve-dependenciesjest-mockjest-regex-utiljest-resolvejest-snapshotjest-validatejest-runtimejest-serializerjest-utiljest-watcherjetifierjest-workerjest-runnerjs-yamljoijs-sdsljsescjson-parse-better-errorsjsc-androidjscodeshiftjson-parse-even-better-errorsjson-bufferjson-stable-stringify-without-jsonifyjs-tokensjson-schema-traversejsx-ast-utilsjsonfilejson-stringify-safejsonparsekind-ofklawkleurjson5latest-versionlevenkeyvlevnlines-and-columnslodashlocate-pathlodash.ismatchlodash.isequallodash.debouncelog-symbolsload-json-filelodash.mergelodash.throttleloose-envifylogkittymake-errorlru-cachemake-dirmakeerrormacos-releasemap-objmap-visitmap-cachelowercase-keysmeowmetrometro-babel-transformermerge2merge-streammetro-configmetro-cache-keymetro-coremetro-inspector-proxymetro-cachemetro-hermes-compilermetro-minify-uglifymetro-runtimemetro-resolvermetro-react-native-babel-transformermetro-transform-pluginsmetro-symbolicatemetro-react-native-babel-presetmetro-source-mapmicromatchmime-dbmetro-transform-workermimic-fnmimic-responseminimatchmime-typesmimemin-indentmixin-deepminimist-optionsminimistnanomatchmodify-valuesmute-streammkdirpneo-asyncnegotiatornew-github-release-urlnatural-comparenice-trymsnocachenode-domexceptionnetmasknode-dirnode-int64node-fetchnode-releasesnormalize-package-datanormalize-urlnormalize-pathnode-stream-zipob1npm-run-pathnullthrowsobject-copyobject-inspectobject-keysobject.entriesobject.fromentriesobject-visitobject.assignobject.valuesobject.hasownobject.pickon-finishedon-headersopenonceonetimeobject-assignp-cancelableoraos-tmpdiros-namep-limitp-locateoptionatorp-tryp-finallypackage-jsonpac-proxy-agentpac-resolverparse-jsonparse-pathparent-moduleparse-urlparseurlp-mappath-is-absolutepath-existspascalcasepath-typepath-parsepicomatchpifypkg-dirpath-keypiratesplistpicocolorsposix-character-classesprelude-lspretty-formatprettier-linter-helpersprocess-nextick-argsprop-typespromisepromise.allsettledproto-listpromptsproxy-agentprotocolspunycodepupapumpquick-lruproxy-from-envqueue-microtaskrange-parserqreact-devtools-corercreactraw-bodyreact-native-gradle-pluginreact-native-codegenreact-isreact-nativeread-pkgreact-refreshread-pkg-upreadable-streamreadlinerecastrechoirregenerate-unicode-propertiesregenerateregenerator-runtimeredentreact-shallow-rendererregex-notregexppregexp.prototype.flagsregenerator-transformregistry-auth-tokenregexpu-corerequire-from-stringregjsgenrepeat-elementrepeat-stringrequire-directoryregistry-urlrequire-main-filenameresolveregjsparserresolve-alpnresolve-cwdresolve-globalresolve-fromresponselikeretresolve.exportsreusifyrimrafretryrestore-cursorresolve-urlsafe-bufferrun-parallelrun-asyncsafe-regexrxjssaxsafer-buffersafe-regex-testsemver-diffsemverschedulerserialize-errorsendserve-staticsetimmediateset-valuesetprototypeofshebang-commandshell-quoteshelljsshebang-regexshallow-clonesignal-exitside-channelslashsimple-plistset-blockingslice-ansisisteransismart-buffersnapdragon-utilsnapdragon-nodesource-mapsnapdragonsource-map-resolvesource-map-supportsocks-proxy-agentspdx-exceptionsspdx-correctsockssplitspdx-license-idsspdx-expression-parsesplit2split-stringstack-utilssprintf-jssource-map-urlstacktrace-parserstackframestream-buffersstatic-extendstatusesstring-hash-64string-lengthstring-widthstrip-ansistring.prototype.matchallstring.prototype.trimendstring_decoderstring.prototype.trimstartstring-natural-comparestrip-final-newlinestrip-json-commentsstrip-bomstrip-eofsupports-hyperlinksstrip-indentsupports-colorsudo-prompttemptest-excludesupports-preserve-symlinks-flagtext-extensionstext-tablethroughthroattmpterminal-linktmplto-object-pathtoidentifierto-fast-propertiesto-regexthrough2tr46trim-newlinesto-regex-rangetype-checktslibtype-detecttsutilsts-nodetypedarraytypedarray-to-buffertype-festuglify-esuglify-jsunc-path-regexunbox-primitiveunicode-match-property-ecmascriptunicode-match-property-value-ecmascriptunicode-property-aliases-ecmascriptunicode-canonical-property-names-ecmascriptuniversal-user-agentunion-valueunique-stringunpipeupdate-browserslist-dbunset-valueuniversalifyurixupdate-notifierurl-joinuri-jsuseutil-deprecateuuidutils-mergeuse-subscriptionvalidate-npm-package-licensevaryv8-compile-cache-libv8-to-istanbulwalkervm2wcwidthvlqwhatwg-urlwebidl-conversionswhatwg-fetchweb-streams-polyfillwhich-modulewhich-boxed-primitivewhichwildcard-matchwindows-releasewidest-lineword-wrapwordwrapwrap-ansiwrappyxcodewsxdg-basedirxmldocxtendwrite-file-atomicyallisty18nyamlxmlbuilderyargsyargs-parserynyocto-queuexregexp
0.1.0

1 year ago