0.0.2 • Published 1 year ago

rn-use-modal-hook v0.0.2

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

UseModal Hook

Modal Hook is a customizable, reusable, and performant React Native modal hook with a responsive UI. It allows you to easily create custom modals without the need to pass props, making it easy to implement modals in your React Native projects. The hook is written in React Native, JavaScript, and TypeScript, and it does not require any external dependencies. With Modal Hook, you can show and hide modals with just a few lines of code and customize the modal's appearance and animation to match your app's design. Contributions to the project are welcome!

Installation

To install UseModal, you can use npm or yarn:

npm install rn-use-modal-hook

yarn add rn-use-modal-hook

Usage

To use UseModal in your React Native project, import the hook and call it in your component:

import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import React from 'react';
import { UseModal } from 'rn-use-modal-hook';

const App = () => {
  const {open, isOpen, ContentWrapper, close} = UseModal();
  console.log({isOpen});

  const onOpen = () => {
    console.log('open', {isOpen});
    open();
  };
  return (
    <>
      <View style={styles.container}>
        <TouchableOpacity
          onPress={() => {
            onOpen();
          }}
          style={styles.btn}>
          <Text>hi</Text>
        </TouchableOpacity>
      </View>
      <ContentWrapper>
        <View style={{alignSelf: 'center'}}>
          <Text>hi</Text>
          <TouchableOpacity style={styles.btn} onPress={close}>
            <Text>close me</Text>
          </TouchableOpacity>
        </View>
      </ContentWrapper>
    </>
  );
};

export default App;

The UseModal hook returns the following properties:

  • open: A function that shows the modal.
  • close: A function that hides the modal.
  • ContentWrapper: A wrapper component that should be used to wrap the content that should be displayed inside the modal.
  • isOpen: A boolean that indicates whether the modal is currently open or closed. Use the open function to show the modal and the close function to hide it. The content that should be displayed inside the modal should be wrapped inside the ContentWrapper component.

Contributing

Contributions are welcome! To contribute to Modal Hook, please follow these steps:

Fork the repository and create a new branch Make your changes and commit them with a descriptive message Push your changes to your forked repository Open a pull request with a detailed explanation of your changes

Contact

If you have any questions or feedback, please feel free to contact me at avalazemzadeh@gmail.com

