1.0.4 • Published 2 years ago

react-native-android-scoped-storage v1.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

react-native-android-scoped-storage

Scoped storage for android 10 and above version

Installation

npm install react-native-android-scoped-storage

Usage

import React, {useState, useEffect} from 'react';
import * as picker from 'react-native-android-scoped-storage';
import {
  SafeAreaView,
  Text,
  TouchableOpacity,
  View,
  NativeModules,
  NativeEventEmitter,
  Image,
} from 'react-native';
const {PermissionFile} = NativeModules;
const App = () => {
  var [response, setResponse] = useState({});
  
  async function imageVideoPicker() {

     let eventEmitter = null;
     let imageListener = null;
     let videoListener = null;
     if (Platform.OS == 'android') {
       eventEmitter = new NativeEventEmitter(PermissionFile);
       imageListener = eventEmitter.addListener('imageData', imageData => {
         imageData.map(item => {
           setResponse(item);
           imageListener.remove();
           return;
        
         });
       });
       videoListener = eventEmitter.addListener('videoData', videoData => {
         videoData.map((item, index) => {
           setResponse(item);
           videoListener.remove();
           return;
           
         });
       });
     }

    picker.imageCapture();
  }

  return (
    <SafeAreaView
      style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
      <View>
        <TouchableOpacity onPress={() => imageVideoPicker()}>
          <Text>click me</Text>
        </TouchableOpacity>
        <Image
          source={{uri: response.path}}
          style={{height: 100, width: 100}}
        />
      </View>
    </SafeAreaView>
  );
};

export default App;

// ...

Contributing

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

License

MIT

