├── .npmignore
├── Example
├── .watchmanconfig
├── .gitattributes
├── app.json
├── .eslintrc.js
├── babel.config.js
├── android
│ ├── .settings
│ │ └── org.eclipse.buildship.core.prefs
│ ├── app
│ │ ├── .settings
│ │ │ └── org.eclipse.buildship.core.prefs
│ │ ├── src
│ │ │ ├── main
│ │ │ │ ├── res
│ │ │ │ │ ├── values
│ │ │ │ │ │ ├── strings.xml
│ │ │ │ │ │ └── styles.xml
│ │ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ │ └── ic_launcher_round.png
│ │ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ │ └── ic_launcher_round.png
│ │ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ │ └── ic_launcher_round.png
│ │ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ │ └── ic_launcher_round.png
│ │ │ │ │ └── mipmap-xxxhdpi
│ │ │ │ │ │ ├── ic_launcher.png
│ │ │ │ │ │ └── ic_launcher_round.png
│ │ │ │ ├── java
│ │ │ │ │ └── com
│ │ │ │ │ │ └── example
│ │ │ │ │ │ ├── MainActivity.java
│ │ │ │ │ │ └── MainApplication.java
│ │ │ │ └── AndroidManifest.xml
│ │ │ └── debug
│ │ │ │ └── AndroidManifest.xml
│ │ ├── .classpath
│ │ ├── proguard-rules.pro
│ │ ├── build_defs.bzl
│ │ ├── .project
│ │ ├── BUCK
│ │ └── build.gradle
│ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ ├── settings.gradle
│ ├── .project
│ ├── gradle.properties
│ ├── build.gradle
│ ├── gradlew.bat
│ └── gradlew
├── ios
│ ├── Example
│ │ ├── Images.xcassets
│ │ │ ├── Contents.json
│ │ │ └── AppIcon.appiconset
│ │ │ │ └── Contents.json
│ │ ├── AppDelegate.h
│ │ ├── main.m
│ │ ├── AppDelegate.m
│ │ ├── Info.plist
│ │ └── Base.lproj
│ │ │ └── LaunchScreen.xib
│ ├── Example.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ ├── Share Intent
│ │ ├── ShareViewController.h
│ │ ├── Info.plist
│ │ ├── ShareViewController.m
│ │ └── Base.lproj
│ │ │ └── MainInterface.storyboard
│ ├── ExampleTests
│ │ ├── Info.plist
│ │ └── ExampleTests.m
│ ├── Example-tvOSTests
│ │ └── Info.plist
│ ├── Example-tvOS
│ │ └── Info.plist
│ ├── Podfile
│ ├── Example.xcodeproj
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ ├── Share Intent.xcscheme
│ │ │ ├── Example.xcscheme
│ │ │ └── Example-tvOS.xcscheme
│ └── Podfile.lock
├── .buckconfig
├── _prettierrc.js
├── index.js
├── __tests__
│ └── App-test.js
├── metro.config.js
├── App.js
├── package.json
├── .gitignore
├── Share.js
└── .flowconfig
├── android
├── build
│ ├── intermediates
│ │ ├── library_java_res
│ │ │ └── debug
│ │ │ │ └── res.jar
│ │ ├── annotation_processor_list
│ │ │ └── debug
│ │ │ │ └── annotationProcessors.json
│ │ ├── incremental
│ │ │ ├── packageDebugResources
│ │ │ │ ├── compile-file-map.properties
│ │ │ │ └── merger.xml
│ │ │ ├── debug-mergeJniLibs
│ │ │ │ └── merge-state
│ │ │ ├── mergeDebugShaders
│ │ │ │ └── merger.xml
│ │ │ ├── mergeDebugJniLibFolders
│ │ │ │ └── merger.xml
│ │ │ └── packageDebugAssets
│ │ │ │ └── merger.xml
│ │ ├── transforms
│ │ │ └── mergeJniLibs
│ │ │ │ └── debug
│ │ │ │ └── __content__.json
│ │ ├── compile_library_classes
│ │ │ └── debug
│ │ │ │ └── classes.jar
│ │ ├── runtime_library_classes
│ │ │ └── debug
│ │ │ │ └── classes.jar
│ │ ├── compile_only_not_namespaced_r_class_jar
│ │ │ └── debug
│ │ │ │ └── generateDebugRFile
│ │ │ │ └── R.jar
│ │ ├── javac
│ │ │ └── debug
│ │ │ │ └── compileDebugJavaWithJavac
│ │ │ │ └── classes
│ │ │ │ └── com
│ │ │ │ └── ajithab
│ │ │ │ ├── BuildConfig.class
│ │ │ │ ├── RNFileShareIntentModule.class
│ │ │ │ └── RNFileShareIntentPackage.class
│ │ ├── merged_manifests
│ │ │ ├── debugAndroidTest
│ │ │ │ ├── output.json
│ │ │ │ └── AndroidManifest.xml
│ │ │ └── debug
│ │ │ │ └── output.json
│ │ ├── aapt_friendly_merged_manifests
│ │ │ └── debug
│ │ │ │ └── aapt
│ │ │ │ ├── output.json
│ │ │ │ └── AndroidManifest.xml
│ │ └── library_manifest
│ │ │ └── debug
│ │ │ └── AndroidManifest.xml
│ ├── generated
│ │ └── source
│ │ │ └── buildConfig
│ │ │ ├── debug
│ │ │ └── com
│ │ │ │ └── ajithab
│ │ │ │ └── BuildConfig.java
│ │ │ └── androidTest
│ │ │ └── debug
│ │ │ └── com
│ │ │ └── ajithab
│ │ │ └── test
│ │ │ └── BuildConfig.java
│ └── outputs
│ │ └── logs
│ │ └── manifest-merger-debug-report.txt
├── .DS_Store
├── src
│ ├── .DS_Store
│ └── main
│ │ ├── .DS_Store
│ │ ├── java
│ │ ├── .DS_Store
│ │ └── com
│ │ │ ├── .DS_Store
│ │ │ └── ajithab
│ │ │ ├── RNFileShareIntentPackage.java
│ │ │ └── RNFileShareIntentModule.java
│ │ └── AndroidManifest.xml
├── .settings
│ └── org.eclipse.buildship.core.prefs
├── .project
├── build.gradle
├── README.md
└── react-native-file-share-intent.iml
├── .DS_Store
├── assets
├── ios.png
├── .DS_Store
├── android .png
├── appgroup.png
├── ios_intent.png
├── ios_setup_12.png
├── ios_step_01.png
├── ios_step_02.png
├── ios_step_03.png
├── ios_step_04.png
├── ios_step_05.png
├── ios_step_06.png
├── ios_step_07.png
├── ios_step_08.png
├── ios_step_09.png
├── ios_step_10.png
├── ios_step_11.png
└── android_intent.png
├── ios
├── .DS_Store
├── RNFileShareIntent.xcodeproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcuserdata
│ │ │ └── ajithab.xcuserdatad
│ │ │ │ └── UserInterfaceState.xcuserstate
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ ├── xcuserdata
│ │ └── ajithab.xcuserdatad
│ │ │ └── xcschemes
│ │ │ └── xcschememanagement.plist
│ └── project.pbxproj
├── RNFileShareIntent.xcworkspace
│ └── contents.xcworkspacedata
├── src
│ ├── RNFileShareIntent.h
│ └── RNFileShareIntent.m
├── RNFileShareIntent.podspec
└── README.md
├── index.js
├── .vscode
└── settings.json
├── package.json
└── README.md
/.npmignore:
--------------------------------------------------------------------------------
1 | Example/
--------------------------------------------------------------------------------
/Example/.watchmanconfig:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/Example/.gitattributes:
--------------------------------------------------------------------------------
1 | *.pbxproj -text
2 |
--------------------------------------------------------------------------------
/Example/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Example",
3 | "displayName": "Example"
4 | }
--------------------------------------------------------------------------------
/android/build/intermediates/library_java_res/debug/res.jar:
--------------------------------------------------------------------------------
1 | PK
--------------------------------------------------------------------------------
/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/.DS_Store
--------------------------------------------------------------------------------
/assets/ios.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/assets/ios.png
--------------------------------------------------------------------------------
/ios/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/ios/.DS_Store
--------------------------------------------------------------------------------
/assets/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/assets/.DS_Store
--------------------------------------------------------------------------------
/Example/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | extends: '@react-native-community',
4 | };
5 |
--------------------------------------------------------------------------------
/Example/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: ['module:metro-react-native-babel-preset'],
3 | };
4 |
--------------------------------------------------------------------------------
/android/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/android/.DS_Store
--------------------------------------------------------------------------------
/assets/android .png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/assets/android .png
--------------------------------------------------------------------------------
/assets/appgroup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/assets/appgroup.png
--------------------------------------------------------------------------------
/android/src/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/android/src/.DS_Store
--------------------------------------------------------------------------------
/assets/ios_intent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/assets/ios_intent.png
--------------------------------------------------------------------------------
/Example/android/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | connection.project.dir=
2 | eclipse.preferences.version=1
3 |
--------------------------------------------------------------------------------
/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties:
--------------------------------------------------------------------------------
1 | #Thu Aug 15 23:11:33 IST 2019
2 |
--------------------------------------------------------------------------------
/assets/ios_setup_12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/assets/ios_setup_12.png
--------------------------------------------------------------------------------
/assets/ios_step_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/assets/ios_step_01.png
--------------------------------------------------------------------------------
/assets/ios_step_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/assets/ios_step_02.png
--------------------------------------------------------------------------------
/assets/ios_step_03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/assets/ios_step_03.png
--------------------------------------------------------------------------------
/assets/ios_step_04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/assets/ios_step_04.png
--------------------------------------------------------------------------------
/assets/ios_step_05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/assets/ios_step_05.png
--------------------------------------------------------------------------------
/assets/ios_step_06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/assets/ios_step_06.png
--------------------------------------------------------------------------------
/assets/ios_step_07.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/assets/ios_step_07.png
--------------------------------------------------------------------------------
/assets/ios_step_08.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/assets/ios_step_08.png
--------------------------------------------------------------------------------
/assets/ios_step_09.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/assets/ios_step_09.png
--------------------------------------------------------------------------------
/assets/ios_step_10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/assets/ios_step_10.png
--------------------------------------------------------------------------------
/assets/ios_step_11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/assets/ios_step_11.png
--------------------------------------------------------------------------------
/Example/android/app/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | connection.project.dir=..
2 | eclipse.preferences.version=1
3 |
--------------------------------------------------------------------------------
/android/src/main/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/android/src/main/.DS_Store
--------------------------------------------------------------------------------
/assets/android_intent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/assets/android_intent.png
--------------------------------------------------------------------------------
/Example/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Example
3 |
4 |
--------------------------------------------------------------------------------
/Example/ios/Example/Images.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/android/src/main/java/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/android/src/main/java/.DS_Store
--------------------------------------------------------------------------------
/android/src/main/java/com/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/android/src/main/java/com/.DS_Store
--------------------------------------------------------------------------------
/Example/.buckconfig:
--------------------------------------------------------------------------------
1 |
2 | [android]
3 | target = Google Inc.:Google APIs:23
4 |
5 | [maven_repositories]
6 | central = https://repo1.maven.org/maven2
7 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 |
2 | import { NativeModules } from 'react-native';
3 | const { RNFileShareIntent } = NativeModules;
4 | export default RNFileShareIntent;
5 |
6 |
--------------------------------------------------------------------------------
/Example/_prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | bracketSpacing: false,
3 | jsxBracketSameLine: true,
4 | singleQuote: true,
5 | trailingComma: 'all',
6 | };
7 |
--------------------------------------------------------------------------------
/Example/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/Example/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/android/build/intermediates/transforms/mergeJniLibs/debug/__content__.json:
--------------------------------------------------------------------------------
1 | [{"name":"resources","index":0,"scopes":["PROJECT"],"types":["NATIVE_LIBS"],"format":"DIRECTORY","present":false}]
--------------------------------------------------------------------------------
/Example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/Example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/Example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/Example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "files.exclude": {
3 | "**/.classpath": true,
4 | "**/.project": true,
5 | "**/.settings": true,
6 | "**/.factorypath": true
7 | }
8 | }
--------------------------------------------------------------------------------
/Example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/Example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/Example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/Example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/Example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/Example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/Example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/Example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android/build/intermediates/compile_library_classes/debug/classes.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/android/build/intermediates/compile_library_classes/debug/classes.jar
--------------------------------------------------------------------------------
/android/build/intermediates/runtime_library_classes/debug/classes.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/android/build/intermediates/runtime_library_classes/debug/classes.jar
--------------------------------------------------------------------------------
/android/build/intermediates/incremental/debug-mergeJniLibs/merge-state:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/android/build/intermediates/incremental/debug-mergeJniLibs/merge-state
--------------------------------------------------------------------------------
/Example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'Example'
2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
3 | include ':app'
4 |
--------------------------------------------------------------------------------
/ios/RNFileShareIntent.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Example/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @format
3 | */
4 |
5 | import {AppRegistry} from 'react-native';
6 | import App from './App';
7 | import {name as appName} from './app.json';
8 |
9 | AppRegistry.registerComponent(appName, () => App);
10 |
--------------------------------------------------------------------------------
/android/build/intermediates/compile_only_not_namespaced_r_class_jar/debug/generateDebugRFile/R.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/android/build/intermediates/compile_only_not_namespaced_r_class_jar/debug/generateDebugRFile/R.jar
--------------------------------------------------------------------------------
/ios/RNFileShareIntent.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 |
3 |
5 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/ajithab/BuildConfig.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/ajithab/BuildConfig.class
--------------------------------------------------------------------------------
/ios/RNFileShareIntent.xcodeproj/project.xcworkspace/xcuserdata/ajithab.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/ios/RNFileShareIntent.xcodeproj/project.xcworkspace/xcuserdata/ajithab.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/ajithab/RNFileShareIntentModule.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/ajithab/RNFileShareIntentModule.class
--------------------------------------------------------------------------------
/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/ajithab/RNFileShareIntentPackage.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ajith-ab/react-native-file-share-intent/HEAD/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/ajithab/RNFileShareIntentPackage.class
--------------------------------------------------------------------------------
/ios/src/RNFileShareIntent.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | @interface RNFileShareIntent : NSObject
4 | +(void) setShareFileIntentModule_itemProvider: (NSItemProvider*) itemProvider;
5 | +(void) setContext: (NSExtensionContext*) context;
6 | @end
7 |
--------------------------------------------------------------------------------
/Example/ios/Example.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Example/ios/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/RNFileShareIntent.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Example/__tests__/App-test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @format
3 | */
4 |
5 | import 'react-native';
6 | import React from 'react';
7 | import App from '../App';
8 |
9 | // Note: test renderer must be required after react-native.
10 | import renderer from 'react-test-renderer';
11 |
12 | it('renders correctly', () => {
13 | renderer.create( );
14 | });
15 |
--------------------------------------------------------------------------------
/Example/ios/Share Intent/ShareViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ShareViewController.h
3 | // Share Intent
4 | //
5 | // Created by Ajith A B on 16/08/19.
6 | // Copyright © 2019 Facebook. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface ShareViewController : UIViewController
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/android/build/intermediates/merged_manifests/debugAndroidTest/output.json:
--------------------------------------------------------------------------------
1 | [{"outputType":{"type":"MERGED_MANIFESTS"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"react-native-file-share-intent-debug-androidTest.apk","fullName":"debugAndroidTest","baseName":"debug-androidTest"},"path":"AndroidManifest.xml","properties":{}}]
--------------------------------------------------------------------------------
/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output.json:
--------------------------------------------------------------------------------
1 | [{"outputType":{"type":"AAPT_FRIENDLY_MERGED_MANIFESTS"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"react-native-file-share-intent-debug.aar","fullName":"debug","baseName":"debug"},"path":"AndroidManifest.xml","properties":{"packageId":"com.ajithab","split":""}}]
--------------------------------------------------------------------------------
/android/build/intermediates/merged_manifests/debug/output.json:
--------------------------------------------------------------------------------
1 | [{"outputType":{"type":"MERGED_MANIFESTS"},"apkData":{"type":"MAIN","splits":[],"versionCode":1,"versionName":"1.0","enabled":true,"outputFile":"react-native-file-share-intent-debug.aar","fullName":"debug","baseName":"debug"},"path":"../../library_manifest/debug/AndroidManifest.xml","properties":{"packageId":"com.ajithab","split":""}}]
--------------------------------------------------------------------------------
/Example/android/app/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Example/metro.config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Metro configuration for React Native
3 | * https://github.com/facebook/react-native
4 | *
5 | * @format
6 | */
7 |
8 | module.exports = {
9 | transformer: {
10 | getTransformOptions: async () => ({
11 | transform: {
12 | experimentalImportSupport: false,
13 | inlineRequires: false,
14 | },
15 | }),
16 | },
17 | };
18 |
--------------------------------------------------------------------------------
/android/build/intermediates/library_manifest/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/android/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | arguments=
2 | auto.sync=false
3 | build.scans.enabled=false
4 | connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(5.4))
5 | connection.project.dir=
6 | eclipse.preferences.version=1
7 | gradle.user.home=
8 | java.home=
9 | jvm.arguments=
10 | offline.mode=false
11 | override.workspace.settings=true
12 | show.console.view=true
13 | show.executions.view=true
14 |
--------------------------------------------------------------------------------
/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/Example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Example/android/app/src/main/java/com/example/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import com.facebook.react.ReactActivity;
4 |
5 | public class MainActivity extends ReactActivity {
6 |
7 | /**
8 | * Returns the name of the main component registered from JavaScript.
9 | * This is used to schedule rendering of the component.
10 | */
11 | @Override
12 | protected String getMainComponentName() {
13 | return "Example";
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Example/ios/Example/AppDelegate.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Facebook, Inc. and its affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | #import
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (nonatomic, strong) UIWindow *window;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Example/ios/Example/main.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Facebook, Inc. and its affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | #import
9 |
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/ios/RNFileShareIntent.xcodeproj/xcuserdata/ajithab.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | RNFileShareIntent.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Example/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
--------------------------------------------------------------------------------
/android/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | android
4 | Project android created by Buildship.
5 |
6 |
7 |
8 |
9 | org.eclipse.buildship.core.gradleprojectbuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.buildship.core.gradleprojectnature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Example/android/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | Example
4 | Project android created by Buildship.
5 |
6 |
7 |
8 |
9 | org.eclipse.buildship.core.gradleprojectbuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.buildship.core.gradleprojectnature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/android/build/generated/source/buildConfig/debug/com/ajithab/BuildConfig.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Automatically generated file. DO NOT MODIFY
3 | */
4 | package com.ajithab;
5 |
6 | public final class BuildConfig {
7 | public static final boolean DEBUG = Boolean.parseBoolean("true");
8 | public static final String APPLICATION_ID = "com.ajithab";
9 | public static final String BUILD_TYPE = "debug";
10 | public static final String FLAVOR = "";
11 | public static final int VERSION_CODE = 1;
12 | public static final String VERSION_NAME = "1.0";
13 | }
14 |
--------------------------------------------------------------------------------
/android/build/generated/source/buildConfig/androidTest/debug/com/ajithab/test/BuildConfig.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Automatically generated file. DO NOT MODIFY
3 | */
4 | package com.ajithab.test;
5 |
6 | public final class BuildConfig {
7 | public static final boolean DEBUG = Boolean.parseBoolean("true");
8 | public static final String APPLICATION_ID = "com.ajithab.test";
9 | public static final String BUILD_TYPE = "debug";
10 | public static final String FLAVOR = "";
11 | public static final int VERSION_CODE = 1;
12 | public static final String VERSION_NAME = "1.0";
13 | }
14 |
--------------------------------------------------------------------------------
/android/build/intermediates/incremental/mergeDebugShaders/merger.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Example/android/app/build_defs.bzl:
--------------------------------------------------------------------------------
1 | """Helper definitions to glob .aar and .jar targets"""
2 |
3 | def create_aar_targets(aarfiles):
4 | for aarfile in aarfiles:
5 | name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")]
6 | lib_deps.append(":" + name)
7 | android_prebuilt_aar(
8 | name = name,
9 | aar = aarfile,
10 | )
11 |
12 | def create_jar_targets(jarfiles):
13 | for jarfile in jarfiles:
14 | name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")]
15 | lib_deps.append(":" + name)
16 | prebuilt_jar(
17 | name = name,
18 | binary_jar = jarfile,
19 | )
20 |
--------------------------------------------------------------------------------
/Example/android/app/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | app
4 | Project app created by Buildship.
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.buildship.core.gradleprojectbuilder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.jdt.core.javanature
21 | org.eclipse.buildship.core.gradleprojectnature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 |
2 | buildscript {
3 | repositories {
4 | jcenter()
5 | }
6 |
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.3.1'
9 | }
10 | }
11 |
12 | apply plugin: 'com.android.library'
13 |
14 | android {
15 | compileSdkVersion 23
16 | buildToolsVersion "23.0.1"
17 |
18 | defaultConfig {
19 | minSdkVersion 16
20 | targetSdkVersion 22
21 | versionCode 1
22 | versionName "1.0"
23 | }
24 | lintOptions {
25 | abortOnError false
26 | }
27 | }
28 |
29 | repositories {
30 | mavenCentral()
31 | }
32 |
33 | dependencies {
34 | implementation 'com.facebook.react:react-native:+'
35 | }
36 |
--------------------------------------------------------------------------------
/ios/RNFileShareIntent.podspec:
--------------------------------------------------------------------------------
1 |
2 | require 'json'
3 |
4 | package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
5 |
6 |
7 | Pod::Spec.new do |s|
8 | s.name = "RNFileShareIntent"
9 | s.version = package['version']
10 | s.summary = package['description']
11 | s.license = package['license']
12 |
13 | s.authors = package['author']
14 | s.homepage = package['homepage']
15 | s.platform = :ios, "7.0"
16 | s.source = { :git => "https://github.com/author/RNFileShareIntent.git", :tag => "master" }
17 | s.source_files = "RNFileShareIntent/**/*.{h,m}"
18 | s.requires_arc = true
19 |
20 |
21 | s.dependency "React"
22 | #s.dependency "others"
23 |
24 | end
25 |
26 |
27 |
--------------------------------------------------------------------------------
/android/build/intermediates/incremental/packageDebugAssets/merger.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Example/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import {Text,View} from 'react-native';
3 |
4 | import RNFileShareIntent from 'react-native-file-share-intent';
5 |
6 | export default class App extends Component {
7 | constructor(props) {
8 | super(props);
9 | this.state = {
10 | fileUrl: null,
11 | };
12 | }
13 |
14 | componentDidMount() {
15 | if(RNFileShareIntent){
16 | RNFileShareIntent.getFilepath((url) => {
17 | this.setState({ fileUrl: url });
18 | })
19 | }
20 |
21 | }
22 | render() {
23 | var uri = this.state.fileUrl;
24 | return (
25 |
26 | Shared Url: {uri}
27 |
28 | );
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Example/ios/Example/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | }
33 | ],
34 | "info" : {
35 | "version" : 1,
36 | "author" : "xcode"
37 | }
38 | }
--------------------------------------------------------------------------------
/Example/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Example",
3 | "version": "0.0.1",
4 | "private": true,
5 | "scripts": {
6 | "start": "react-native start",
7 | "test": "jest",
8 | "lint": "eslint ."
9 | },
10 | "dependencies": {
11 | "react": "16.8.6",
12 | "react-native": "0.60.5",
13 | "react-native-file-share-intent": "^1.0.7",
14 | "react-native-share-extension": "^2.0.0"
15 | },
16 | "devDependencies": {
17 | "@babel/core": "7.5.5",
18 | "@babel/runtime": "7.5.5",
19 | "@react-native-community/eslint-config": "0.0.3",
20 | "babel-jest": "24.8.0",
21 | "eslint": "6.1.0",
22 | "jest": "24.8.0",
23 | "metro-react-native-babel-preset": "0.54.1",
24 | "react-test-renderer": "16.8.6"
25 | },
26 | "jest": {
27 | "preset": "react-native"
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-file-share-intent",
3 | "version": "1.1.3",
4 | "description": "Adds the app to share menu, so it can be launched from share menu and receive data from other apps",
5 | "main": "",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "repository": {
10 | "type": "git",
11 | "url": "git+https://github.com/ajith-ab/react-native-file-share-intent.git"
12 | },
13 | "keywords": [
14 | "ios",
15 | "android",
16 | "react-native",
17 | "share",
18 | "extension"
19 | ],
20 | "author": "Ajith A B",
21 | "license": "ISC",
22 | "bugs": {
23 | "url": "https://github.com/ajith-ab/react-native-file-share-intent/issues"
24 | },
25 | "homepage": "https://github.com/ajith-ab/react-native-file-share-intent#readme"
26 | }
27 |
--------------------------------------------------------------------------------
/Example/ios/ExampleTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/android/build/intermediates/merged_manifests/debugAndroidTest/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
15 |
16 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Example/ios/Example-tvOSTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
20 | android.useAndroidX=true
21 | android.enableJetifier=true
22 |
--------------------------------------------------------------------------------
/Example/.gitignore:
--------------------------------------------------------------------------------
1 | # OSX
2 | #
3 | .DS_Store
4 |
5 | # Xcode
6 | #
7 | build/
8 | *.pbxuser
9 | !default.pbxuser
10 | *.mode1v3
11 | !default.mode1v3
12 | *.mode2v3
13 | !default.mode2v3
14 | *.perspectivev3
15 | !default.perspectivev3
16 | xcuserdata
17 | *.xccheckout
18 | *.moved-aside
19 | DerivedData
20 | *.hmap
21 | *.ipa
22 | *.xcuserstate
23 | project.xcworkspace
24 |
25 | # Android/IntelliJ
26 | #
27 | build/
28 | .idea
29 | .gradle
30 | local.properties
31 | *.iml
32 |
33 | # node.js
34 | #
35 | node_modules/
36 | npm-debug.log
37 | yarn-error.log
38 |
39 | # BUCK
40 | buck-out/
41 | \.buckd/
42 | *.keystore
43 |
44 | # fastlane
45 | #
46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47 | # screenshots whenever they are needed.
48 | # For more information about the recommended setup visit:
49 | # https://docs.fastlane.tools/best-practices/source-control/
50 |
51 | */fastlane/report.xml
52 | */fastlane/Preview.html
53 | */fastlane/screenshots
54 |
55 | # Bundle artifact
56 | *.jsbundle
57 |
58 | # CocoaPods
59 | /ios/Pods/
60 |
--------------------------------------------------------------------------------
/Example/android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext {
5 | buildToolsVersion = "28.0.3"
6 | minSdkVersion = 16
7 | compileSdkVersion = 28
8 | targetSdkVersion = 28
9 | supportLibVersion = "28.0.0"
10 | }
11 | repositories {
12 | google()
13 | jcenter()
14 | }
15 | dependencies {
16 | classpath("com.android.tools.build:gradle:3.4.1")
17 |
18 | // NOTE: Do not place your application dependencies here; they belong
19 | // in the individual module build.gradle files
20 | }
21 | }
22 |
23 | allprojects {
24 | repositories {
25 | mavenLocal()
26 | maven {
27 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
28 | url("$rootDir/../node_modules/react-native/android")
29 | }
30 | maven {
31 | // Android JSC is installed from npm
32 | url("$rootDir/../node_modules/jsc-android/dist")
33 | }
34 |
35 | google()
36 | jcenter()
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
13 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/android/src/main/java/com/ajithab/RNFileShareIntentPackage.java:
--------------------------------------------------------------------------------
1 |
2 | package com.ajithab;
3 |
4 | import java.util.ArrayList;
5 | import java.util.Arrays;
6 | import java.util.Collections;
7 | import java.util.List;
8 |
9 | import com.facebook.react.ReactPackage;
10 | import com.facebook.react.bridge.NativeModule;
11 | import com.facebook.react.bridge.ReactApplicationContext;
12 | import com.facebook.react.uimanager.ViewManager;
13 | import com.facebook.react.bridge.JavaScriptModule;
14 |
15 | import com.ajithab.RNFileShareIntentModule;
16 |
17 | public class RNFileShareIntentPackage implements ReactPackage {
18 | // @Override
19 | // public List createNativeModules(ReactApplicationContext reactContext) {
20 | // return Arrays.asList(new RNFileShareIntentModule(reactContext));
21 | // }
22 |
23 | // Deprecated from RN 0.47
24 | public List> createJSModules() {
25 | return Collections.emptyList();
26 | }
27 |
28 | @Override
29 | public List createNativeModules(ReactApplicationContext reactContext) {
30 | List modules = new ArrayList<>();
31 | modules.add(new RNFileShareIntentModule(reactContext));
32 | return modules;
33 | }
34 |
35 | @Override
36 | public List createViewManagers(ReactApplicationContext reactContext) {
37 | return Collections.emptyList();
38 | }
39 | }
--------------------------------------------------------------------------------
/Example/android/app/BUCK:
--------------------------------------------------------------------------------
1 | # To learn about Buck see [Docs](https://buckbuild.com/).
2 | # To run your application with Buck:
3 | # - install Buck
4 | # - `npm start` - to start the packager
5 | # - `cd android`
6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8 | # - `buck install -r android/app` - compile, install and run application
9 | #
10 |
11 | load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
12 |
13 | lib_deps = []
14 |
15 | create_aar_targets(glob(["libs/*.aar"]))
16 |
17 | create_jar_targets(glob(["libs/*.jar"]))
18 |
19 | android_library(
20 | name = "all-libs",
21 | exported_deps = lib_deps,
22 | )
23 |
24 | android_library(
25 | name = "app-code",
26 | srcs = glob([
27 | "src/main/java/**/*.java",
28 | ]),
29 | deps = [
30 | ":all-libs",
31 | ":build_config",
32 | ":res",
33 | ],
34 | )
35 |
36 | android_build_config(
37 | name = "build_config",
38 | package = "com.example",
39 | )
40 |
41 | android_resource(
42 | name = "res",
43 | package = "com.example",
44 | res = "src/main/res",
45 | )
46 |
47 | android_binary(
48 | name = "app",
49 | keystore = "//android/keystores:debug",
50 | manifest = "src/main/AndroidManifest.xml",
51 | package_type = "debug",
52 | deps = [
53 | ":app-code",
54 | ],
55 | )
56 |
--------------------------------------------------------------------------------
/Example/Share.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { View, Text, AppRegistry, StyleSheet, Button } from 'react-native';
3 | import RNFileShareIntent from 'react-native-file-share-intent';
4 | export default class Share extends Component {
5 | constructor(props) {
6 | super(props);
7 | this.state = {
8 | sharedText: null
9 | };
10 | }
11 | componentDidMount() {
12 | var that = this;
13 | RNFileShareIntent.getFilePath((text) => {
14 | that.setState({ sharedText: text });
15 |
16 | })
17 | }
18 |
19 | render() {
20 | var url = this.state.sharedText;
21 | return (
22 |
23 | Shared file Path: {url}
24 | RNFileShareIntent.openURL(url)}
28 | />
29 | RNFileShareIntent.close()}
33 | />
34 |
35 | )
36 | }
37 | }
38 |
39 | const styles = StyleSheet.create({
40 | text: {
41 | color: 'black',
42 | backgroundColor: 'white',
43 | fontSize: 30,
44 | margin: 80
45 | }
46 | });
47 |
48 | AppRegistry.registerComponent('Share', () => Share);
49 |
--------------------------------------------------------------------------------
/Example/ios/Share Intent/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | Share Intent
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | XPC!
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleVersion
22 | 1
23 | NSExtension
24 |
25 | NSExtensionAttributes
26 |
27 | NSExtensionActivationRule
28 | TRUEPREDICATE
29 |
30 | NSExtensionMainStoryboard
31 | MainInterface
32 | NSExtensionPointIdentifier
33 | com.apple.share-services
34 |
35 |
36 | NSAppTransportSecurity
37 |
38 | NSExceptionDomains
39 |
40 | localhost
41 |
42 | NSTemporaryExceptionAllowsInsecureHTTPLoads
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/Example/ios/Example/AppDelegate.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Facebook, Inc. and its affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | #import "AppDelegate.h"
9 |
10 | #import
11 | #import
12 | #import
13 |
14 | @implementation AppDelegate
15 |
16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
17 | {
18 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
19 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
20 | moduleName:@"Example"
21 | initialProperties:nil];
22 |
23 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
24 |
25 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
26 | UIViewController *rootViewController = [UIViewController new];
27 | rootViewController.view = rootView;
28 | self.window.rootViewController = rootViewController;
29 | [self.window makeKeyAndVisible];
30 | return YES;
31 | }
32 |
33 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
34 | {
35 | #if DEBUG
36 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
37 | #else
38 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
39 | #endif
40 | }
41 |
42 | @end
43 |
--------------------------------------------------------------------------------
/Example/android/app/src/main/java/com/example/MainApplication.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import android.app.Application;
4 | import android.util.Log;
5 |
6 | import com.facebook.react.PackageList;
7 | import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
8 | import com.facebook.react.bridge.JavaScriptExecutorFactory;
9 | import com.facebook.react.ReactApplication;
10 | import com.facebook.react.ReactNativeHost;
11 | import com.facebook.react.ReactPackage;
12 | import com.facebook.soloader.SoLoader;
13 |
14 | import java.util.List;
15 |
16 | public class MainApplication extends Application implements ReactApplication {
17 |
18 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
19 | @Override
20 | public boolean getUseDeveloperSupport() {
21 | return BuildConfig.DEBUG;
22 | }
23 |
24 | @Override
25 | protected List getPackages() {
26 | @SuppressWarnings("UnnecessaryLocalVariable")
27 | List packages = new PackageList(this).getPackages();
28 | // Packages that cannot be autolinked yet can be added manually here, for example:
29 | // packages.add(new MyReactNativePackage());
30 | return packages;
31 | }
32 |
33 | @Override
34 | protected String getJSMainModuleName() {
35 | return "index";
36 | }
37 | };
38 |
39 | @Override
40 | public ReactNativeHost getReactNativeHost() {
41 | return mReactNativeHost;
42 | }
43 |
44 | @Override
45 | public void onCreate() {
46 | super.onCreate();
47 | SoLoader.init(this, /* native exopackage */ false);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/Example/ios/Share Intent/ShareViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ShareViewController.m
3 | // Share Intent
4 | //
5 | // Created by Ajith A B on 16/08/19.
6 | // Copyright © 2019 Facebook. All rights reserved.
7 | //
8 | #import "ShareViewController.h"
9 | #import "RCTRootView.h"
10 | #import "RCTBundleURLProvider.h"
11 | #import "RNFileShareIntent.h"
12 |
13 | @interface ShareViewController ()
14 |
15 | @end
16 |
17 | @implementation ShareViewController
18 |
19 | - (void) loadView
20 | {
21 | NSURL *jsCodeLocation;
22 |
23 | NSExtensionItem *item = self.extensionContext.inputItems.firstObject;
24 | NSItemProvider *itemProvider = item.attachments.firstObject;
25 | [RNFileShareIntent setShareFileIntentModule_itemProvider:itemProvider];
26 | [RNFileShareIntent setContext: self.extensionContext];
27 |
28 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"Share" fallbackResource:nil];
29 |
30 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
31 | moduleName:@"Share"
32 | initialProperties:nil
33 | launchOptions:nil];
34 | self.view = rootView;
35 | }
36 |
37 | // animate (IN)
38 | - (void)viewWillAppear:(BOOL)animated
39 | {
40 | [super viewWillAppear:animated];
41 |
42 | self.view.transform = CGAffineTransformMakeTranslation(0, self.view.frame.size.height);
43 | [UIView animateWithDuration:0.25 animations:^
44 | {
45 | self.view.transform = CGAffineTransformIdentity;
46 | }];
47 | }
48 |
49 |
50 | @end
51 |
--------------------------------------------------------------------------------
/Example/ios/Example-tvOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | NSAppTransportSecurity
26 |
27 | NSExceptionDomains
28 |
29 | localhost
30 |
31 | NSExceptionAllowsInsecureHTTPLoads
32 |
33 |
34 |
35 |
36 | NSLocationWhenInUseUsageDescription
37 |
38 | UILaunchStoryboardName
39 | LaunchScreen
40 | UIRequiredDeviceCapabilities
41 |
42 | armv7
43 |
44 | UISupportedInterfaceOrientations
45 |
46 | UIInterfaceOrientationPortrait
47 | UIInterfaceOrientationLandscapeLeft
48 | UIInterfaceOrientationLandscapeRight
49 |
50 | UIViewControllerBasedStatusBarAppearance
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/Example/ios/Share Intent/Base.lproj/MainInterface.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Example/ios/Example/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | Example
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | LSRequiresIPhoneOS
26 |
27 | NSAppTransportSecurity
28 |
29 | NSAllowsArbitraryLoads
30 |
31 | NSExceptionDomains
32 |
33 | localhost
34 |
35 | NSExceptionAllowsInsecureHTTPLoads
36 |
37 |
38 |
39 |
40 | NSLocationWhenInUseUsageDescription
41 |
42 | UILaunchStoryboardName
43 | LaunchScreen
44 | UIRequiredDeviceCapabilities
45 |
46 | armv7
47 |
48 | UISupportedInterfaceOrientations
49 |
50 | UIInterfaceOrientationPortrait
51 | UIInterfaceOrientationLandscapeLeft
52 | UIInterfaceOrientationLandscapeRight
53 |
54 | UIViewControllerBasedStatusBarAppearance
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/android/build/intermediates/incremental/packageDebugResources/merger.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Example/ios/ExampleTests/ExampleTests.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Facebook, Inc. and its affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | #import
9 | #import
10 |
11 | #import
12 | #import
13 |
14 | #define TIMEOUT_SECONDS 600
15 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
16 |
17 | @interface ExampleTests : XCTestCase
18 |
19 | @end
20 |
21 | @implementation ExampleTests
22 |
23 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
24 | {
25 | if (test(view)) {
26 | return YES;
27 | }
28 | for (UIView *subview in [view subviews]) {
29 | if ([self findSubviewInView:subview matching:test]) {
30 | return YES;
31 | }
32 | }
33 | return NO;
34 | }
35 |
36 | - (void)testRendersWelcomeScreen
37 | {
38 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
39 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
40 | BOOL foundElement = NO;
41 |
42 | __block NSString *redboxError = nil;
43 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
44 | if (level >= RCTLogLevelError) {
45 | redboxError = message;
46 | }
47 | });
48 |
49 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
50 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
51 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
52 |
53 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
54 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
55 | return YES;
56 | }
57 | return NO;
58 | }];
59 | }
60 |
61 | RCTSetLogFunction(RCTDefaultLogFunction);
62 |
63 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
64 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
65 | }
66 |
67 |
68 | @end
69 |
--------------------------------------------------------------------------------
/Example/ios/Podfile:
--------------------------------------------------------------------------------
1 | platform :ios, '9.0'
2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
3 |
4 | target 'Example' do
5 | # Pods for Example
6 | pod 'React', :path => '../node_modules/react-native/'
7 | pod 'React-Core', :path => '../node_modules/react-native/React'
8 | pod 'React-DevSupport', :path => '../node_modules/react-native/React'
9 | pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
10 | pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
11 | pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
12 | pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
13 | pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
14 | pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
15 | pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
16 | pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
17 | pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
18 | pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'
19 |
20 | pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
21 | pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
22 | pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
23 | pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
24 | pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
25 |
26 | pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
27 | pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
28 | pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
29 |
30 | target 'ExampleTests' do
31 | inherit! :search_paths
32 | # Pods for testing
33 | end
34 |
35 | use_native_modules!
36 | end
37 |
38 | target 'Example-tvOS' do
39 | # Pods for Example-tvOS
40 |
41 | target 'Example-tvOSTests' do
42 | inherit! :search_paths
43 | # Pods for testing
44 | end
45 |
46 | end
47 |
--------------------------------------------------------------------------------
/android/README.md:
--------------------------------------------------------------------------------
1 | # react-native-file-share-intent
2 |
3 | Adds the application to the share intent of the device, so it can be launched from other apps and receive data from them
4 |
5 |
6 | ## Installation
7 |
8 | * Install the module
9 |
10 | ```bash
11 | npm i --save react-native-file-share-intent
12 | ```
13 |
14 | ## Android Installation
15 |
16 | * In `android/settings.gradle`
17 |
18 | ```gradle
19 | ...
20 | include ':react-native-file-share-intent', ':app'
21 | project(':react-native-file-share-intent').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-file-share-intent/android')
22 | ```
23 |
24 | * In `android/app/build.gradle`
25 |
26 | ```gradle
27 | ...
28 | dependencies {
29 | ...
30 | compile project(':react-native-file-share-intent')
31 | }
32 | ```
33 |
34 | * In `android/app/src/main/AndroidManifest.xml` in the `` tag:
35 | Add What ever Want to share MIME Type so only include you want to share your App
36 |
37 |
38 | ```xml
39 |
42 | ...
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | ```
52 |
53 | * Register module (in MainApplication.java)
54 |
55 | ```java
56 | import com.ajithab.RNFileShareIntentPackage; // <--- import
57 |
58 | public class MainApplication extends Application implements ReactApplication {
59 | ......
60 | @Override
61 | protected List getPackages() {
62 | return Arrays.asList(
63 | new MainReactPackage(),
64 | new RNFileShareIntentPackage() // <------ add here
65 | );
66 | }
67 | ......
68 |
69 | }
70 | ```
71 |
72 | ### Donate
73 |
74 |
75 |
76 |
77 |
78 | ## Example
79 |
80 |
81 | App.js
82 |
83 | ```javascript
84 | import React, { Component } from 'react';
85 | import {Text,View} from 'react-native';
86 |
87 | import RNFileShareIntent from 'react-native-file-share-intent';
88 |
89 | export default class App extends Component {
90 | constructor(props) {
91 | super(props);
92 | this.state = {
93 | fileUrl: null,
94 | };
95 | }
96 |
97 | componentDidMount() {
98 | if(RNFileShareIntent){
99 | RNFileShareIntent.getFilepath((url) => {
100 | this.setState({ fileUrl: url });
101 | })
102 | }
103 |
104 | }
105 | render() {
106 | var uri = this.state.fileUrl;
107 | return (
108 |
109 | Shared Url: {uri}
110 |
111 | );
112 | }
113 | }
114 |
115 | ```
116 |
117 |
118 |
119 |
120 | ## Credits
121 |
122 | Sponsored and developed by Ajith A B
123 |
--------------------------------------------------------------------------------
/android/src/main/java/com/ajithab/RNFileShareIntentModule.java:
--------------------------------------------------------------------------------
1 |
2 | package com.ajithab;
3 |
4 | import com.facebook.react.bridge.ReactApplicationContext;
5 | import com.facebook.react.bridge.ReactContextBaseJavaModule;
6 | import com.facebook.react.bridge.ReactMethod;
7 | import com.facebook.react.bridge.Callback;
8 |
9 | import com.ajithab.RNFileShareIntentPackage;
10 |
11 | import java.util.Map;
12 | import java.util.ArrayList;
13 |
14 | import android.widget.Toast;
15 | import android.app.Activity;
16 | import android.content.Intent;
17 | import android.net.Uri;
18 |
19 |
20 | public class RNFileShareIntentModule extends ReactContextBaseJavaModule {
21 |
22 | private final ReactApplicationContext reactContext;
23 |
24 | public RNFileShareIntentModule(ReactApplicationContext reactContext) {
25 | super(reactContext);
26 | this.reactContext = reactContext;
27 | }
28 |
29 |
30 | protected void onNewIntent(Intent intent) {
31 | Activity mActivity = getCurrentActivity();
32 |
33 | if(mActivity == null) { return; }
34 |
35 | mActivity.setIntent(intent);
36 | }
37 |
38 | @ReactMethod
39 | public void getFilepath(Callback successCallback) {
40 | Activity mActivity = getCurrentActivity();
41 |
42 | if(mActivity == null) { return; }
43 |
44 | Intent intent = mActivity.getIntent();
45 | String action = intent.getAction();
46 | String type = intent.getType();
47 |
48 | if (Intent.ACTION_SEND.equals(action) && type != null) {
49 | if ("text/plain".equals(type)) {
50 | String input = intent.getStringExtra(Intent.EXTRA_TEXT);
51 | successCallback.invoke(input);
52 | } else if (type.startsWith("image/") || type.startsWith("video/") || type.startsWith("application/")) {
53 | Uri fileUri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
54 | if (fileUri != null) {
55 | successCallback.invoke(fileUri.toString());
56 | }
57 | }else {
58 | Toast.makeText(reactContext, "Type is not support", Toast.LENGTH_SHORT).show();
59 | }
60 | } else if (Intent.ACTION_SEND_MULTIPLE.equals(action) && type != null) {
61 | if (type.startsWith("image/") || type.startsWith("video/") || type.startsWith("application/")) {
62 | ArrayList fileUris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
63 | if (fileUris != null) {
64 | String completeString = new String();
65 | for (Uri uri: fileUris) {
66 | completeString += uri.toString() + ",";
67 | }
68 | successCallback.invoke(completeString);
69 | }
70 | } else {
71 | Toast.makeText(reactContext, "Type is not support", Toast.LENGTH_SHORT).show();
72 | }
73 | }
74 | }
75 |
76 | @ReactMethod
77 | public void clearFilePath() {
78 | Activity mActivity = getCurrentActivity();
79 |
80 | if(mActivity == null) { return; }
81 |
82 | Intent intent = mActivity.getIntent();
83 | String type = intent.getType();
84 | if ("text/plain".equals(type)) {
85 | intent.removeExtra(Intent.EXTRA_TEXT);
86 | } else if (type.startsWith("image/") || type.startsWith("video/") || type.startsWith("application/")) {
87 | intent.removeExtra(Intent.EXTRA_STREAM);
88 | }
89 | }
90 | @Override
91 | public String getName() {
92 | return "RNFileShareIntent";
93 | }
94 | }
--------------------------------------------------------------------------------
/Example/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem http://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
34 |
35 | @rem Find java.exe
36 | if defined JAVA_HOME goto findJavaFromJavaHome
37 |
38 | set JAVA_EXE=java.exe
39 | %JAVA_EXE% -version >NUL 2>&1
40 | if "%ERRORLEVEL%" == "0" goto init
41 |
42 | echo.
43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
44 | echo.
45 | echo Please set the JAVA_HOME variable in your environment to match the
46 | echo location of your Java installation.
47 |
48 | goto fail
49 |
50 | :findJavaFromJavaHome
51 | set JAVA_HOME=%JAVA_HOME:"=%
52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
53 |
54 | if exist "%JAVA_EXE%" goto init
55 |
56 | echo.
57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
58 | echo.
59 | echo Please set the JAVA_HOME variable in your environment to match the
60 | echo location of your Java installation.
61 |
62 | goto fail
63 |
64 | :init
65 | @rem Get command-line arguments, handling Windows variants
66 |
67 | if not "%OS%" == "Windows_NT" goto win9xME_args
68 |
69 | :win9xME_args
70 | @rem Slurp the command line arguments.
71 | set CMD_LINE_ARGS=
72 | set _SKIP=2
73 |
74 | :win9xME_args_slurp
75 | if "x%~1" == "x" goto execute
76 |
77 | set CMD_LINE_ARGS=%*
78 |
79 | :execute
80 | @rem Setup the command line
81 |
82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
83 |
84 | @rem Execute Gradle
85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
86 |
87 | :end
88 | @rem End local scope for the variables with windows NT shell
89 | if "%ERRORLEVEL%"=="0" goto mainEnd
90 |
91 | :fail
92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
93 | rem the _cmd.exe /c_ return code!
94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
95 | exit /b 1
96 |
97 | :mainEnd
98 | if "%OS%"=="Windows_NT" endlocal
99 |
100 | :omega
101 |
--------------------------------------------------------------------------------
/Example/.flowconfig:
--------------------------------------------------------------------------------
1 | [ignore]
2 | ; We fork some components by platform
3 | .*/*[.]android.js
4 |
5 | ; Ignore "BUCK" generated dirs
6 | /\.buckd/
7 |
8 | ; Ignore unexpected extra "@providesModule"
9 | .*/node_modules/.*/node_modules/fbjs/.*
10 |
11 | ; Ignore duplicate module providers
12 | ; For RN Apps installed via npm, "Libraries" folder is inside
13 | ; "node_modules/react-native" but in the source repo it is in the root
14 | node_modules/react-native/Libraries/react-native/React.js
15 |
16 | ; Ignore polyfills
17 | node_modules/react-native/Libraries/polyfills/.*
18 |
19 | ; These should not be required directly
20 | ; require from fbjs/lib instead: require('fbjs/lib/warning')
21 | node_modules/warning/.*
22 |
23 | ; Flow doesn't support platforms
24 | .*/Libraries/Utilities/HMRLoadingView.js
25 |
26 | [untyped]
27 | .*/node_modules/@react-native-community/cli/.*/.*
28 |
29 | [include]
30 |
31 | [libs]
32 | node_modules/react-native/Libraries/react-native/react-native-interface.js
33 | node_modules/react-native/flow/
34 |
35 | [options]
36 | emoji=true
37 |
38 | esproposal.optional_chaining=enable
39 | esproposal.nullish_coalescing=enable
40 |
41 | module.file_ext=.js
42 | module.file_ext=.json
43 | module.file_ext=.ios.js
44 |
45 | module.system=haste
46 | module.system.haste.use_name_reducers=true
47 | # get basename
48 | module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
49 | # strip .js or .js.flow suffix
50 | module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
51 | # strip .ios suffix
52 | module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
53 | module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
54 | module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
55 | module.system.haste.paths.blacklist=.*/__tests__/.*
56 | module.system.haste.paths.blacklist=.*/__mocks__/.*
57 | module.system.haste.paths.whitelist=/node_modules/react-native/Libraries/.*
58 | module.system.haste.paths.whitelist=/node_modules/react-native/RNTester/.*
59 | module.system.haste.paths.whitelist=/node_modules/react-native/IntegrationTests/.*
60 | module.system.haste.paths.blacklist=/node_modules/react-native/Libraries/react-native/react-native-implementation.js
61 | module.system.haste.paths.blacklist=/node_modules/react-native/Libraries/Animated/src/polyfills/.*
62 |
63 | munge_underscores=true
64 |
65 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
66 |
67 | suppress_type=$FlowIssue
68 | suppress_type=$FlowFixMe
69 | suppress_type=$FlowFixMeProps
70 | suppress_type=$FlowFixMeState
71 |
72 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
73 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
74 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
75 |
76 | [lints]
77 | sketchy-null-number=warn
78 | sketchy-null-mixed=warn
79 | sketchy-number=warn
80 | untyped-type-import=warn
81 | nonstrict-import=warn
82 | deprecated-type=warn
83 | unsafe-getters-setters=warn
84 | inexact-spread=warn
85 | unnecessary-invariant=warn
86 | signature-verification-failure=warn
87 | deprecated-utility=error
88 |
89 | [strict]
90 | deprecated-type
91 | nonstrict-import
92 | sketchy-null
93 | unclear-type
94 | unsafe-getters-setters
95 | untyped-import
96 | untyped-type-import
97 |
98 | [version]
99 | ^0.98.0
100 |
--------------------------------------------------------------------------------
/Example/ios/Example/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/android/build/outputs/logs/manifest-merger-debug-report.txt:
--------------------------------------------------------------------------------
1 | -- Merging decision tree log ---
2 | manifest
3 | ADDED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml:2:1-5:12
4 | INJECTED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml:2:1-5:12
5 | INJECTED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml:2:1-5:12
6 | INJECTED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml:2:1-5:12
7 | INJECTED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml:2:1-5:12
8 | INJECTED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml:2:1-5:12
9 | INJECTED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml:2:1-5:12
10 | package
11 | ADDED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml:3:11-32
12 | INJECTED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml
13 | INJECTED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml
14 | android:versionName
15 | INJECTED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml
16 | ADDED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml:2:1-5:12
17 | INJECTED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml
18 | android:versionCode
19 | INJECTED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml
20 | ADDED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml:2:1-5:12
21 | INJECTED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml
22 | xmlns:android
23 | ADDED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml:2:11-69
24 | uses-sdk
25 | INJECTED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml reason: use-sdk injection requested
26 | INJECTED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml
27 | INJECTED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml
28 | INJECTED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml
29 | INJECTED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml
30 | android:targetSdkVersion
31 | INJECTED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml
32 | ADDED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml
33 | INJECTED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml
34 | android:minSdkVersion
35 | INJECTED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml
36 | ADDED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml
37 | INJECTED from /Users/ajithab/Desktop/Example/node_modules/react-native-file-share-intent/android/src/main/AndroidManifest.xml
38 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # :warning: This Repository Has been changed
2 |
3 | ### new package :- [react-native-receive-sharing-intent](https://www.npmjs.com/package/react-native-receive-sharing-intent)
4 |
5 | :star: :star: :star: :star:
6 |
7 |
8 | ## Demo
9 |
10 | - React Native > 0.60 Support
11 | - Easy implimentation
12 | - Ios Directly Open Host app
13 | - Multiple Files Share Both ios and Android
14 |
15 | | Android | Ios |
16 | | :---: | :---: |
17 | |  |  |
18 |
19 |
20 | # react-native-file-share-intent
21 |
22 | Adds the application to the share intent of the device, so it can be launched from other apps and receive data from them
23 |
24 |
25 |
26 |
27 | ## Installation
28 |
29 | * Install the module
30 |
31 | ```bash
32 | npm i --save react-native-file-share-intent
33 | ```
34 |
35 | ### Automatic Installation (React Native 0.36 - 0.59.9)
36 |
37 | At the command line, in the project directory: only For `Android` and in `ios` use Manual installation
38 |
39 | ```bash
40 | react-native link
41 | ```
42 |
43 | ### Manual Installation
44 | - IOS
45 | - Android
46 |
47 |
48 | ### Donate
49 |
50 |
51 |
52 |
53 | ## Example
54 |
55 | ### For Android
56 |
57 | App.js
58 |
59 | ```javascript
60 | import React, { Component } from 'react';
61 | import {Text,View} from 'react-native';
62 |
63 | import RNFileShareIntent from 'react-native-file-share-intent';
64 |
65 | export default class App extends Component {
66 | constructor(props) {
67 | super(props);
68 | this.state = {
69 | fileUrl: null,
70 | };
71 | }
72 |
73 | componentDidMount() {
74 | if(RNFileShareIntent){
75 | RNFileShareIntent.getFilepath((url) => {
76 | this.setState({ fileUrl: url });
77 | })
78 | }
79 |
80 | }
81 | render() {
82 | var uri = this.state.fileUrl;
83 | return (
84 |
85 | Shared Url: {uri}
86 |
87 | );
88 | }
89 | }
90 |
91 | ```
92 |
93 | ### For IOS Share Extension View
94 |
95 | Share.js in the Root Folder
96 |
97 | ```javascript
98 | import React, { Component } from 'react';
99 | import { View, Text, AppRegistry, StyleSheet, Button } from 'react-native';
100 | import RNFileShareIntent from 'react-native-file-share-intent';
101 | export default class Share extends Component {
102 | constructor(props) {
103 | super(props);
104 | this.state = {
105 | sharedText: null
106 | };
107 | }
108 | componentDidMount() {
109 | var that = this;
110 | RNFileShareIntent.getFilePath((text) => {
111 | that.setState({ sharedText: text });
112 |
113 | })
114 | }
115 |
116 | render() {
117 | var url = this.state.sharedText;
118 | return (
119 |
120 | Shared file Path: {url}
121 | RNFileShareIntent.openURL(url)}
125 | />
126 | RNFileShareIntent.close()}
130 | />
131 |
132 | )
133 | }
134 | }
135 |
136 | const styles = StyleSheet.create({
137 | text: {
138 | color: 'black',
139 | backgroundColor: 'white',
140 | fontSize: 30,
141 | margin: 80
142 | }
143 | });
144 |
145 | AppRegistry.registerComponent('Share', () => Share);
146 |
147 | ```
148 |
149 |
150 |
151 | Or check the "example" directory for an example application.
152 |
153 | ## Preview
154 |
155 | ### IOS
156 |
157 |
158 |
159 |
160 |
161 |
162 | ### Android
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 | ## Credits
171 |
172 | Sponsored and developed by Ajith A B
173 |
--------------------------------------------------------------------------------
/Example/ios/Example.xcodeproj/xcshareddata/xcschemes/Share Intent.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
6 |
9 |
10 |
16 |
22 |
23 |
24 |
30 |
36 |
37 |
38 |
44 |
50 |
51 |
52 |
53 |
54 |
59 |
60 |
61 |
62 |
68 |
69 |
70 |
71 |
72 |
73 |
84 |
88 |
89 |
90 |
96 |
97 |
98 |
99 |
100 |
101 |
108 |
110 |
116 |
117 |
118 |
119 |
121 |
122 |
125 |
126 |
127 |
--------------------------------------------------------------------------------
/Example/ios/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
43 |
49 |
50 |
51 |
52 |
53 |
58 |
59 |
61 |
67 |
68 |
69 |
70 |
71 |
77 |
78 |
79 |
80 |
81 |
82 |
92 |
94 |
100 |
101 |
102 |
103 |
104 |
105 |
111 |
113 |
119 |
120 |
121 |
122 |
124 |
125 |
128 |
129 |
130 |
--------------------------------------------------------------------------------
/Example/ios/Example.xcodeproj/xcshareddata/xcschemes/Example-tvOS.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
43 |
49 |
50 |
51 |
52 |
53 |
58 |
59 |
61 |
67 |
68 |
69 |
70 |
71 |
77 |
78 |
79 |
80 |
81 |
82 |
92 |
94 |
100 |
101 |
102 |
103 |
104 |
105 |
111 |
113 |
119 |
120 |
121 |
122 |
124 |
125 |
128 |
129 |
130 |
--------------------------------------------------------------------------------
/ios/src/RNFileShareIntent.m:
--------------------------------------------------------------------------------
1 | //
2 | // ShareFileIntentModule.m
3 | // Share Intent
4 | //
5 | // Created by Ajith A B on 16/08/19.
6 | // Copyright © 2019 Facebook. All rights reserved.
7 | //
8 |
9 | #import "RNFileShareIntent.h"
10 | #import "RCTRootView.h"
11 | #import
12 | #import
13 | @implementation RNFileShareIntent
14 | static NSItemProvider* ShareFileIntentModule_itemProvider;
15 | static NSExtensionContext* extContext;
16 |
17 | RCT_EXPORT_MODULE();
18 |
19 | RCT_EXPORT_METHOD(getFilePath:(RCTResponseSenderBlock)callback)
20 | {
21 | if ([ShareFileIntentModule_itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeURL]) {
22 | [ShareFileIntentModule_itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeURL options:nil completionHandler:^(NSURL *url, NSError *error) {
23 | callback(@[url.absoluteString]);
24 | }];
25 | }
26 |
27 | if ([ShareFileIntentModule_itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeFileURL]) {
28 | [ShareFileIntentModule_itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeFileURL options:nil completionHandler:^(NSURL *url, NSError *error) {
29 | callback(@[url.absoluteString]);
30 | }];
31 | }
32 | if ([ShareFileIntentModule_itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypePDF]) {
33 | [ShareFileIntentModule_itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypePDF options:nil completionHandler:^(NSURL *url, NSError *error) {
34 | callback(@[url.absoluteString]);
35 | }];
36 | }
37 |
38 | if ([ShareFileIntentModule_itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeBMP]) {
39 | [ShareFileIntentModule_itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeBMP options:nil completionHandler:^(NSURL *url, NSError *error) {
40 | callback(@[url.absoluteString]);
41 | }];
42 | }
43 |
44 | if ([ShareFileIntentModule_itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeGIF]) {
45 | [ShareFileIntentModule_itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeGIF options:nil completionHandler:^(NSURL *url, NSError *error) {
46 | callback(@[url.absoluteString]);
47 | }];
48 | }
49 | if ([ShareFileIntentModule_itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeICO]) {
50 | [ShareFileIntentModule_itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeICO options:nil completionHandler:^(NSURL *url, NSError *error) {
51 | callback(@[url.absoluteString]);
52 | }];
53 | }
54 | if ([ShareFileIntentModule_itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeMP3]) {
55 | [ShareFileIntentModule_itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeMP3 options:nil completionHandler:^(NSURL *url, NSError *error) {
56 | callback(@[url.absoluteString]);
57 | }];
58 | }
59 | if ([ShareFileIntentModule_itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypePNG]) {
60 | [ShareFileIntentModule_itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypePNG options:nil completionHandler:^(NSURL *url, NSError *error) {
61 | callback(@[url.absoluteString]);
62 | }];
63 | }
64 | if ([ShareFileIntentModule_itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeJPEG]) {
65 | [ShareFileIntentModule_itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeJPEG options:nil completionHandler:^(NSURL *url, NSError *error) {
66 | callback(@[url.absoluteString]);
67 | }];
68 | }
69 | if ([ShareFileIntentModule_itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeMPEG]) {
70 | [ShareFileIntentModule_itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeMPEG options:nil completionHandler:^(NSURL *url, NSError *error) {
71 | callback(@[url.absoluteString]);
72 | }];
73 | }
74 | if ([ShareFileIntentModule_itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeImage]) {
75 | [ShareFileIntentModule_itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeImage options:nil completionHandler:^(NSURL *url, NSError *error) {
76 | callback(@[url.absoluteString]);
77 | }];
78 | }
79 | if ([ShareFileIntentModule_itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeText]) {
80 | [ShareFileIntentModule_itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeText options:nil completionHandler:^(NSURL *url, NSError *error) {
81 | callback(@[url.absoluteString]);
82 | }];
83 | }
84 | if ([ShareFileIntentModule_itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeAudio]) {
85 | [ShareFileIntentModule_itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeAudio options:nil completionHandler:^(NSURL *url, NSError *error) {
86 | callback(@[url.absoluteString]);
87 | }];
88 | }
89 | if ([ShareFileIntentModule_itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeVideo]) {
90 | [ShareFileIntentModule_itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeVideo options:nil completionHandler:^(NSURL *url, NSError *error) {
91 | callback(@[url.absoluteString]);
92 | }];
93 | }
94 |
95 | }
96 |
97 | RCT_EXPORT_METHOD(openURL:(NSString *)url) {
98 | UIApplication *application = [UIApplication sharedApplication];
99 | NSURL *urlToOpen = [NSURL URLWithString:[url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
100 | [application openURL:urlToOpen options:@{} completionHandler: nil];
101 | }
102 |
103 |
104 | RCT_EXPORT_METHOD(close)
105 | {
106 |
107 | [ extContext completeRequestReturningItems: @[] completionHandler: nil ];
108 | }
109 |
110 |
111 |
112 |
113 |
114 | +(void) setShareFileIntentModule_itemProvider: (NSItemProvider*) itemProvider
115 | {
116 | ShareFileIntentModule_itemProvider = itemProvider;
117 | }
118 |
119 | +(void) setContext: (NSExtensionContext*) context
120 | {
121 | extContext = context;
122 | }
123 | @end
124 |
125 |
--------------------------------------------------------------------------------
/Example/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 | # Determine the Java command to use to start the JVM.
86 | if [ -n "$JAVA_HOME" ] ; then
87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
88 | # IBM's JDK on AIX uses strange locations for the executables
89 | JAVACMD="$JAVA_HOME/jre/sh/java"
90 | else
91 | JAVACMD="$JAVA_HOME/bin/java"
92 | fi
93 | if [ ! -x "$JAVACMD" ] ; then
94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
95 |
96 | Please set the JAVA_HOME variable in your environment to match the
97 | location of your Java installation."
98 | fi
99 | else
100 | JAVACMD="java"
101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
102 |
103 | Please set the JAVA_HOME variable in your environment to match the
104 | location of your Java installation."
105 | fi
106 |
107 | # Increase the maximum file descriptors if we can.
108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
109 | MAX_FD_LIMIT=`ulimit -H -n`
110 | if [ $? -eq 0 ] ; then
111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
112 | MAX_FD="$MAX_FD_LIMIT"
113 | fi
114 | ulimit -n $MAX_FD
115 | if [ $? -ne 0 ] ; then
116 | warn "Could not set maximum file descriptor limit: $MAX_FD"
117 | fi
118 | else
119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
120 | fi
121 | fi
122 |
123 | # For Darwin, add options to specify how the application appears in the dock
124 | if $darwin; then
125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
126 | fi
127 |
128 | # For Cygwin, switch paths to Windows format before running java
129 | if $cygwin ; then
130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
132 | JAVACMD=`cygpath --unix "$JAVACMD"`
133 |
134 | # We build the pattern for arguments to be converted via cygpath
135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
136 | SEP=""
137 | for dir in $ROOTDIRSRAW ; do
138 | ROOTDIRS="$ROOTDIRS$SEP$dir"
139 | SEP="|"
140 | done
141 | OURCYGPATTERN="(^($ROOTDIRS))"
142 | # Add a user-defined pattern to the cygpath arguments
143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
145 | fi
146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
147 | i=0
148 | for arg in "$@" ; do
149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
151 |
152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
154 | else
155 | eval `echo args$i`="\"$arg\""
156 | fi
157 | i=$((i+1))
158 | done
159 | case $i in
160 | (0) set -- ;;
161 | (1) set -- "$args0" ;;
162 | (2) set -- "$args0" "$args1" ;;
163 | (3) set -- "$args0" "$args1" "$args2" ;;
164 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
165 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
166 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
167 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
168 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
169 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
170 | esac
171 | fi
172 |
173 | # Escape application args
174 | save () {
175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
176 | echo " "
177 | }
178 | APP_ARGS=$(save "$@")
179 |
180 | # Collect all arguments for the java command, following the shell quoting and substitution rules
181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
182 |
183 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
184 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
185 | cd "$(dirname "$0")"
186 | fi
187 |
188 | exec "$JAVACMD" "$@"
189 |
--------------------------------------------------------------------------------
/Example/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - boost-for-react-native (1.63.0)
3 | - DoubleConversion (1.1.6)
4 | - Folly (2018.10.22.00):
5 | - boost-for-react-native
6 | - DoubleConversion
7 | - Folly/Default (= 2018.10.22.00)
8 | - glog
9 | - Folly/Default (2018.10.22.00):
10 | - boost-for-react-native
11 | - DoubleConversion
12 | - glog
13 | - glog (0.3.5)
14 | - React (0.60.5):
15 | - React-Core (= 0.60.5)
16 | - React-DevSupport (= 0.60.5)
17 | - React-RCTActionSheet (= 0.60.5)
18 | - React-RCTAnimation (= 0.60.5)
19 | - React-RCTBlob (= 0.60.5)
20 | - React-RCTImage (= 0.60.5)
21 | - React-RCTLinking (= 0.60.5)
22 | - React-RCTNetwork (= 0.60.5)
23 | - React-RCTSettings (= 0.60.5)
24 | - React-RCTText (= 0.60.5)
25 | - React-RCTVibration (= 0.60.5)
26 | - React-RCTWebSocket (= 0.60.5)
27 | - React-Core (0.60.5):
28 | - Folly (= 2018.10.22.00)
29 | - React-cxxreact (= 0.60.5)
30 | - React-jsiexecutor (= 0.60.5)
31 | - yoga (= 0.60.5.React)
32 | - React-cxxreact (0.60.5):
33 | - boost-for-react-native (= 1.63.0)
34 | - DoubleConversion
35 | - Folly (= 2018.10.22.00)
36 | - glog
37 | - React-jsinspector (= 0.60.5)
38 | - React-DevSupport (0.60.5):
39 | - React-Core (= 0.60.5)
40 | - React-RCTWebSocket (= 0.60.5)
41 | - React-jsi (0.60.5):
42 | - boost-for-react-native (= 1.63.0)
43 | - DoubleConversion
44 | - Folly (= 2018.10.22.00)
45 | - glog
46 | - React-jsi/Default (= 0.60.5)
47 | - React-jsi/Default (0.60.5):
48 | - boost-for-react-native (= 1.63.0)
49 | - DoubleConversion
50 | - Folly (= 2018.10.22.00)
51 | - glog
52 | - React-jsiexecutor (0.60.5):
53 | - DoubleConversion
54 | - Folly (= 2018.10.22.00)
55 | - glog
56 | - React-cxxreact (= 0.60.5)
57 | - React-jsi (= 0.60.5)
58 | - React-jsinspector (0.60.5)
59 | - React-RCTActionSheet (0.60.5):
60 | - React-Core (= 0.60.5)
61 | - React-RCTAnimation (0.60.5):
62 | - React-Core (= 0.60.5)
63 | - React-RCTBlob (0.60.5):
64 | - React-Core (= 0.60.5)
65 | - React-RCTNetwork (= 0.60.5)
66 | - React-RCTWebSocket (= 0.60.5)
67 | - React-RCTImage (0.60.5):
68 | - React-Core (= 0.60.5)
69 | - React-RCTNetwork (= 0.60.5)
70 | - React-RCTLinking (0.60.5):
71 | - React-Core (= 0.60.5)
72 | - React-RCTNetwork (0.60.5):
73 | - React-Core (= 0.60.5)
74 | - React-RCTSettings (0.60.5):
75 | - React-Core (= 0.60.5)
76 | - React-RCTText (0.60.5):
77 | - React-Core (= 0.60.5)
78 | - React-RCTVibration (0.60.5):
79 | - React-Core (= 0.60.5)
80 | - React-RCTWebSocket (0.60.5):
81 | - React-Core (= 0.60.5)
82 | - yoga (0.60.5.React)
83 |
84 | DEPENDENCIES:
85 | - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
86 | - Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`)
87 | - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
88 | - React (from `../node_modules/react-native/`)
89 | - React-Core (from `../node_modules/react-native/React`)
90 | - React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`)
91 | - React-DevSupport (from `../node_modules/react-native/React`)
92 | - React-jsi (from `../node_modules/react-native/ReactCommon/jsi`)
93 | - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
94 | - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
95 | - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
96 | - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
97 | - React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`)
98 | - React-RCTImage (from `../node_modules/react-native/Libraries/Image`)
99 | - React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`)
100 | - React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`)
101 | - React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`)
102 | - React-RCTText (from `../node_modules/react-native/Libraries/Text`)
103 | - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
104 | - React-RCTWebSocket (from `../node_modules/react-native/Libraries/WebSocket`)
105 | - yoga (from `../node_modules/react-native/ReactCommon/yoga`)
106 |
107 | SPEC REPOS:
108 | https://github.com/cocoapods/specs.git:
109 | - boost-for-react-native
110 |
111 | EXTERNAL SOURCES:
112 | DoubleConversion:
113 | :podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
114 | Folly:
115 | :podspec: "../node_modules/react-native/third-party-podspecs/Folly.podspec"
116 | glog:
117 | :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec"
118 | React:
119 | :path: "../node_modules/react-native/"
120 | React-Core:
121 | :path: "../node_modules/react-native/React"
122 | React-cxxreact:
123 | :path: "../node_modules/react-native/ReactCommon/cxxreact"
124 | React-DevSupport:
125 | :path: "../node_modules/react-native/React"
126 | React-jsi:
127 | :path: "../node_modules/react-native/ReactCommon/jsi"
128 | React-jsiexecutor:
129 | :path: "../node_modules/react-native/ReactCommon/jsiexecutor"
130 | React-jsinspector:
131 | :path: "../node_modules/react-native/ReactCommon/jsinspector"
132 | React-RCTActionSheet:
133 | :path: "../node_modules/react-native/Libraries/ActionSheetIOS"
134 | React-RCTAnimation:
135 | :path: "../node_modules/react-native/Libraries/NativeAnimation"
136 | React-RCTBlob:
137 | :path: "../node_modules/react-native/Libraries/Blob"
138 | React-RCTImage:
139 | :path: "../node_modules/react-native/Libraries/Image"
140 | React-RCTLinking:
141 | :path: "../node_modules/react-native/Libraries/LinkingIOS"
142 | React-RCTNetwork:
143 | :path: "../node_modules/react-native/Libraries/Network"
144 | React-RCTSettings:
145 | :path: "../node_modules/react-native/Libraries/Settings"
146 | React-RCTText:
147 | :path: "../node_modules/react-native/Libraries/Text"
148 | React-RCTVibration:
149 | :path: "../node_modules/react-native/Libraries/Vibration"
150 | React-RCTWebSocket:
151 | :path: "../node_modules/react-native/Libraries/WebSocket"
152 | yoga:
153 | :path: "../node_modules/react-native/ReactCommon/yoga"
154 |
155 | SPEC CHECKSUMS:
156 | boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
157 | DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2
158 | Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51
159 | glog: 1f3da668190260b06b429bb211bfbee5cd790c28
160 | React: 53c53c4d99097af47cf60594b8706b4e3321e722
161 | React-Core: ba421f6b4f4cbe2fb17c0b6fc675f87622e78a64
162 | React-cxxreact: 8384287780c4999351ad9b6e7a149d9ed10a2395
163 | React-DevSupport: 197fb409737cff2c4f9986e77c220d7452cb9f9f
164 | React-jsi: 4d8c9efb6312a9725b18d6fc818ffc103f60fec2
165 | React-jsiexecutor: 90ad2f9db09513fc763bc757fdc3c4ff8bde2a30
166 | React-jsinspector: e08662d1bf5b129a3d556eb9ea343a3f40353ae4
167 | React-RCTActionSheet: b0f1ea83f4bf75fb966eae9bfc47b78c8d3efd90
168 | React-RCTAnimation: 359ba1b5690b1e87cc173558a78e82d35919333e
169 | React-RCTBlob: 5e2b55f76e9a1c7ae52b826923502ddc3238df24
170 | React-RCTImage: f5f1c50922164e89bdda67bcd0153952a5cfe719
171 | React-RCTLinking: d0ecbd791e9ddddc41fa1f66b0255de90e8ee1e9
172 | React-RCTNetwork: e26946300b0ab7bb6c4a6348090e93fa21f33a9d
173 | React-RCTSettings: d0d37cb521b7470c998595a44f05847777cc3f42
174 | React-RCTText: b074d89033583d4f2eb5faf7ea2db3a13c7553a2
175 | React-RCTVibration: 2105b2e0e2b66a6408fc69a46c8a7fb5b2fdade0
176 | React-RCTWebSocket: cd932a16b7214898b6b7f788c8bddb3637246ac4
177 | yoga: 312528f5bbbba37b4dcea5ef00e8b4033fdd9411
178 |
179 | PODFILE CHECKSUM: 427825d45bec91cf181bdca5a1e33480e904ef46
180 |
181 | COCOAPODS: 1.7.5
182 |
--------------------------------------------------------------------------------
/Example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "com.android.application"
2 |
3 | import com.android.build.OutputFile
4 |
5 | /**
6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7 | * and bundleReleaseJsAndAssets).
8 | * These basically call `react-native bundle` with the correct arguments during the Android build
9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10 | * bundle directly from the development server. Below you can see all the possible configurations
11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the
12 | * `apply from: "../../node_modules/react-native/react.gradle"` line.
13 | *
14 | * project.ext.react = [
15 | * // the name of the generated asset file containing your JS bundle
16 | * bundleAssetName: "index.android.bundle",
17 | *
18 | * // the entry file for bundle generation
19 | * entryFile: "index.android.js",
20 | *
21 | * // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
22 | * bundleCommand: "ram-bundle",
23 | *
24 | * // whether to bundle JS and assets in debug mode
25 | * bundleInDebug: false,
26 | *
27 | * // whether to bundle JS and assets in release mode
28 | * bundleInRelease: true,
29 | *
30 | * // whether to bundle JS and assets in another build variant (if configured).
31 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
32 | * // The configuration property can be in the following formats
33 | * // 'bundleIn${productFlavor}${buildType}'
34 | * // 'bundleIn${buildType}'
35 | * // bundleInFreeDebug: true,
36 | * // bundleInPaidRelease: true,
37 | * // bundleInBeta: true,
38 | *
39 | * // whether to disable dev mode in custom build variants (by default only disabled in release)
40 | * // for example: to disable dev mode in the staging build type (if configured)
41 | * devDisabledInStaging: true,
42 | * // The configuration property can be in the following formats
43 | * // 'devDisabledIn${productFlavor}${buildType}'
44 | * // 'devDisabledIn${buildType}'
45 | *
46 | * // the root of your project, i.e. where "package.json" lives
47 | * root: "../../",
48 | *
49 | * // where to put the JS bundle asset in debug mode
50 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
51 | *
52 | * // where to put the JS bundle asset in release mode
53 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release",
54 | *
55 | * // where to put drawable resources / React Native assets, e.g. the ones you use via
56 | * // require('./image.png')), in debug mode
57 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
58 | *
59 | * // where to put drawable resources / React Native assets, e.g. the ones you use via
60 | * // require('./image.png')), in release mode
61 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
62 | *
63 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means
64 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
65 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle
66 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
67 | * // for example, you might want to remove it from here.
68 | * inputExcludes: ["android/**", "ios/**"],
69 | *
70 | * // override which node gets called and with what additional arguments
71 | * nodeExecutableAndArgs: ["node"],
72 | *
73 | * // supply additional arguments to the packager
74 | * extraPackagerArgs: []
75 | * ]
76 | */
77 |
78 | project.ext.react = [
79 | entryFile: "index.js",
80 | enableHermes: false, // clean and rebuild if changing
81 | ]
82 |
83 | apply from: "../../node_modules/react-native/react.gradle"
84 |
85 | /**
86 | * Set this to true to create two separate APKs instead of one:
87 | * - An APK that only works on ARM devices
88 | * - An APK that only works on x86 devices
89 | * The advantage is the size of the APK is reduced by about 4MB.
90 | * Upload all the APKs to the Play Store and people will download
91 | * the correct one based on the CPU architecture of their device.
92 | */
93 | def enableSeparateBuildPerCPUArchitecture = false
94 |
95 | /**
96 | * Run Proguard to shrink the Java bytecode in release builds.
97 | */
98 | def enableProguardInReleaseBuilds = false
99 |
100 | /**
101 | * The preferred build flavor of JavaScriptCore.
102 | *
103 | * For example, to use the international variant, you can use:
104 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
105 | *
106 | * The international variant includes ICU i18n library and necessary data
107 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
108 | * give correct results when using with locales other than en-US. Note that
109 | * this variant is about 6MiB larger per architecture than default.
110 | */
111 | def jscFlavor = 'org.webkit:android-jsc:+'
112 |
113 | /**
114 | * Whether to enable the Hermes VM.
115 | *
116 | * This should be set on project.ext.react and mirrored here. If it is not set
117 | * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
118 | * and the benefits of using Hermes will therefore be sharply reduced.
119 | */
120 | def enableHermes = project.ext.react.get("enableHermes", false);
121 |
122 | android {
123 | compileSdkVersion rootProject.ext.compileSdkVersion
124 |
125 | compileOptions {
126 | sourceCompatibility JavaVersion.VERSION_1_8
127 | targetCompatibility JavaVersion.VERSION_1_8
128 | }
129 |
130 | defaultConfig {
131 | applicationId "com.example"
132 | minSdkVersion rootProject.ext.minSdkVersion
133 | targetSdkVersion rootProject.ext.targetSdkVersion
134 | versionCode 1
135 | versionName "1.0"
136 | }
137 | splits {
138 | abi {
139 | reset()
140 | enable enableSeparateBuildPerCPUArchitecture
141 | universalApk false // If true, also generate a universal APK
142 | include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
143 | }
144 | }
145 | signingConfigs {
146 | debug {
147 | storeFile file('debug.keystore')
148 | storePassword 'android'
149 | keyAlias 'androiddebugkey'
150 | keyPassword 'android'
151 | }
152 | }
153 | buildTypes {
154 | debug {
155 | signingConfig signingConfigs.debug
156 | }
157 | release {
158 | // Caution! In production, you need to generate your own keystore file.
159 | // see https://facebook.github.io/react-native/docs/signed-apk-android.
160 | signingConfig signingConfigs.debug
161 | minifyEnabled enableProguardInReleaseBuilds
162 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
163 | }
164 | }
165 | // applicationVariants are e.g. debug, release
166 | applicationVariants.all { variant ->
167 | variant.outputs.each { output ->
168 | // For each separate APK per architecture, set a unique version code as described here:
169 | // https://developer.android.com/studio/build/configure-apk-splits.html
170 | def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
171 | def abi = output.getFilter(OutputFile.ABI)
172 | if (abi != null) { // null for the universal-debug, universal-release variants
173 | output.versionCodeOverride =
174 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
175 | }
176 |
177 | }
178 | }
179 |
180 | packagingOptions {
181 | pickFirst '**/armeabi-v7a/libc++_shared.so'
182 | pickFirst '**/x86/libc++_shared.so'
183 | pickFirst '**/arm64-v8a/libc++_shared.so'
184 | pickFirst '**/x86_64/libc++_shared.so'
185 | pickFirst '**/x86/libjsc.so'
186 | pickFirst '**/armeabi-v7a/libjsc.so'
187 | }
188 | }
189 |
190 | dependencies {
191 | implementation fileTree(dir: "libs", include: ["*.jar"])
192 | implementation "com.facebook.react:react-native:+" // From node_modules
193 |
194 | if (enableHermes) {
195 | def hermesPath = "../../node_modules/hermesvm/android/";
196 | debugImplementation files(hermesPath + "hermes-debug.aar")
197 | releaseImplementation files(hermesPath + "hermes-release.aar")
198 | } else {
199 | implementation jscFlavor
200 | }
201 | }
202 |
203 | // Run this once to be able to run the application with BUCK
204 | // puts all compile dependencies into folder libs for BUCK to use
205 | task copyDownloadableDepsToLibs(type: Copy) {
206 | from configurations.compile
207 | into 'libs'
208 | }
209 |
210 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
211 |
--------------------------------------------------------------------------------
/ios/RNFileShareIntent.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | B3E7B58A1CC2AC0600A0062D /* RNFileShareIntent.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNFileShareIntent.m */; };
11 | /* End PBXBuildFile section */
12 |
13 | /* Begin PBXCopyFilesBuildPhase section */
14 | 58B511D91A9E6C8500147676 /* CopyFiles */ = {
15 | isa = PBXCopyFilesBuildPhase;
16 | buildActionMask = 2147483647;
17 | dstPath = "include/$(PRODUCT_NAME)";
18 | dstSubfolderSpec = 16;
19 | files = (
20 | );
21 | runOnlyForDeploymentPostprocessing = 0;
22 | };
23 | /* End PBXCopyFilesBuildPhase section */
24 |
25 | /* Begin PBXFileReference section */
26 | 134814201AA4EA6300B7C361 /* libRNFileShareIntent.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNFileShareIntent.a; sourceTree = BUILT_PRODUCTS_DIR; };
27 | B3E7B5881CC2AC0600A0062D /* RNFileShareIntent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNFileShareIntent.h; sourceTree = ""; };
28 | B3E7B5891CC2AC0600A0062D /* RNFileShareIntent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNFileShareIntent.m; sourceTree = ""; };
29 | /* End PBXFileReference section */
30 |
31 | /* Begin PBXFrameworksBuildPhase section */
32 | 58B511D81A9E6C8500147676 /* Frameworks */ = {
33 | isa = PBXFrameworksBuildPhase;
34 | buildActionMask = 2147483647;
35 | files = (
36 | );
37 | runOnlyForDeploymentPostprocessing = 0;
38 | };
39 | /* End PBXFrameworksBuildPhase section */
40 |
41 | /* Begin PBXGroup section */
42 | 134814211AA4EA7D00B7C361 /* Products */ = {
43 | isa = PBXGroup;
44 | children = (
45 | 134814201AA4EA6300B7C361 /* libRNFileShareIntent.a */,
46 | );
47 | name = Products;
48 | sourceTree = "";
49 | };
50 | 58B511D21A9E6C8500147676 = {
51 | isa = PBXGroup;
52 | children = (
53 | B82085002307BACF00CF75D4 /* src */,
54 | 134814211AA4EA7D00B7C361 /* Products */,
55 | );
56 | sourceTree = "";
57 | };
58 | B82085002307BACF00CF75D4 /* src */ = {
59 | isa = PBXGroup;
60 | children = (
61 | B3E7B5881CC2AC0600A0062D /* RNFileShareIntent.h */,
62 | B3E7B5891CC2AC0600A0062D /* RNFileShareIntent.m */,
63 | );
64 | path = src;
65 | sourceTree = "";
66 | };
67 | /* End PBXGroup section */
68 |
69 | /* Begin PBXNativeTarget section */
70 | 58B511DA1A9E6C8500147676 /* RNFileShareIntent */ = {
71 | isa = PBXNativeTarget;
72 | buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNFileShareIntent" */;
73 | buildPhases = (
74 | 58B511D71A9E6C8500147676 /* Sources */,
75 | 58B511D81A9E6C8500147676 /* Frameworks */,
76 | 58B511D91A9E6C8500147676 /* CopyFiles */,
77 | );
78 | buildRules = (
79 | );
80 | dependencies = (
81 | );
82 | name = RNFileShareIntent;
83 | productName = RCTDataManager;
84 | productReference = 134814201AA4EA6300B7C361 /* libRNFileShareIntent.a */;
85 | productType = "com.apple.product-type.library.static";
86 | };
87 | /* End PBXNativeTarget section */
88 |
89 | /* Begin PBXProject section */
90 | 58B511D31A9E6C8500147676 /* Project object */ = {
91 | isa = PBXProject;
92 | attributes = {
93 | LastUpgradeCheck = 0830;
94 | ORGANIZATIONNAME = Facebook;
95 | TargetAttributes = {
96 | 58B511DA1A9E6C8500147676 = {
97 | CreatedOnToolsVersion = 6.1.1;
98 | };
99 | };
100 | };
101 | buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNFileShareIntent" */;
102 | compatibilityVersion = "Xcode 3.2";
103 | developmentRegion = English;
104 | hasScannedForEncodings = 0;
105 | knownRegions = (
106 | English,
107 | en,
108 | );
109 | mainGroup = 58B511D21A9E6C8500147676;
110 | productRefGroup = 58B511D21A9E6C8500147676;
111 | projectDirPath = "";
112 | projectRoot = "";
113 | targets = (
114 | 58B511DA1A9E6C8500147676 /* RNFileShareIntent */,
115 | );
116 | };
117 | /* End PBXProject section */
118 |
119 | /* Begin PBXSourcesBuildPhase section */
120 | 58B511D71A9E6C8500147676 /* Sources */ = {
121 | isa = PBXSourcesBuildPhase;
122 | buildActionMask = 2147483647;
123 | files = (
124 | B3E7B58A1CC2AC0600A0062D /* RNFileShareIntent.m in Sources */,
125 | );
126 | runOnlyForDeploymentPostprocessing = 0;
127 | };
128 | /* End PBXSourcesBuildPhase section */
129 |
130 | /* Begin XCBuildConfiguration section */
131 | 58B511ED1A9E6C8500147676 /* Debug */ = {
132 | isa = XCBuildConfiguration;
133 | buildSettings = {
134 | ALWAYS_SEARCH_USER_PATHS = NO;
135 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
136 | CLANG_CXX_LIBRARY = "libc++";
137 | CLANG_ENABLE_MODULES = YES;
138 | CLANG_ENABLE_OBJC_ARC = YES;
139 | CLANG_WARN_BOOL_CONVERSION = YES;
140 | CLANG_WARN_CONSTANT_CONVERSION = YES;
141 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
142 | CLANG_WARN_EMPTY_BODY = YES;
143 | CLANG_WARN_ENUM_CONVERSION = YES;
144 | CLANG_WARN_INFINITE_RECURSION = YES;
145 | CLANG_WARN_INT_CONVERSION = YES;
146 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
147 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
148 | CLANG_WARN_UNREACHABLE_CODE = YES;
149 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
150 | COPY_PHASE_STRIP = NO;
151 | ENABLE_STRICT_OBJC_MSGSEND = YES;
152 | ENABLE_TESTABILITY = YES;
153 | GCC_C_LANGUAGE_STANDARD = gnu99;
154 | GCC_DYNAMIC_NO_PIC = NO;
155 | GCC_NO_COMMON_BLOCKS = YES;
156 | GCC_OPTIMIZATION_LEVEL = 0;
157 | GCC_PREPROCESSOR_DEFINITIONS = (
158 | "DEBUG=1",
159 | "$(inherited)",
160 | );
161 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
162 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
163 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
164 | GCC_WARN_UNDECLARED_SELECTOR = YES;
165 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
166 | GCC_WARN_UNUSED_FUNCTION = YES;
167 | GCC_WARN_UNUSED_VARIABLE = YES;
168 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
169 | MTL_ENABLE_DEBUG_INFO = YES;
170 | ONLY_ACTIVE_ARCH = YES;
171 | SDKROOT = iphoneos;
172 | };
173 | name = Debug;
174 | };
175 | 58B511EE1A9E6C8500147676 /* Release */ = {
176 | isa = XCBuildConfiguration;
177 | buildSettings = {
178 | ALWAYS_SEARCH_USER_PATHS = NO;
179 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
180 | CLANG_CXX_LIBRARY = "libc++";
181 | CLANG_ENABLE_MODULES = YES;
182 | CLANG_ENABLE_OBJC_ARC = YES;
183 | CLANG_WARN_BOOL_CONVERSION = YES;
184 | CLANG_WARN_CONSTANT_CONVERSION = YES;
185 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
186 | CLANG_WARN_EMPTY_BODY = YES;
187 | CLANG_WARN_ENUM_CONVERSION = YES;
188 | CLANG_WARN_INFINITE_RECURSION = YES;
189 | CLANG_WARN_INT_CONVERSION = YES;
190 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
191 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
192 | CLANG_WARN_UNREACHABLE_CODE = YES;
193 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
194 | COPY_PHASE_STRIP = YES;
195 | ENABLE_NS_ASSERTIONS = NO;
196 | ENABLE_STRICT_OBJC_MSGSEND = YES;
197 | GCC_C_LANGUAGE_STANDARD = gnu99;
198 | GCC_NO_COMMON_BLOCKS = YES;
199 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
200 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
201 | GCC_WARN_UNDECLARED_SELECTOR = YES;
202 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
203 | GCC_WARN_UNUSED_FUNCTION = YES;
204 | GCC_WARN_UNUSED_VARIABLE = YES;
205 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
206 | MTL_ENABLE_DEBUG_INFO = NO;
207 | SDKROOT = iphoneos;
208 | VALIDATE_PRODUCT = YES;
209 | };
210 | name = Release;
211 | };
212 | 58B511F01A9E6C8500147676 /* Debug */ = {
213 | isa = XCBuildConfiguration;
214 | buildSettings = {
215 | HEADER_SEARCH_PATHS = (
216 | "$(inherited)",
217 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
218 | "$(SRCROOT)/../../../React/**",
219 | "$(SRCROOT)/../../react-native/React/**",
220 | );
221 | LIBRARY_SEARCH_PATHS = "$(inherited)";
222 | OTHER_LDFLAGS = "-ObjC";
223 | PRODUCT_NAME = RNFileShareIntent;
224 | SKIP_INSTALL = YES;
225 | };
226 | name = Debug;
227 | };
228 | 58B511F11A9E6C8500147676 /* Release */ = {
229 | isa = XCBuildConfiguration;
230 | buildSettings = {
231 | HEADER_SEARCH_PATHS = (
232 | "$(inherited)",
233 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
234 | "$(SRCROOT)/../../../React/**",
235 | "$(SRCROOT)/../../react-native/React/**",
236 | );
237 | LIBRARY_SEARCH_PATHS = "$(inherited)";
238 | OTHER_LDFLAGS = "-ObjC";
239 | PRODUCT_NAME = RNFileShareIntent;
240 | SKIP_INSTALL = YES;
241 | };
242 | name = Release;
243 | };
244 | /* End XCBuildConfiguration section */
245 |
246 | /* Begin XCConfigurationList section */
247 | 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNFileShareIntent" */ = {
248 | isa = XCConfigurationList;
249 | buildConfigurations = (
250 | 58B511ED1A9E6C8500147676 /* Debug */,
251 | 58B511EE1A9E6C8500147676 /* Release */,
252 | );
253 | defaultConfigurationIsVisible = 0;
254 | defaultConfigurationName = Release;
255 | };
256 | 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNFileShareIntent" */ = {
257 | isa = XCConfigurationList;
258 | buildConfigurations = (
259 | 58B511F01A9E6C8500147676 /* Debug */,
260 | 58B511F11A9E6C8500147676 /* Release */,
261 | );
262 | defaultConfigurationIsVisible = 0;
263 | defaultConfigurationName = Release;
264 | };
265 | /* End XCConfigurationList section */
266 | };
267 | rootObject = 58B511D31A9E6C8500147676 /* Project object */;
268 | }
269 |
--------------------------------------------------------------------------------
/ios/README.md:
--------------------------------------------------------------------------------
1 |
2 | # react-native-file-share-intent
3 |
4 | Adds the application to the share intent of the device, so it can be launched from other apps and receive data from them
5 |
6 |
7 | ## Installation
8 |
9 | * Install the module
10 |
11 | ```bash
12 | npm i --save react-native-file-share-intent
13 | ```
14 |
15 | # IOS Installation
16 |
17 |
18 | - Click on your project's name
19 | - Click on `+` sign
20 |
21 |
22 |
23 |
24 |
25 | - Select `Share Extension` under `iOS > Application Extension`
26 |
27 |
28 |
29 |
30 |
31 | - Select a name for your new share extension, in my case I chose `Share Intent`
32 |
33 |
34 |
35 |
36 |
37 | - Select both files `ShareViewController.h` and `ShareViewController.m`.
38 |
39 |
40 |
41 |
42 |
43 | - Copy the below code and paste into the `ShareViewController.h`
44 |
45 | ```objective-c
46 | #import
47 | #import
48 |
49 | @interface ShareViewController : UIViewController
50 |
51 | @end
52 | ```
53 |
54 | - Copy the below code and paste into the `ShareViewController.m`
55 | ```objective-c
56 | #import "ShareViewController.h"
57 | #import "RCTRootView.h"
58 | #import "RCTBundleURLProvider.h"
59 | #import "RNFileShareIntent.h"
60 |
61 | @interface ShareViewController ()
62 |
63 | @end
64 |
65 | @implementation ShareViewController
66 |
67 | - (void) loadView
68 | {
69 | NSURL *jsCodeLocation;
70 |
71 | NSExtensionItem *item = self.extensionContext.inputItems.firstObject;
72 | NSItemProvider *itemProvider = item.attachments.firstObject;
73 | [RNFileShareIntent setShareFileIntentModule_itemProvider:itemProvider];
74 | [RNFileShareIntent setContext: self.extensionContext];
75 |
76 |
77 | #if DEBUG
78 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"Share" fallbackResource:nil];
79 | #else
80 | jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/share.bundle?platform=ios&dev=true"];
81 | // Change localhost to your network Ip for your Device Debugging
82 | #endif
83 |
84 |
85 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
86 | moduleName:@"Share"
87 | initialProperties:nil
88 | launchOptions:nil];
89 | self.view = rootView;
90 | }
91 |
92 | // animate (IN)
93 | - (void)viewWillAppear:(BOOL)animated
94 | {
95 | [super viewWillAppear:animated];
96 |
97 | self.view.transform = CGAffineTransformMakeTranslation(0, self.view.frame.size.height);
98 | [UIView animateWithDuration:0.25 animations:^
99 | {
100 | self.view.transform = CGAffineTransformIdentity;
101 | }];
102 | }
103 |
104 |
105 | @end
106 |
107 | ```
108 |
109 |
110 | - Now it's time to add our library. Right click on the `Libraries` group and select `Add Files to "Sample1"...`
111 |
112 |
113 |
114 |
115 |
116 | - select `node_modules` > `react-native-file-share-intent` > `ios` > `RNFileShareIntent.xcodeproj`
117 |
118 |
119 |
120 |
121 |
122 | - Now we need to tell the share extension that we want to read new header files. Click on project name (in my case `Example`), then click on your extension name (in my case `Share Intent`). After that click on Build Settings and search for `Header Search Paths`
123 |
124 |
125 |
126 |
127 |
128 | - Add the new path `$(SRCROOT)/../node_modules/react-native-file-share-intent/ios` with `recursive` selected
129 |
130 |
131 |
132 |
133 |
134 | - We need to add some linker flags as well, so search for `Other Linker Flags` and add `-ObjC` and `-lc++`
135 |
136 |
137 |
138 |
139 |
140 | - We also need to add all the static libraries such as `React` and `React Native File Share Intent`. Select the `General` tab and under `Linked frameworks and Libraries` click on `+` and add all of the selected static binaries there
141 |
142 |
143 |
144 |
145 |
146 | - select from top menu `Products` > `Schemes` > `Edit Schemes` > `Build` click on `+` and add `React`
147 |
148 |
149 |
150 |
151 |
152 | - Select the `Build Phases` tab and under `Target Dependencies` click on `+` and add React
153 |
154 |
155 |
156 |
157 |
158 | - Select Share Extension folder in side Menu `info.plist` and add below code
159 |
160 |
161 |
162 |
163 |
164 | ```
165 | NSAppTransportSecurity
166 |
167 | NSExceptionDomains
168 |
169 | localhost
170 |
171 | NSTemporaryExceptionAllowsInsecureHTTPLoads
172 |
173 |
174 |
175 |
176 | ```
177 |
178 | ### For IOS Share Extension View
179 |
180 | Share.js in the Root Folder
181 |
182 | ```javascript
183 | import React, { Component } from 'react';
184 | import { View, Text, AppRegistry, StyleSheet, Button } from 'react-native';
185 | import RNFileShareIntent from 'react-native-file-share-intent';
186 | export default class Share extends Component {
187 | constructor(props) {
188 | super(props);
189 | this.state = {
190 | sharedText: null
191 | };
192 | }
193 | componentDidMount() {
194 | var that = this;
195 | RNFileShareIntent.getFilePath((text) => {
196 | that.setState({ sharedText: text });
197 |
198 | })
199 | }
200 |
201 | render() {
202 | var url = this.state.sharedText;
203 | return (
204 |
205 | Shared file Path: {url}
206 | RNFileShareIntent.openURL(url)}
210 | />
211 | RNFileShareIntent.close()}
215 | />
216 |
217 | )
218 | }
219 | }
220 |
221 | const styles = StyleSheet.create({
222 | text: {
223 | color: 'black',
224 | backgroundColor: 'white',
225 | fontSize: 30,
226 | margin: 80
227 | }
228 | });
229 |
230 | AppRegistry.registerComponent('Share', () => Share);
231 |
232 | ```
233 |
234 |
235 |
236 | Or check the "example" directory for an example application.
237 |
238 | ### For Ios Release
239 |
240 | - run command in the root folder
241 |
242 | ```bash
243 | react-native bundle --entry-file share.js --platform ios --dev false --bundle-output ios/share.jsbundle --assets-dest ios
244 | ```
245 |
246 | then open Xcode and from side menu select the folder of `share extension` and right-click the folder you will get a menu to `add files` then you will select the `share.jsbundle` from your ios folder
247 |
248 |
249 | ### Donate
250 |
251 |
252 |
253 |
254 | ## Communication Between Main App and Share Extension
255 |
256 | - create a Same App group For `Main App` and `Share Extension` through Select the Main App or Share Extension and Select `Capablities tab` then select App group `create group with same name`
257 |
258 |
259 |
260 |
261 |
262 | ### Message Communication
263 |
264 | ```bash
265 | npm install --save react-native-swiss-knife
266 | ```
267 |
268 | - To save a value on your main app:
269 |
270 | ```Javascript
271 | import { RNSKBucket } from 'react-native-swiss-knife'
272 |
273 | const myGroup = 'group.groupName'
274 | RNSKBucket.set('test', 'myValue', myGroup)
275 | ```
276 |
277 | - and then, to read the saved data on your shared extension:
278 |
279 | ```Javascript
280 | import { RNSKBucket } from 'react-native-swiss-knife'
281 |
282 | const myGroup = 'group.groupName'
283 | RNSKBucket.get('test', myGroup).then( (value) => console.log(value) ) // myValue
284 | ```
285 |
286 | ### Manage Files
287 |
288 | - Use react-native-fs
289 |
290 | - In Share Extension
291 |
292 | ```Javascript
293 |
294 | import * as RNFS from 'react-native-fs';
295 |
296 | var path = RNFS.pathForGroup('group.groupName');
297 | path = path+'filename.txt'; // according to files use .jpeg, .pdf etc ...
298 | RNFS.copyFile(url, path) // url-> path getting From Share Extension, path -> copying Location
299 | .then((success) => {
300 |
301 | })
302 | .catch((err) => {
303 | console.log("Error: " + err.message);
304 | });
305 | ```
306 | - In Main App
307 |
308 | ```Javascript
309 |
310 | import * as RNFS from 'react-native-fs';
311 |
312 | var path = RNFS.pathForGroup('group.groupName');
313 | RNFS.readDir(path)
314 | .then((result) => {
315 | console.log('GOT RESULT', result);
316 |
317 | // stat the first file
318 | return Promise.all([RNFS.stat(result[0].path), result[0].path]);
319 | })
320 | .then((statResult) => {
321 | if (statResult[0].isFile()) {
322 | // if we have a file, read it
323 | return RNFS.readFile(statResult[1], 'utf8');
324 | }
325 |
326 | return 'no file';
327 | })
328 | .then((contents) => {
329 | // log the file contents
330 | console.log(contents);
331 | })
332 | .catch((err) => {
333 | console.log(err.message, err.code);
334 | });
335 | ```
336 | ### Opening Share Extension in Main App
337 |
338 | - In Share Extension
339 |
340 | ```javascript
341 | import RNFileShareIntent from 'react-native-file-share-intent';
342 |
343 | RNFileShareIntent.openURL(url)
344 |
345 | ```
346 | - In Main App
347 |
348 | Refer Linking
349 |
350 | ```javascript
351 | import { Linking } from 'react-native';
352 |
353 | Linking.getInitialURL().then((url) => {
354 | if (url) {
355 | console.log('Initial url is: ' + url);
356 | }
357 | }).catch(err => console.error('An error occurred', err));
358 | ```
359 |
360 | ## Credits
361 |
362 | Sponsored and developed by Ajith A B
363 |
--------------------------------------------------------------------------------
/android/react-native-file-share-intent.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | generateDebugSources
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
--------------------------------------------------------------------------------