abababort-controlleracceptsacorn-globalsabsolute-pathacorn-jsxacorn-walkajvagent-baseanseransi-colorsansi-fragmentsacornansi-regexansi-escapesansi-stylesappdirsjsargparseanymatcharr-diffarr-flattenarray-filterarr-unionarray-maparray-includesarray-reducearray-unionarray-uniquearray.prototype.flatmapasapassign-symbolsast-typesastral-regexasynckitasyncatobasync-limiterbabel-corebabel-plugin-dynamic-import-nodebabel-plugin-istanbulbabel-eslintbabel-plugin-jest-hoistbabel-plugin-polyfill-corejs2babel-plugin-polyfill-corejs3babel-plugin-syntax-trailing-function-commasbabel-preset-current-node-syntaxbabel-plugin-polyfill-regeneratorbabel-preset-jestbalanced-matchbabel-preset-fbjsbasebase64-jsbplist-creatorbig-integerbrace-expansionbracesbrowser-process-hrtimebrowserslistbplist-parserbuffer-frombytescache-basebsercall-bindcaller-callsitecamelcasecaller-pathcallsitescaniuse-litecapture-exitchar-regexchalkci-infocjs-module-lexerclass-utilscli-cursorcliuicli-spinnerscloneclone-deepcocollection-visitcollect-v8-coveragecolor-convertcolorscolorettecolor-namecommand-existscommondircomponent-emittercompressibleconcat-mapcombined-streamcompressioncommanderconvert-source-mapconnectcopy-descriptorcore-js-compatcore-util-iscross-spawncosmiconfigcsstypecssstyledayjsdebugdata-urlscssomdecode-uri-componentdecamelizedecimal.jsdedentdeep-isdefaultsdeepmergedefine-propertydelayed-streamdefine-propertiesdenodeifydepddestroydiff-sequencesdir-globdoctrinedetect-newlinedomexceptionee-firstelectron-to-chromiumemitteryemoji-regexencodeurlend-of-streamenquirerenvinfoerror-exerror-stack-parsererrorhandleres-abstractescape-htmlescape-string-regexpescodegeneslint-config-prettierescaladeeslint-plugin-jestes-to-primitiveeslint-plugin-flowtypeeslint-plugin-prettiereslint-plugin-eslint-commentseslint-plugin-react-hookseslint-plugin-reacteslint-plugin-react-nativeeslint-plugin-react-native-globalseslint-scopeespreeeslint-utilsesprimaeslint-visitor-keysesrecurseestraverseetagevent-target-shimesqueryexecaexec-shesutilsexitexpand-bracketsexpectextglobfast-deep-equalfast-difffast-globfast-levenshteinfast-json-stable-stringifyfb-watchmanfastqextend-shallowfill-rangefind-cache-dirfile-entry-cachefinalhandlerflat-cachefind-upflow-parserfor-infreshfs.realpathfunctional-red-black-treefseventsform-dataflattedfs-extraget-caller-fileget-package-typefunction-bindget-intrinsicget-symbol-descriptiongensyncget-stdinget-streamget-valueglobgraceful-fsglobbyglob-parenthashas-symbolshas-flaghas-tostringtaghas-valueglobalshas-bigintshermes-enginehas-valuesfragment-cachehermes-profile-transformerhermes-parserhtml-encoding-snifferhtml-escaperhttp-errorshttp-proxy-agenthttps-proxy-agentignorehuman-signalsimage-sizeiconv-liteimport-freshimport-localinflightimurmurhashinheritsinternal-slotinvariantipis-accessor-descriptoris-arrayishis-bigintis-bufferis-boolean-objectis-ciis-callableis-core-moduleis-data-descriptoris-directoryis-descriptoris-extglobis-extendableis-fullwidth-code-pointis-generator-fnis-negative-zerois-numberis-date-objectis-plain-objectis-globis-potential-custom-element-nameis-regexis-shared-array-bufferis-number-objectis-symbolis-streamis-stringis-typedarrayis-windowsis-weakrefisarrayis-wslisexeistanbul-lib-coverageisobjectistanbul-lib-reportistanbul-lib-instrumentistanbul-lib-source-mapsistanbul-reportsjest-changed-filesjest-configjest-docblockjest-eachjest-environment-nodejest-get-typejest-diffjest-haste-mapjest-matcher-utilsjest-message-utiljest-pnp-resolverjest-jasmine2jest-clijest-leak-detectorjest-environment-jsdomjest-mockjest-resolvejest-circusjest-runnerjest-resolve-dependenciesjest-runtimejest-snapshotjest-serializerjest-regex-utiljest-validatejest-watcherjest-workerjest-utiljetifierjs-yamljs-tokensjsc-androidjoijscodeshiftjsescjson-schema-traversejsdomjson-stable-stringify-without-jsonifyjson-parse-better-errorsjson5jsx-ast-utilsjsonifykind-ofjsonfilekleurlocate-pathlevnlodashlevenklawlodash.mergelodash.debouncelodash.throttlelodash.truncatelog-symbolslogkittyloose-envifymake-dirmap-cachelru-cachemap-visitmakeerrormetromerge2merge-streammetro-babel-registermetro-babel-transformermetro-configmetro-coremetro-hermes-compilermetro-cache-keymetro-inspector-proxymetro-react-native-babel-transformermetro-resolvermetro-runtimemetro-cachemetro-minify-uglifymetro-symbolicatemetro-transform-pluginsmetro-source-mapmicromatchmimemetro-transform-workermime-dbmimic-fnminimatchminimistmixin-deepmkdirpmime-typesnanomatchnatural-compareneo-asyncmsnocachenegotiatornode-dirnode-fetchnice-trynode-releasesnormalize-pathnode-stream-zipnode-int64npm-run-pathnullthrowsob1nwsapiobject-keysobject-assignobject.assignobject-copyobject-inspectobject.entriesobject.fromentriesobject.pickobject.hasownobject-visitobject.valueson-finishedonceonetimeopenoptionatorp-finallyos-tmpdiroptionsorap-limitp-tryparse-jsonparent-moduleparse5parseurlpath-existspascalcasep-locatepath-typepath-keypicocolorspath-parsepicomatchpkg-dirpifypiratesposix-character-classesprelude-lson-headersplistpath-is-absoluteprettierprettier-linter-helpersprocess-nextick-argspretty-formatpromiseprogresspromptspslqueue-microtaskpumppunycodereact-devtools-corerange-parserreact-isreact-refreshreact-shallow-rendererreadable-streamreact-native-codegenprop-typesrecastregenerateregenerate-unicode-propertiesreadlineregenerator-runtimeregenerator-transformregex-notregexppregexpu-coreregexp.prototype.flagsrepeat-elementregjsparserregjsgenrepeat-stringrequire-directoryrequire-from-stringrequire-main-filenameresolveresolve-fromremove-trailing-separatorresolve-cwdresolve.exportsresolve-urlrestore-cursorretreusifyrimrafrsvprun-parallelsafe-buffersafe-regexsafer-buffersanesaxsaxesschedulersendsemverserialize-errorserve-staticset-blockingset-valueshallow-clonesetprototypeofshebang-commandshebang-regexside-channelshell-quotesignal-exitsisteransislice-ansisimple-plistsnapdragonsnapdragon-nodesnapdragon-utilsource-map-resolveslashsource-map-urlsplit-stringsprintf-jsstackframestacktrace-parsersource-map-supportstatic-extendstring-lengthstream-bufferssource-mapstring-widthstack-utilsstring.prototype.matchallstatusesstring.prototype.trimendstring.prototype.trimstartstring_decoderstrip-eofstrip-ansistrip-final-newlinestrip-bomstrip-json-commentssudo-promptsupports-preserve-symlinks-flagsupports-hyperlinkssupports-colorsymbol-treetest-excludetext-tabletemptmplthroatthrough2to-fast-propertiesto-object-pathto-regexto-regex-rangetoidentifiertableterminal-linktough-cookietsutilstype-checktr46typedarray-to-bufferultronunbox-primitivetype-detectuglify-estslibunicode-match-property-value-ecmascriptunicode-canonical-property-names-ecmascriptunicode-match-property-ecmascriptunicode-property-aliases-ecmascripttype-festunset-valueunpipeurixunion-valueuri-jsuniversalifyutils-mergeuse-subscriptionuseuuidutil-deprecatevaryv8-compile-cachev8-to-istanbulvlqw3c-hr-timew3c-xmlserializerwalkerwcwidthwhatwg-fetchwebidl-conversionswhatwg-mimetypewhatwg-urlwhatwg-encodingwhich-boxed-primitivewhich-modulewhichword-wrapwrap-ansiwrappywsxcodewrite-file-atomicxml-name-validatorxmlbuilderxmlcharsxmldocy18nyallistyargsyargs-parserxtend
0.0.2

1 year ago

0.0.1

1 year ago