abababort-controllerabsolute-pathacceptsacornacorn-globalsacorn-walkagent-baseanseransi-escapesansi-fragmentsansi-regexansi-stylesanymatchappdirsjsargparsearr-diffarr-flattenarr-unionarray-filterarray-maparray-reducearray-uniqueasapassign-symbolsast-typesastral-regexasyncasync-limiterasynckitatobbabel-corebabel-plugin-dynamic-import-nodebabel-plugin-istanbulbabel-plugin-jest-hoistbabel-plugin-polyfill-corejs2babel-plugin-polyfill-corejs3babel-plugin-polyfill-regeneratorbabel-plugin-syntax-trailing-function-commasbabel-preset-current-node-syntaxbabel-preset-fbjsbabel-preset-jestbalanced-matchbasebase64-jsbig-integerbplist-creatorbplist-parserbrace-expansionbracesbrowser-process-hrtimebrowserslistbserbuffer-frombytescache-basecall-bindcaller-callsitecaller-pathcallsitescamelcasecaniuse-litecapture-exitchalkchar-regexci-infocjs-module-lexerclass-utilscli-cursorcli-spinnerscliuicloneclone-deepcocollect-v8-coveragecollection-visitcolor-convertcolor-namecolorettecolorscombined-streamcommand-existscommandercommondircomponent-emittercompressiblecompressionconcat-mapconnectconvert-source-mapcopy-descriptorcore-js-compatcore-util-iscosmiconfigcross-spawncssomcssstylecsstypedata-urlsdayjsdebugdecamelizedecimal.jsdecode-uri-componentdedentdeep-isdeepmergedefaultsdefine-propertiesdefine-propertydelayed-streamdenodeifydepddestroydetect-newlinediff-sequencesdomexceptionee-firstelectron-to-chromiumemitteryemoji-regexencodeurlend-of-streamenvinfoerror-exerror-stack-parsererrorhandlerescaladeescape-htmlescape-string-regexpescodegenesprimaestraverseesutilsetagevent-target-shimexec-shexecaexitexpand-bracketsexpectextend-shallowextglobfast-json-stable-stringifyfast-levenshteinfb-watchmanfill-rangefinalhandlerfind-babel-configfind-cache-dirfind-upflow-parserfor-inform-datafragment-cachefreshfs-extrafs.realpathfseventsfunction-bindgensyncget-caller-fileget-intrinsicget-package-typeget-streamget-valueglobglobalsgraceful-fshandlebarshashas-flaghas-property-descriptorshas-symbolshas-valuehas-valueshermes-enginehermes-parserhermes-profile-transformerhtml-encoding-snifferhtml-escaperhttp-errorshttp-proxy-agenthttps-proxy-agenthuman-signalsiconv-liteimage-sizeimport-freshimport-localimurmurhashinflightinheritsinvariantipis-accessor-descriptoris-arrayishis-bufferis-ciis-core-moduleis-data-descriptoris-descriptoris-directoryis-extendableis-fullwidth-code-pointis-generator-fnis-numberis-plain-objectis-potential-custom-element-nameis-streamis-typedarrayis-windowsis-wslisarrayisexeisobjectistanbul-lib-coverageistanbul-lib-instrumentistanbul-lib-reportistanbul-lib-source-mapsistanbul-reportsjest-changed-filesjest-circusjest-clijest-configjest-diffjest-docblockjest-eachjest-environment-jsdomjest-environment-nodejest-get-typejest-haste-mapjest-jasmine2jest-leak-detectorjest-matcher-utilsjest-message-utiljest-mockjest-pnp-resolverjest-regex-utiljest-resolvejest-resolve-dependenciesjest-runnerjest-runtimejest-serializerjest-snapshotjest-utiljest-validatejest-watcherjest-workerjetifierjoijs-tokensjs-yamljsc-androidjscodeshiftjsdomjsescjson-parse-better-errorsjson-parse-even-better-errorsjson5jsonc-parserjsonfilejsonifykind-ofklawkleurlevenlevnlines-and-columnslocate-pathlodashlodash.debouncelodash.throttlelog-symbolslogkittyloose-envifylru-cachelunrmake-dirmakeerrormap-cachemap-visitmarkedmerge-streammetro-babel-registermetro-babel-transformermetro-cachemetro-cache-keymetro-configmetro-coremetro-hermes-compilermetro-inspector-proxymetro-minify-uglifymetro-react-native-babel-transformermetro-resolvermetro-runtimemetro-source-mapmetro-symbolicatemetro-transform-pluginsmetro-transform-workermicromatchmimemime-dbmime-typesmimic-fnminimatchminimistmixin-deepmkdirpmsnanomatchnatural-comparenegotiatorneo-asyncnice-trynocachenode-dirnode-fetchnode-int64node-releasesnode-stream-zipnormalize-pathnpm-run-pathnullthrowsnwsapiob1object-assignobject-copyobject-keysobject-visitobject.assignobject.pickon-finishedon-headersonceonetimeopenoptionatoroptionsoraos-tmpdirp-finallyp-limitp-locatep-tryparse-jsonparse5parseurlpascalcasepath-existspath-is-absolutepath-keypath-parsepicocolorspicomatchpifypiratespkg-dirpkg-upplistposix-character-classesprelude-lspretty-formatprocess-nextick-argspromisepromptsprop-typespslpumppunycoderange-parserreact-devtools-corereact-isreact-native-codegenreact-refreshreadable-streamreadlinerecastregenerateregenerate-unicode-propertiesregenerator-runtimeregenerator-transformregex-notregexpu-coreregjsgenregjsparserremove-trailing-separatorrepeat-elementrepeat-stringrequire-directoryrequire-main-filenamereselectresolveresolve-cwdresolve-fromresolve-urlresolve.exportsrestore-cursorretrimrafrsvpsafe-buffersafe-regexsafer-buffersanesaxsaxesschedulersemversendserialize-errorserve-staticset-blockingset-valuesetprototypeofshallow-cloneshebang-commandshebang-regexshell-quoteshikisignal-exitsimple-plistsisteransislashslice-ansisnapdragonsnapdragon-nodesnapdragon-utilsource-mapsource-map-resolvesource-map-supportsource-map-urlsplit-stringsprintf-jsstack-utilsstackframestacktrace-parserstatic-extendstatusesstream-buffersstring_decoderstring-lengthstring-widthstrip-ansistrip-bomstrip-eofstrip-final-newlinestrip-json-commentssudo-promptsupports-colorsupports-hyperlinkssupports-preserve-symlinks-flagsymbol-treetempterminal-linktest-excludethroatthrough2tmplto-fast-propertiesto-object-pathto-regexto-regex-rangetoidentifiertough-cookietr46tslibtype-checktype-detecttype-festtypedarray-to-bufferuglify-esuglify-jsultronunicode-canonical-property-names-ecmascriptunicode-match-property-ecmascriptunicode-match-property-value-ecmascriptunicode-property-aliases-ecmascriptunion-valueuniversalifyunpipeunset-valueurixuseuse-subscriptionuse-sync-external-storeutil-deprecateutils-mergeuuidv8-to-istanbulvaryvlqvscode-onigurumavscode-textmatew3c-hr-timew3c-xmlserializerwalkerwcwidthwebidl-conversionswhatwg-encodingwhatwg-fetchwhatwg-mimetypewhatwg-urlwhichwhich-moduleword-wrapwordwrapwrap-ansiwrappywrite-file-atomicwsxcodexml-name-validatorxmlbuilderxmlcharsxmldocxtendy18nyallistyargsyargs-parser
1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago