├── examples
└── Sample1
│ ├── .watchmanconfig
│ ├── .buckconfig
│ ├── android
│ ├── keystores
│ │ ├── debug.keystore.properties
│ │ └── BUCK
│ ├── app
│ │ ├── src
│ │ │ └── main
│ │ │ │ ├── res
│ │ │ │ ├── values
│ │ │ │ │ ├── strings.xml
│ │ │ │ │ └── styles.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ └── mipmap-xxhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── sample1
│ │ │ │ │ ├── share
│ │ │ │ │ ├── ShareActivity.java
│ │ │ │ │ └── ShareApplication.java
│ │ │ │ │ ├── MainActivity.java
│ │ │ │ │ └── MainApplication.java
│ │ │ │ └── AndroidManifest.xml
│ │ ├── BUCK
│ │ ├── proguard-rules.pro
│ │ └── build.gradle
│ ├── settings.gradle
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradlew.bat
│ └── gradlew
│ ├── index.ios.js
│ ├── index.android.js
│ ├── package.json
│ ├── ios
│ ├── Sample1
│ │ ├── AppDelegate.h
│ │ ├── main.m
│ │ ├── Images.xcassets
│ │ │ └── AppIcon.appiconset
│ │ │ │ └── Contents.json
│ │ ├── AppDelegate.m
│ │ ├── Info.plist
│ │ └── Base.lproj
│ │ │ └── LaunchScreen.xib
│ ├── Sample1Tests
│ │ ├── Info.plist
│ │ └── Sample1Tests.m
│ ├── MyShareEx
│ │ ├── MyShareEx.m
│ │ ├── Info.plist
│ │ └── Base.lproj
│ │ │ └── MainInterface.storyboard
│ └── Sample1.xcodeproj
│ │ ├── xcshareddata
│ │ └── xcschemes
│ │ │ └── Sample1.xcscheme
│ │ └── project.pbxproj
│ ├── .gitignore
│ ├── app.ios.js
│ ├── app.android.js
│ ├── share.ios.js
│ ├── share.android.js
│ └── .flowconfig
├── .gitignore
├── assets
├── ios-demo.gif
├── android-demo.gif
├── 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
├── ios_step_12.png
├── ios_step_13.png
├── ios_step_14.png
├── ios_step_15.png
├── ios_step_16.png
├── ios_step_17.png
└── NSExtensionActivationRule.png
├── ios
├── ReactNativeShareExtension.h
├── ReactNativeShareExtension.xcodeproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── ali.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ ├── xcuserdata
│ │ └── ali.xcuserdatad
│ │ │ └── xcschemes
│ │ │ ├── xcschememanagement.plist
│ │ │ └── ReactNativeShareExtension.xcscheme
│ └── project.pbxproj
└── ReactNativeShareExtension.m
├── android
├── src
│ └── main
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ └── com
│ │ ├── alinz
│ │ └── parkerdan
│ │ │ └── shareextension
│ │ │ ├── SharePackage.java
│ │ │ ├── ShareModule.java
│ │ │ └── RealPathUtil.java
│ │ └── github
│ │ └── alinz
│ │ └── reactNativeShareExtension
│ │ ├── ShareExPackage.java
│ │ └── ShareExModule.java
└── build.gradle
├── lib
└── index.js
├── package.json
├── LICENSE
├── bin
└── react-native-xcode.sh
└── README.md
/examples/Sample1/.watchmanconfig:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | *.iml
3 | .tags
4 | .tags1
5 |
--------------------------------------------------------------------------------
/assets/ios-demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raindropio/react-native-share-extension/HEAD/assets/ios-demo.gif
--------------------------------------------------------------------------------
/assets/android-demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raindropio/react-native-share-extension/HEAD/assets/android-demo.gif
--------------------------------------------------------------------------------
/assets/ios_step_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raindropio/react-native-share-extension/HEAD/assets/ios_step_01.png
--------------------------------------------------------------------------------
/assets/ios_step_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raindropio/react-native-share-extension/HEAD/assets/ios_step_02.png
--------------------------------------------------------------------------------
/assets/ios_step_03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raindropio/react-native-share-extension/HEAD/assets/ios_step_03.png
--------------------------------------------------------------------------------
/assets/ios_step_04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raindropio/react-native-share-extension/HEAD/assets/ios_step_04.png
--------------------------------------------------------------------------------
/assets/ios_step_05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raindropio/react-native-share-extension/HEAD/assets/ios_step_05.png
--------------------------------------------------------------------------------
/assets/ios_step_06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raindropio/react-native-share-extension/HEAD/assets/ios_step_06.png
--------------------------------------------------------------------------------
/assets/ios_step_07.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raindropio/react-native-share-extension/HEAD/assets/ios_step_07.png
--------------------------------------------------------------------------------
/assets/ios_step_08.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raindropio/react-native-share-extension/HEAD/assets/ios_step_08.png
--------------------------------------------------------------------------------
/assets/ios_step_09.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raindropio/react-native-share-extension/HEAD/assets/ios_step_09.png
--------------------------------------------------------------------------------
/assets/ios_step_10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raindropio/react-native-share-extension/HEAD/assets/ios_step_10.png
--------------------------------------------------------------------------------
/assets/ios_step_11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raindropio/react-native-share-extension/HEAD/assets/ios_step_11.png
--------------------------------------------------------------------------------
/assets/ios_step_12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raindropio/react-native-share-extension/HEAD/assets/ios_step_12.png
--------------------------------------------------------------------------------
/assets/ios_step_13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raindropio/react-native-share-extension/HEAD/assets/ios_step_13.png
--------------------------------------------------------------------------------
/assets/ios_step_14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raindropio/react-native-share-extension/HEAD/assets/ios_step_14.png
--------------------------------------------------------------------------------
/assets/ios_step_15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raindropio/react-native-share-extension/HEAD/assets/ios_step_15.png
--------------------------------------------------------------------------------
/assets/ios_step_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raindropio/react-native-share-extension/HEAD/assets/ios_step_16.png
--------------------------------------------------------------------------------
/assets/ios_step_17.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raindropio/react-native-share-extension/HEAD/assets/ios_step_17.png
--------------------------------------------------------------------------------
/assets/NSExtensionActivationRule.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raindropio/react-native-share-extension/HEAD/assets/NSExtensionActivationRule.png
--------------------------------------------------------------------------------
/examples/Sample1/.buckconfig:
--------------------------------------------------------------------------------
1 |
2 | [android]
3 | target = Google Inc.:Google APIs:23
4 |
5 | [maven_repositories]
6 | central = https://repo1.maven.org/maven2
7 |
--------------------------------------------------------------------------------
/examples/Sample1/android/keystores/debug.keystore.properties:
--------------------------------------------------------------------------------
1 | key.store=debug.keystore
2 | key.alias=androiddebugkey
3 | key.store.password=android
4 | key.alias.password=android
5 |
--------------------------------------------------------------------------------
/examples/Sample1/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Sample1
3 | MyShareEx
4 |
5 |
--------------------------------------------------------------------------------
/examples/Sample1/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raindropio/react-native-share-extension/HEAD/examples/Sample1/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/examples/Sample1/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raindropio/react-native-share-extension/HEAD/examples/Sample1/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/examples/Sample1/android/keystores/BUCK:
--------------------------------------------------------------------------------
1 | keystore(
2 | name = 'debug',
3 | store = 'debug.keystore',
4 | properties = 'debug.keystore.properties',
5 | visibility = [
6 | 'PUBLIC',
7 | ],
8 | )
9 |
--------------------------------------------------------------------------------
/examples/Sample1/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raindropio/react-native-share-extension/HEAD/examples/Sample1/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/examples/Sample1/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raindropio/react-native-share-extension/HEAD/examples/Sample1/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ios/ReactNativeShareExtension.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "React/RCTBridgeModule.h"
3 |
4 | @interface ReactNativeShareExtension : UIViewController
5 | - (UIView*) shareView;
6 | @end
7 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/examples/Sample1/index.ios.js:
--------------------------------------------------------------------------------
1 | import { AppRegistry } from 'react-native';
2 |
3 | import App from './app.ios'
4 | import Share from './share.ios'
5 |
6 | AppRegistry.registerComponent('Sample1', () => App);
7 | AppRegistry.registerComponent('MyShareEx', () => Share);
8 |
--------------------------------------------------------------------------------
/examples/Sample1/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'Sample1'
2 |
3 | include ':app', ':react-native-share-extension'
4 |
5 | project(':react-native-share-extension').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-share-extension/android')
6 |
--------------------------------------------------------------------------------
/ios/ReactNativeShareExtension.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/examples/Sample1/index.android.js:
--------------------------------------------------------------------------------
1 | import { AppRegistry } from 'react-native';
2 |
3 | import App from './app.android'
4 | import Share from './share.android'
5 |
6 | AppRegistry.registerComponent('Sample1', () => App);
7 | AppRegistry.registerComponent('MyShareEx', () => Share);
8 |
--------------------------------------------------------------------------------
/ios/ReactNativeShareExtension.xcodeproj/project.xcworkspace/xcuserdata/ali.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/raindropio/react-native-share-extension/HEAD/ios/ReactNativeShareExtension.xcodeproj/project.xcworkspace/xcuserdata/ali.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/examples/Sample1/android/app/src/main/java/com/sample1/share/ShareActivity.java:
--------------------------------------------------------------------------------
1 | package com.sample1.share;
2 |
3 | import com.facebook.react.ReactActivity;
4 |
5 | public class ShareActivity extends ReactActivity {
6 | @Override
7 | protected String getMainComponentName() {
8 | return "MyShareEx";
9 | }
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/examples/Sample1/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Sample1",
3 | "version": "0.0.1",
4 | "private": true,
5 | "scripts": {
6 | "start": "node node_modules/react-native/local-cli/cli.js start"
7 | },
8 | "dependencies": {
9 | "react": "15.3.1",
10 | "react-native": "0.32.0",
11 | "react-native-modalbox": "1.3.3",
12 | "react-native-share-extension": "../.."
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/lib/index.js:
--------------------------------------------------------------------------------
1 | import { NativeModules } from 'react-native'
2 |
3 | // import ShareExtension from 'react-native-share-extension'
4 | // const { type, value } = await NativeModules.ShareExtension.data()
5 | // NativeModules.ShareExtension.close()
6 | export default {
7 | data: () => NativeModules.ReactNativeShareExtension.data(),
8 | close: () => NativeModules.ReactNativeShareExtension.close()
9 | }
10 |
--------------------------------------------------------------------------------
/examples/Sample1/android/app/src/main/java/com/sample1/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.sample1;
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 "Sample1";
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/examples/Sample1/ios/Sample1/AppDelegate.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | */
9 |
10 | #import
11 |
12 | @interface AppDelegate : UIResponder
13 |
14 | @property (nonatomic, strong) UIWindow *window;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/examples/Sample1/ios/Sample1/main.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | */
9 |
10 | #import
11 |
12 | #import "AppDelegate.h"
13 |
14 | int main(int argc, char * argv[]) {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/examples/Sample1/.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/IJ
26 | #
27 | *.iml
28 | .idea
29 | .gradle
30 | local.properties
31 |
32 | # node.js
33 | #
34 | node_modules/
35 | npm-debug.log
36 |
37 | # BUCK
38 | buck-out/
39 | \.buckd/
40 | android/app/libs
41 | android/keystores/debug.keystore
42 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | jcenter()
4 | }
5 |
6 | dependencies {
7 | classpath 'com.android.tools.build:gradle:1.1.3'
8 | }
9 | }
10 |
11 | apply plugin: 'com.android.library'
12 |
13 | android {
14 | compileSdkVersion 23
15 | buildToolsVersion "23.0.1"
16 |
17 | defaultConfig {
18 | minSdkVersion 16
19 | targetSdkVersion 22
20 | versionCode 1
21 | versionName "1.0"
22 | }
23 | lintOptions {
24 | abortOnError false
25 | }
26 | }
27 |
28 | repositories {
29 | mavenCentral()
30 | }
31 |
32 | dependencies {
33 | compile "com.facebook.react:react-native:+"
34 | }
35 |
--------------------------------------------------------------------------------
/ios/ReactNativeShareExtension.xcodeproj/xcuserdata/ali.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | ReactNativeShareExtension.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 41B5DE2F1D0B505800949BD5
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/examples/Sample1/android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.3.1'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | mavenLocal()
18 | jcenter()
19 | maven {
20 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
21 | url "$projectDir/../../node_modules/react-native/android"
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/examples/Sample1/ios/Sample1/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 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-share-extension",
3 | "version": "1.2.1",
4 | "description": "share extension using react-native for both ios and android",
5 | "main": "lib/index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "repository": {
10 | "type": "git",
11 | "url": "git@github.com:alinz/react-native-share-extension.git"
12 | },
13 | "keywords": ["react-component", "react-native", "share-extension"],
14 | "author": {
15 | "name": "Ali Najafizadeh",
16 | "email": "a.najafizadeh@gmail.com",
17 | "url": "http://github.com/alinz"
18 | },
19 | "license": "MIT",
20 | "bugs": {
21 | "url": "https://github.com/alinz/react-native-share-extension"
22 | },
23 | "homepage": "https://github.com/alinz/react-native-share-extension"
24 | }
25 |
--------------------------------------------------------------------------------
/examples/Sample1/ios/Sample1Tests/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 |
--------------------------------------------------------------------------------
/examples/Sample1/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.useDeprecatedNdk=true
21 |
--------------------------------------------------------------------------------
/android/src/main/java/com/alinz/parkerdan/shareextension/SharePackage.java:
--------------------------------------------------------------------------------
1 | package com.alinz.parkerdan.shareextension;
2 |
3 | import com.facebook.react.bridge.ReactApplicationContext;
4 | import com.facebook.react.bridge.JavaScriptModule;
5 | import com.facebook.react.bridge.NativeModule;
6 | import com.facebook.react.uimanager.ViewManager;
7 | import com.facebook.react.ReactPackage;
8 |
9 | import java.util.Arrays;
10 | import java.util.Collections;
11 | import java.util.List;
12 |
13 | public class SharePackage implements ReactPackage {
14 | @Override
15 | public List createNativeModules(ReactApplicationContext reactContext) {
16 | return Arrays.asList(new ShareModule(reactContext));
17 | }
18 |
19 | public List> createJSModules() {
20 | return Collections.emptyList();
21 | }
22 |
23 | @Override
24 | public List createViewManagers(ReactApplicationContext reactContext) {
25 | return Collections.emptyList();
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/examples/Sample1/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
12 |
13 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/examples/Sample1/ios/MyShareEx/MyShareEx.m:
--------------------------------------------------------------------------------
1 | //
2 | // MyShareEx.m
3 | // Sample1
4 | //
5 | // Created by Ali Najafizadeh on 2016-06-10.
6 | // Copyright © 2016 Facebook. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "ReactNativeShareExtension.h"
11 | #import "RCTBundleURLProvider.h"
12 | #import "RCTRootView.h"
13 |
14 | @interface MyShareEx : ReactNativeShareExtension
15 | @end
16 |
17 | @implementation MyShareEx
18 |
19 | RCT_EXPORT_MODULE();
20 |
21 | - (UIView*) shareView {
22 | NSURL *jsCodeLocation;
23 |
24 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
25 |
26 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
27 | moduleName:@"MyShareEx"
28 | initialProperties:nil
29 | launchOptions:nil];
30 | rootView.backgroundColor = nil;
31 | return rootView;
32 | }
33 |
34 | @end
--------------------------------------------------------------------------------
/android/src/main/java/com/github/alinz/reactNativeShareExtension/ShareExPackage.java:
--------------------------------------------------------------------------------
1 | package com.github.alinz.reactNativeShareExtension;
2 |
3 | import com.facebook.react.ReactPackage;
4 | import com.facebook.react.bridge.JavaScriptModule;
5 | import com.facebook.react.bridge.NativeModule;
6 | import com.facebook.react.bridge.ReactApplicationContext;
7 | import com.facebook.react.uimanager.ViewManager;
8 |
9 | import java.util.Arrays;
10 | import java.util.Collections;
11 | import java.util.List;
12 |
13 | public class ShareExPackage implements ReactPackage {
14 |
15 | @Override
16 | public List createNativeModules(ReactApplicationContext reactContext) {
17 | return Arrays.asList(new ShareExModule(reactContext));
18 | }
19 |
20 | public List> createJSModules() {
21 | return Collections.emptyList();
22 | }
23 |
24 | @Override
25 | public List createViewManagers(ReactApplicationContext reactContext) {
26 | return Collections.emptyList();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/examples/Sample1/app.ios.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Sample React Native App
3 | * @flow
4 | */
5 |
6 | import React, { Component } from 'react';
7 | import {
8 | StyleSheet,
9 | Text,
10 | View
11 | } from 'react-native';
12 |
13 | export default class App extends Component {
14 | render() {
15 | return (
16 |
17 |
18 | Welcome to React Native!
19 |
20 |
21 | To get started, edit index.android.js
22 |
23 |
24 | Shake or press menu button for dev menu
25 |
26 |
27 | );
28 | }
29 | }
30 |
31 | const styles = StyleSheet.create({
32 | container: {
33 | flex: 1,
34 | justifyContent: 'center',
35 | alignItems: 'center',
36 | backgroundColor: '#F5FCFF',
37 | },
38 | welcome: {
39 | fontSize: 20,
40 | textAlign: 'center',
41 | margin: 10,
42 | },
43 | instructions: {
44 | textAlign: 'center',
45 | color: '#333333',
46 | marginBottom: 5,
47 | },
48 | });
49 |
--------------------------------------------------------------------------------
/examples/Sample1/app.android.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Sample React Native App
3 | * @flow
4 | */
5 |
6 | import React, { Component } from 'react';
7 | import {
8 | StyleSheet,
9 | Text,
10 | View
11 | } from 'react-native';
12 |
13 | export default class App extends Component {
14 | render() {
15 | return (
16 |
17 |
18 | Welcome to React Native!
19 |
20 |
21 | To get started, edit index.android.js
22 |
23 |
24 | Shake or press menu button for dev menu
25 |
26 |
27 | );
28 | }
29 | }
30 |
31 | const styles = StyleSheet.create({
32 | container: {
33 | flex: 1,
34 | justifyContent: 'center',
35 | alignItems: 'center',
36 | backgroundColor: '#F5FCFF',
37 | },
38 | welcome: {
39 | fontSize: 20,
40 | textAlign: 'center',
41 | margin: 10,
42 | },
43 | instructions: {
44 | textAlign: 'center',
45 | color: '#333333',
46 | marginBottom: 5,
47 | },
48 | });
49 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Ali Najafizadeh
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/examples/Sample1/android/app/src/main/java/com/sample1/MainApplication.java:
--------------------------------------------------------------------------------
1 | package com.sample1;
2 |
3 | import android.app.Application;
4 | import android.util.Log;
5 |
6 | import com.facebook.react.ReactApplication;
7 | import com.facebook.react.ReactInstanceManager;
8 | import com.facebook.react.ReactNativeHost;
9 | import com.facebook.react.ReactPackage;
10 | import com.facebook.react.shell.MainReactPackage;
11 |
12 |
13 | import com.alinz.parkerdan.shareextension.SharePackage;
14 |
15 | import java.util.Arrays;
16 | import java.util.List;
17 |
18 | public class MainApplication extends Application implements ReactApplication {
19 |
20 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
21 | @Override
22 | protected boolean getUseDeveloperSupport() {
23 | return BuildConfig.DEBUG;
24 |
25 | }
26 |
27 | @Override
28 | protected List getPackages() {
29 | return Arrays.asList(
30 | new MainReactPackage(),
31 | new SharePackage()
32 | );
33 | }
34 | };
35 |
36 | @Override
37 | public ReactNativeHost getReactNativeHost() {
38 | return mReactNativeHost;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/examples/Sample1/android/app/src/main/java/com/sample1/share/ShareApplication.java:
--------------------------------------------------------------------------------
1 | // import your package
2 | package com.sample1.share;
3 | // import your build config
4 | import com.sample1.BuildConfig;
5 |
6 | import com.alinz.parkerdan.shareextension.SharePackage;
7 |
8 | import android.app.Application;
9 |
10 | import com.facebook.react.shell.MainReactPackage;
11 | import com.facebook.react.ReactNativeHost;
12 | import com.facebook.react.ReactApplication;
13 | import com.facebook.react.ReactPackage;
14 |
15 | import java.util.Arrays;
16 | import java.util.List;
17 |
18 |
19 | public class ShareApplication extends Application implements ReactApplication {
20 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
21 | @Override
22 | protected boolean getUseDeveloperSupport() {
23 | return BuildConfig.DEBUG;
24 |
25 | }
26 |
27 | @Override
28 | protected List getPackages() {
29 | return Arrays.asList(
30 | new MainReactPackage(),
31 | new SharePackage()
32 | );
33 | }
34 | };
35 |
36 | @Override
37 | public ReactNativeHost getReactNativeHost() {
38 | return mReactNativeHost;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/examples/Sample1/ios/MyShareEx/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | MyShareEx
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 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | NSExtension
26 |
27 | NSExtensionAttributes
28 |
29 | NSExtensionActivationRule
30 | TRUEPREDICATE
31 |
32 | NSExtensionMainStoryboard
33 | MainInterface
34 | NSExtensionPointIdentifier
35 | com.apple.share-services
36 |
37 | NSAppTransportSecurity
38 |
39 | NSAllowsArbitraryLoads
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/examples/Sample1/ios/Sample1/AppDelegate.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | */
9 |
10 | #import "AppDelegate.h"
11 |
12 | #import "RCTBundleURLProvider.h"
13 | #import "RCTRootView.h"
14 |
15 | @implementation AppDelegate
16 |
17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
18 | {
19 | NSURL *jsCodeLocation;
20 |
21 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
22 |
23 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
24 | moduleName:@"Sample1"
25 | initialProperties:nil
26 | launchOptions:launchOptions];
27 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
28 |
29 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
30 | UIViewController *rootViewController = [UIViewController new];
31 | rootViewController.view = rootView;
32 | self.window.rootViewController = rootViewController;
33 | [self.window makeKeyAndVisible];
34 | return YES;
35 | }
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/examples/Sample1/share.ios.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Sample React Native Share Extension
3 | * @flow
4 | */
5 |
6 | import React, { Component } from 'react'
7 | import Modal from 'react-native-modalbox'
8 | import ShareExtension from 'react-native-share-extension'
9 |
10 | import {
11 | Text,
12 | View,
13 | TouchableOpacity
14 | } from 'react-native'
15 |
16 | export default class Share extends Component {
17 | constructor(props, context) {
18 | super(props, context)
19 | this.state = {
20 | isOpen: true,
21 | type: '',
22 | value: ''
23 | }
24 | }
25 |
26 | async componentDidMount() {
27 | try {
28 | const { type, value } = await ShareExtension.data()
29 | this.setState({
30 | type,
31 | value
32 | })
33 | } catch(e) {
34 | console.log('errrr', e)
35 | }
36 | }
37 |
38 | onClose = () => ShareExtension.close()
39 |
40 | closing = () => this.setState({ isOpen: false });
41 |
42 | render() {
43 | return (
44 |
51 |
52 |
53 |
54 | Close
55 | type: { this.state.type }
56 | value: { this.state.value }
57 |
58 |
59 |
60 |
61 | );
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/examples/Sample1/share.android.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Sample React Native Share Extension
3 | * @flow
4 | */
5 |
6 | import React, { Component } from 'react'
7 | import Modal from 'react-native-modalbox'
8 | import ShareExtension from 'react-native-share-extension'
9 |
10 | import {
11 | Text,
12 | TextInput,
13 | View,
14 | TouchableOpacity
15 | } from 'react-native'
16 |
17 | export default class Share extends Component {
18 | constructor(props, context) {
19 | super(props, context)
20 | this.state = {
21 | isOpen: true,
22 | type: '',
23 | value: ''
24 | }
25 | }
26 |
27 | async componentDidMount() {
28 | try {
29 | const { type, value } = await ShareExtension.data()
30 | this.setState({
31 | type,
32 | value
33 | })
34 | } catch(e) {
35 | console.log('errrr', e)
36 | }
37 | }
38 |
39 | onClose() {
40 | ShareExtension.close()
41 | }
42 |
43 | closing = () => {
44 | this.setState({
45 | isOpen: false
46 | })
47 | }
48 |
49 | render() {
50 | return (
51 |
53 |
54 |
55 |
56 | Close
57 | type: { this.state.type }
58 | value: { this.state.value }
59 |
60 |
61 |
62 |
63 | )
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/examples/Sample1/ios/MyShareEx/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 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/examples/Sample1/android/app/BUCK:
--------------------------------------------------------------------------------
1 | import re
2 |
3 | # To learn about Buck see [Docs](https://buckbuild.com/).
4 | # To run your application with Buck:
5 | # - install Buck
6 | # - `npm start` - to start the packager
7 | # - `cd android`
8 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US`
9 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
10 | # - `buck install -r android/app` - compile, install and run application
11 | #
12 |
13 | lib_deps = []
14 | for jarfile in glob(['libs/*.jar']):
15 | name = 'jars__' + re.sub(r'^.*/([^/]+)\.jar$', r'\1', jarfile)
16 | lib_deps.append(':' + name)
17 | prebuilt_jar(
18 | name = name,
19 | binary_jar = jarfile,
20 | )
21 |
22 | for aarfile in glob(['libs/*.aar']):
23 | name = 'aars__' + re.sub(r'^.*/([^/]+)\.aar$', r'\1', aarfile)
24 | lib_deps.append(':' + name)
25 | android_prebuilt_aar(
26 | name = name,
27 | aar = aarfile,
28 | )
29 |
30 | android_library(
31 | name = 'all-libs',
32 | exported_deps = lib_deps
33 | )
34 |
35 | android_library(
36 | name = 'app-code',
37 | srcs = glob([
38 | 'src/main/java/**/*.java',
39 | ]),
40 | deps = [
41 | ':all-libs',
42 | ':build_config',
43 | ':res',
44 | ],
45 | )
46 |
47 | android_build_config(
48 | name = 'build_config',
49 | package = 'com.sample1',
50 | )
51 |
52 | android_resource(
53 | name = 'res',
54 | res = 'src/main/res',
55 | package = 'com.sample1',
56 | )
57 |
58 | android_binary(
59 | name = 'app',
60 | package_type = 'debug',
61 | manifest = 'src/main/AndroidManifest.xml',
62 | keystore = '//android/keystores:debug',
63 | deps = [
64 | ':app-code',
65 | ],
66 | )
67 |
--------------------------------------------------------------------------------
/examples/Sample1/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
12 |
13 |
18 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/examples/Sample1/ios/Sample1/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 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UIViewControllerBasedStatusBarAppearance
38 |
39 | NSLocationWhenInUseUsageDescription
40 |
41 | NSAppTransportSecurity
42 |
43 |
44 | NSExceptionDomains
45 |
46 | localhost
47 |
48 | NSTemporaryExceptionAllowsInsecureHTTPLoads
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/examples/Sample1/.flowconfig:
--------------------------------------------------------------------------------
1 | [ignore]
2 |
3 | # We fork some components by platform.
4 | .*/*[.]android.js
5 |
6 | # Ignore templates with `@flow` in header
7 | .*/local-cli/generator.*
8 |
9 | # Ignore malformed json
10 | .*/node_modules/y18n/test/.*\.json
11 |
12 | # Ignore the website subdir
13 | /website/.*
14 |
15 | # Ignore BUCK generated dirs
16 | /\.buckd/
17 |
18 | # Ignore unexpected extra @providesModule
19 | .*/node_modules/commoner/test/source/widget/share.js
20 |
21 | # Ignore duplicate module providers
22 | # For RN Apps installed via npm, "Libraries" folder is inside node_modules/react-native but in the source repo it is in the root
23 | .*/Libraries/react-native/React.js
24 | .*/Libraries/react-native/ReactNative.js
25 | .*/node_modules/jest-runtime/build/__tests__/.*
26 |
27 | [include]
28 |
29 | [libs]
30 | node_modules/react-native/Libraries/react-native/react-native-interface.js
31 | node_modules/react-native/flow
32 | flow/
33 |
34 | [options]
35 | module.system=haste
36 |
37 | esproposal.class_static_fields=enable
38 | esproposal.class_instance_fields=enable
39 |
40 | experimental.strict_type_args=true
41 |
42 | munge_underscores=true
43 |
44 | module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
45 | 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'
46 |
47 | suppress_type=$FlowIssue
48 | suppress_type=$FlowFixMe
49 | suppress_type=$FixMe
50 |
51 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(30\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
52 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(30\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
53 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
54 |
55 | unsafe.enable_getters_and_setters=true
56 |
57 | [version]
58 | ^0.30.0
59 |
--------------------------------------------------------------------------------
/examples/Sample1/ios/Sample1Tests/Sample1Tests.m:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | * All rights reserved.
4 | *
5 | * This source code is licensed under the BSD-style license found in the
6 | * LICENSE file in the root directory of this source tree. An additional grant
7 | * of patent rights can be found in the PATENTS file in the same directory.
8 | */
9 |
10 | #import
11 | #import
12 |
13 | #import "RCTLog.h"
14 | #import "RCTRootView.h"
15 |
16 | #define TIMEOUT_SECONDS 600
17 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!"
18 |
19 | @interface Sample1Tests : XCTestCase
20 |
21 | @end
22 |
23 | @implementation Sample1Tests
24 |
25 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test
26 | {
27 | if (test(view)) {
28 | return YES;
29 | }
30 | for (UIView *subview in [view subviews]) {
31 | if ([self findSubviewInView:subview matching:test]) {
32 | return YES;
33 | }
34 | }
35 | return NO;
36 | }
37 |
38 | - (void)testRendersWelcomeScreen
39 | {
40 | UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
41 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
42 | BOOL foundElement = NO;
43 |
44 | __block NSString *redboxError = nil;
45 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
46 | if (level >= RCTLogLevelError) {
47 | redboxError = message;
48 | }
49 | });
50 |
51 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
52 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
53 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
54 |
55 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) {
56 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
57 | return YES;
58 | }
59 | return NO;
60 | }];
61 | }
62 |
63 | RCTSetLogFunction(RCTDefaultLogFunction);
64 |
65 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
66 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
67 | }
68 |
69 |
70 | @end
71 |
--------------------------------------------------------------------------------
/android/src/main/java/com/alinz/parkerdan/shareextension/ShareModule.java:
--------------------------------------------------------------------------------
1 | package com.alinz.parkerdan.shareextension;
2 |
3 | import com.facebook.react.bridge.ReactContextBaseJavaModule;
4 | import com.facebook.react.bridge.ReactApplicationContext;
5 | import com.facebook.react.bridge.Promise;
6 | import com.facebook.react.bridge.ReactMethod;
7 | import com.facebook.react.bridge.WritableMap;
8 | import com.facebook.react.bridge.Arguments;
9 |
10 | import android.app.Activity;
11 | import android.content.Intent;
12 | import android.net.Uri;
13 |
14 | import android.graphics.Bitmap;
15 | import java.io.InputStream;
16 |
17 |
18 | public class ShareModule extends ReactContextBaseJavaModule {
19 |
20 |
21 | public ShareModule(ReactApplicationContext reactContext) {
22 | super(reactContext);
23 | }
24 |
25 | @Override
26 | public String getName() {
27 | return "ReactNativeShareExtension";
28 | }
29 |
30 | @ReactMethod
31 | public void close() {
32 | getCurrentActivity().finish();
33 | }
34 |
35 | @ReactMethod
36 | public void data(Promise promise) {
37 | promise.resolve(processIntent());
38 | }
39 |
40 | public WritableMap processIntent() {
41 | WritableMap map = Arguments.createMap();
42 |
43 | String value = "";
44 | String type = "";
45 | String action = "";
46 |
47 | Activity currentActivity = getCurrentActivity();
48 |
49 | if (currentActivity != null) {
50 | Intent intent = currentActivity.getIntent();
51 | action = intent.getAction();
52 | type = intent.getType();
53 | if (type == null) {
54 | type = "";
55 | }
56 | if (Intent.ACTION_SEND.equals(action) && "text/plain".equals(type)) {
57 | value = intent.getStringExtra(Intent.EXTRA_TEXT);
58 | }
59 | else if (Intent.ACTION_SEND.equals(action) && ("image/*".equals(type) || "image/jpeg".equals(type) || "image/png".equals(type) || "image/jpg".equals(type) ) ) {
60 | Uri uri = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
61 | value = "file://" + RealPathUtil.getRealPathFromURI(currentActivity, uri);
62 |
63 | } else {
64 | value = "";
65 | }
66 | } else {
67 | value = "";
68 | type = "";
69 | }
70 |
71 | map.putString("type", type);
72 | map.putString("value",value);
73 |
74 | return map;
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/android/src/main/java/com/github/alinz/reactNativeShareExtension/ShareExModule.java:
--------------------------------------------------------------------------------
1 | package com.github.alinz.reactNativeShareExtension;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.util.Log;
6 | import com.facebook.react.bridge.Promise;
7 | import com.facebook.react.bridge.ReactApplicationContext;
8 | import com.facebook.react.bridge.ReactContextBaseJavaModule;
9 | import com.facebook.react.bridge.ActivityEventListener;
10 | import com.facebook.react.bridge.ReactMethod;
11 | import com.facebook.react.bridge.WritableMap;
12 | import com.facebook.react.bridge.Arguments;
13 |
14 | import javax.annotation.Nullable;
15 |
16 | public class ShareExModule extends ReactContextBaseJavaModule implements ActivityEventListener {
17 |
18 | public ShareExModule(ReactApplicationContext reactContext) {
19 | super(reactContext);
20 | reactContext.addActivityEventListener(this);
21 | }
22 |
23 | public String getName() {
24 | return "ReactNativeShareExtension";
25 | }
26 |
27 | @ReactMethod
28 | public void data(Promise promise) {
29 | promise.resolve(processIntent());
30 | }
31 |
32 | protected WritableMap processIntent() {
33 |
34 | Activity currentActivity = getCurrentActivity();
35 |
36 | WritableMap map = Arguments.createMap();
37 |
38 | Intent intent = currentActivity.getIntent();
39 | String action = intent.getAction();
40 | String type = intent.getType();
41 | String value = "";
42 |
43 | if (type == null) {
44 | type = "";
45 | }
46 |
47 | //if you want to support more, just add more things here.
48 | //at the moment we are only supporting browser URL
49 | if (Intent.ACTION_SEND.equals(action) && "text/plain".equals(type)) {
50 | value = intent.getStringExtra(Intent.EXTRA_TEXT);
51 | }
52 |
53 | map.putString("type", type);
54 | map.putString("value", value);
55 |
56 | return map;
57 | }
58 |
59 | @ReactMethod
60 | public void close() {
61 | Activity currentActivity = getCurrentActivity();
62 |
63 | currentActivity.finish();
64 | }
65 |
66 | public void onActivityResult(final int requestCode, final int resultCode, final Intent data) { }
67 |
68 | public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) { }
69 |
70 | public void onNewIntent(Intent intent) { }
71 | }
72 |
--------------------------------------------------------------------------------
/examples/Sample1/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 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Disabling obfuscation is useful if you collect stack traces from production crashes
20 | # (unless you are using a system that supports de-obfuscate the stack traces).
21 | -dontobfuscate
22 |
23 | # React Native
24 |
25 | # Keep our interfaces so they can be used by other ProGuard rules.
26 | # See http://sourceforge.net/p/proguard/bugs/466/
27 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
28 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
29 |
30 | # Do not strip any method/class that is annotated with @DoNotStrip
31 | -keep @com.facebook.proguard.annotations.DoNotStrip class *
32 | -keepclassmembers class * {
33 | @com.facebook.proguard.annotations.DoNotStrip *;
34 | }
35 |
36 | -keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
37 | void set*(***);
38 | *** get*();
39 | }
40 |
41 | -keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
42 | -keep class * extends com.facebook.react.bridge.NativeModule { *; }
43 | -keepclassmembers,includedescriptorclasses class * { native ; }
44 | -keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; }
45 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; }
46 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; }
47 |
48 | -dontwarn com.facebook.react.**
49 |
50 | # okhttp
51 |
52 | -keepattributes Signature
53 | -keepattributes *Annotation*
54 | -keep class okhttp3.** { *; }
55 | -keep interface okhttp3.** { *; }
56 | -dontwarn okhttp3.**
57 |
58 | # okio
59 |
60 | -keep class sun.misc.Unsafe { *; }
61 | -dontwarn java.nio.file.*
62 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
63 | -dontwarn okio.**
64 |
--------------------------------------------------------------------------------
/examples/Sample1/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/ios/ReactNativeShareExtension.xcodeproj/xcuserdata/ali.xcuserdatad/xcschemes/ReactNativeShareExtension.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
34 |
35 |
45 |
46 |
52 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
70 |
71 |
72 |
73 |
75 |
76 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/examples/Sample1/ios/Sample1/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 |
--------------------------------------------------------------------------------
/examples/Sample1/ios/Sample1.xcodeproj/xcshareddata/xcschemes/Sample1.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
47 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
65 |
66 |
75 |
77 |
83 |
84 |
85 |
86 |
87 |
88 |
94 |
96 |
102 |
103 |
104 |
105 |
107 |
108 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/android/src/main/java/com/alinz/parkerdan/shareextension/RealPathUtil.java:
--------------------------------------------------------------------------------
1 | package com.alinz.parkerdan.shareextension;
2 |
3 | import android.content.Context;
4 | import android.database.Cursor;
5 | import android.net.Uri;
6 | import android.os.Build;
7 | import android.provider.DocumentsContract;
8 | import android.provider.MediaStore;
9 | import android.content.ContentUris;
10 | import android.os.Environment;
11 |
12 | public class RealPathUtil {
13 | public static String getRealPathFromURI(final Context context, final Uri uri) {
14 |
15 | final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
16 |
17 | // DocumentProvider
18 | if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
19 | // ExternalStorageProvider
20 | if (isExternalStorageDocument(uri)) {
21 | final String docId = DocumentsContract.getDocumentId(uri);
22 | final String[] split = docId.split(":");
23 | final String type = split[0];
24 |
25 | if ("primary".equalsIgnoreCase(type)) {
26 | return Environment.getExternalStorageDirectory() + "/" + split[1];
27 | }
28 |
29 | // TODO handle non-primary volumes
30 | }
31 | // DownloadsProvider
32 | else if (isDownloadsDocument(uri)) {
33 |
34 | final String id = DocumentsContract.getDocumentId(uri);
35 | final Uri contentUri = ContentUris.withAppendedId(
36 | Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
37 |
38 | return getDataColumn(context, contentUri, null, null);
39 | }
40 | // MediaProvider
41 | else if (isMediaDocument(uri)) {
42 | final String docId = DocumentsContract.getDocumentId(uri);
43 | final String[] split = docId.split(":");
44 | final String type = split[0];
45 |
46 | Uri contentUri = null;
47 | if ("image".equals(type)) {
48 | contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
49 | } else if ("video".equals(type)) {
50 | contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
51 | } else if ("audio".equals(type)) {
52 | contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
53 | }
54 |
55 | final String selection = "_id=?";
56 | final String[] selectionArgs = new String[] {
57 | split[1]
58 | };
59 |
60 | return getDataColumn(context, contentUri, selection, selectionArgs);
61 | }
62 | }
63 | // MediaStore (and general)
64 | else if ("content".equalsIgnoreCase(uri.getScheme())) {
65 |
66 | // Return the remote address
67 | if (isGooglePhotosUri(uri))
68 | return uri.getLastPathSegment();
69 |
70 | return getDataColumn(context, uri, null, null);
71 | }
72 | // File
73 | else if ("file".equalsIgnoreCase(uri.getScheme())) {
74 | return uri.getPath();
75 | }
76 |
77 | return null;
78 | }
79 |
80 | /**
81 | * Get the value of the data column for this Uri. This is useful for
82 | * MediaStore Uris, and other file-based ContentProviders.
83 | *
84 | * @param context The context.
85 | * @param uri The Uri to query.
86 | * @param selection (Optional) Filter used in the query.
87 | * @param selectionArgs (Optional) Selection arguments used in the query.
88 | * @return The value of the _data column, which is typically a file path.
89 | */
90 | public static String getDataColumn(Context context, Uri uri, String selection,
91 | String[] selectionArgs) {
92 |
93 | Cursor cursor = null;
94 | final String column = "_data";
95 | final String[] projection = {
96 | column
97 | };
98 |
99 | try {
100 | cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,
101 | null);
102 | if (cursor != null && cursor.moveToFirst()) {
103 | final int index = cursor.getColumnIndexOrThrow(column);
104 | return cursor.getString(index);
105 | }
106 | } finally {
107 | if (cursor != null)
108 | cursor.close();
109 | }
110 | return null;
111 | }
112 |
113 |
114 | /**
115 | * @param uri The Uri to check.
116 | * @return Whether the Uri authority is ExternalStorageProvider.
117 | */
118 | public static boolean isExternalStorageDocument(Uri uri) {
119 | return "com.android.externalstorage.documents".equals(uri.getAuthority());
120 | }
121 |
122 | /**
123 | * @param uri The Uri to check.
124 | * @return Whether the Uri authority is DownloadsProvider.
125 | */
126 | public static boolean isDownloadsDocument(Uri uri) {
127 | return "com.android.providers.downloads.documents".equals(uri.getAuthority());
128 | }
129 |
130 | /**
131 | * @param uri The Uri to check.
132 | * @return Whether the Uri authority is MediaProvider.
133 | */
134 | public static boolean isMediaDocument(Uri uri) {
135 | return "com.android.providers.media.documents".equals(uri.getAuthority());
136 | }
137 |
138 | /**
139 | * @param uri The Uri to check.
140 | * @return Whether the Uri authority is Google Photos.
141 | */
142 | public static boolean isGooglePhotosUri(Uri uri) {
143 | return "com.google.android.apps.photos.content".equals(uri.getAuthority());
144 | }
145 |
146 | }
147 |
--------------------------------------------------------------------------------
/examples/Sample1/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/examples/Sample1/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 | * // whether to bundle JS and assets in debug mode
22 | * bundleInDebug: false,
23 | *
24 | * // whether to bundle JS and assets in release mode
25 | * bundleInRelease: true,
26 | *
27 | * // whether to bundle JS and assets in another build variant (if configured).
28 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
29 | * // The configuration property can be in the following formats
30 | * // 'bundleIn${productFlavor}${buildType}'
31 | * // 'bundleIn${buildType}'
32 | * // bundleInFreeDebug: true,
33 | * // bundleInPaidRelease: true,
34 | * // bundleInBeta: true,
35 | *
36 | * // the root of your project, i.e. where "package.json" lives
37 | * root: "../../",
38 | *
39 | * // where to put the JS bundle asset in debug mode
40 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
41 | *
42 | * // where to put the JS bundle asset in release mode
43 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release",
44 | *
45 | * // where to put drawable resources / React Native assets, e.g. the ones you use via
46 | * // require('./image.png')), in debug mode
47 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
48 | *
49 | * // where to put drawable resources / React Native assets, e.g. the ones you use via
50 | * // require('./image.png')), in release mode
51 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
52 | *
53 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means
54 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
55 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle
56 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
57 | * // for example, you might want to remove it from here.
58 | * inputExcludes: ["android/**", "ios/**"]
59 | * ]
60 | */
61 |
62 | apply from: "../../node_modules/react-native/react.gradle"
63 |
64 | /**
65 | * Set this to true to create two separate APKs instead of one:
66 | * - An APK that only works on ARM devices
67 | * - An APK that only works on x86 devices
68 | * The advantage is the size of the APK is reduced by about 4MB.
69 | * Upload all the APKs to the Play Store and people will download
70 | * the correct one based on the CPU architecture of their device.
71 | */
72 | def enableSeparateBuildPerCPUArchitecture = false
73 |
74 | /**
75 | * Run Proguard to shrink the Java bytecode in release builds.
76 | */
77 | def enableProguardInReleaseBuilds = false
78 |
79 | android {
80 | compileSdkVersion 23
81 | buildToolsVersion "23.0.1"
82 |
83 | defaultConfig {
84 | applicationId "com.sample1"
85 | minSdkVersion 16
86 | targetSdkVersion 22
87 | versionCode 1
88 | versionName "1.0"
89 | ndk {
90 | abiFilters "armeabi-v7a", "x86"
91 | }
92 | }
93 | splits {
94 | abi {
95 | reset()
96 | enable enableSeparateBuildPerCPUArchitecture
97 | universalApk false // If true, also generate a universal APK
98 | include "armeabi-v7a", "x86"
99 | }
100 | }
101 | buildTypes {
102 | release {
103 | minifyEnabled enableProguardInReleaseBuilds
104 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
105 | }
106 | }
107 | // applicationVariants are e.g. debug, release
108 | applicationVariants.all { variant ->
109 | variant.outputs.each { output ->
110 | // For each separate APK per architecture, set a unique version code as described here:
111 | // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
112 | def versionCodes = ["armeabi-v7a":1, "x86":2]
113 | def abi = output.getFilter(OutputFile.ABI)
114 | if (abi != null) { // null for the universal-debug, universal-release variants
115 | output.versionCodeOverride =
116 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
117 | }
118 | }
119 | }
120 | }
121 |
122 | dependencies {
123 | compile fileTree(dir: "libs", include: ["*.jar"])
124 | compile "com.android.support:appcompat-v7:23.0.1"
125 | compile project(':react-native-share-extension')
126 | compile "com.facebook.react:react-native:+" // From node_modules
127 | }
128 |
129 | // Run this once to be able to run the application with BUCK
130 | // puts all compile dependencies into folder libs for BUCK to use
131 | task copyDownloadableDepsToLibs(type: Copy) {
132 | from configurations.compile
133 | into 'libs'
134 | }
135 |
--------------------------------------------------------------------------------
/ios/ReactNativeShareExtension.m:
--------------------------------------------------------------------------------
1 | #import "ReactNativeShareExtension.h"
2 | #import "React/RCTRootView.h"
3 | #import
4 |
5 | #define URL_IDENTIFIER @"public.url"
6 | #define IMAGE_IDENTIFIER @"public.image"
7 | #define TEXT_IDENTIFIER (NSString *)kUTTypePlainText
8 |
9 | NSExtensionContext* extensionContext;
10 |
11 | @implementation ReactNativeShareExtension {
12 | NSTimer *autoTimer;
13 | NSString* type;
14 | NSString* value;
15 | }
16 |
17 | - (UIView*) shareView {
18 | return nil;
19 | }
20 |
21 | RCT_EXPORT_MODULE();
22 |
23 | - (void)viewDidLoad {
24 | [super viewDidLoad];
25 |
26 | //object variable for extension doesn't work for react-native. It must be assign to gloabl
27 | //variable extensionContext. in this way, both exported method can touch extensionContext
28 | extensionContext = self.extensionContext;
29 |
30 | UIView *rootView = [self shareView];
31 | if (rootView.backgroundColor == nil) {
32 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1 green:1 blue:1 alpha:0.1];
33 | }
34 |
35 | self.view = rootView;
36 | }
37 |
38 |
39 | RCT_EXPORT_METHOD(close) {
40 | [extensionContext completeRequestReturningItems:nil
41 | completionHandler:nil];
42 | exit(0);
43 | }
44 |
45 |
46 |
47 | RCT_REMAP_METHOD(data,
48 | resolver:(RCTPromiseResolveBlock)resolve
49 | rejecter:(RCTPromiseRejectBlock)reject)
50 | {
51 | [self extractDataFromContext: extensionContext withCallback:^(NSString* val, NSString* contentType, NSException* err) {
52 | if(err) {
53 | reject(@"error", err.description, nil);
54 | } else {
55 | resolve(@{
56 | @"type": contentType,
57 | @"value": val
58 | });
59 | }
60 | }];
61 | }
62 |
63 | - (void)extractDataFromContext:(NSExtensionContext *)context withCallback:(void(^)(NSString *value, NSString* contentType, NSException *exception))callback {
64 |
65 | @try {
66 | NSExtensionItem *item = [context.inputItems firstObject];
67 | NSArray *attachments = item.attachments;
68 |
69 | __block NSItemProvider *urlProvider = nil;
70 | __block NSItemProvider *imageProvider = nil;
71 | __block NSItemProvider *textProvider = nil;
72 |
73 | [attachments enumerateObjectsUsingBlock:^(NSItemProvider *provider, NSUInteger idx, BOOL *stop) {
74 | if([provider hasItemConformingToTypeIdentifier:URL_IDENTIFIER]) {
75 | urlProvider = provider;
76 | //*stop = YES;
77 | } else if ([provider hasItemConformingToTypeIdentifier:TEXT_IDENTIFIER]){
78 | textProvider = provider;
79 | //*stop = YES;
80 | }/* else if ([provider hasItemConformingToTypeIdentifier:IMAGE_IDENTIFIER]){
81 | imageProvider = provider;
82 | //*stop = YES;
83 | }*/
84 | }];
85 |
86 | if(urlProvider) {
87 | [urlProvider loadItemForTypeIdentifier:URL_IDENTIFIER options:nil completionHandler:^(id item, NSError *error) {
88 | NSURL *url = (NSURL *)item;
89 |
90 | if(callback) {
91 | callback([url absoluteString], @"text/plain", nil);
92 | }
93 | }];
94 | } else if (imageProvider) {
95 | [imageProvider loadItemForTypeIdentifier:IMAGE_IDENTIFIER options:nil completionHandler:^(id item, NSError *error) {
96 |
97 | /**
98 | * Save the image to NSTemporaryDirectory(), which cleans itself tri-daily.
99 | * This is necessary as the iOS 11 screenshot editor gives us a UIImage, while
100 | * sharing from Photos and similar apps gives us a URL
101 | * Therefore the solution is to save a UIImage, either way, and return the local path to that temp UIImage
102 | * This path will be sent to React Native and can be processed and accessed RN side.
103 | **/
104 |
105 | UIImage *sharedImage;
106 | NSString *filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"RNSE_TEMP_IMG"];
107 | NSString *fullPath = [filePath stringByAppendingPathExtension:@"png"];
108 |
109 | if ([(NSObject *)item isKindOfClass:[UIImage class]]){
110 | sharedImage = (UIImage *)item;
111 | }else if ([(NSObject *)item isKindOfClass:[NSURL class]]){
112 | NSURL* url = (NSURL *)item;
113 | NSData *data = [NSData dataWithContentsOfURL:url];
114 | sharedImage = [UIImage imageWithData:data];
115 | }
116 |
117 | [UIImagePNGRepresentation(sharedImage) writeToFile:fullPath atomically:YES];
118 |
119 | if(callback) {
120 | callback(fullPath, [fullPath pathExtension], nil);
121 | }
122 | }];
123 | } else if (textProvider) {
124 | [textProvider loadItemForTypeIdentifier:TEXT_IDENTIFIER options:nil completionHandler:^(id item, NSError *error) {
125 | NSString *text = (NSString *)item;
126 |
127 | if(callback) {
128 | callback(text, @"text/plain", nil);
129 | }
130 | }];
131 | } else {
132 | if(callback) {
133 | callback(nil, nil, [NSException exceptionWithName:@"Error" reason:@"couldn't find provider" userInfo:nil]);
134 | }
135 | }
136 | }
137 | @catch (NSException *exception) {
138 | if(callback) {
139 | callback(nil, nil, exception);
140 | }
141 | }
142 | }
143 |
144 |
145 |
146 | @end
147 |
--------------------------------------------------------------------------------
/bin/react-native-xcode.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Copyright (c) 2015-present, Facebook, Inc.
3 | # All rights reserved.
4 | #
5 | # This source code is licensed under the BSD-style license found in the
6 | # LICENSE file in the root directory of this source tree. An additional grant
7 | # of patent rights can be found in the PATENTS file in the same directory.
8 |
9 | # Bundle React Native app's code and image assets.
10 | # This script is supposed to be invoked as part of Xcode build process
11 | # and relies on environment variables (including PWD) set by Xcode
12 |
13 | DEST=$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH
14 | MAIN_BUNDLE="main.jsbundle"
15 | BUNDLE_FILE="$DEST/$MAIN_BUNDLE"
16 | TMP_PATH="/tmp"
17 | PLISTBUDDY='/usr/libexec/PlistBuddy'
18 | PLIST=$TARGET_BUILD_DIR/$INFOPLIST_PATH
19 |
20 | [ -z "$SKIP_BUNDLING" ] && SKIP_BUNDLING=$($PLISTBUDDY -c "Print :BundleSkipped" "${PLIST}")
21 | [ -z "$CP_BUNDLING" ] && CP_BUNDLING=$($PLISTBUDDY -c "Print :BundleCopied" "${PLIST}")
22 |
23 | if [[ "$SKIP_BUNDLING" && $SKIP_BUNDLING == "true" ]]; then
24 | echo "SKIP_BUNDLING enabled; skipping."
25 | if [[ "$CP_BUNDLING" && $CP_BUNDLING == "true" ]]; then
26 | TMP_BUNDLE="$TMP_PATH/$MAIN_BUNDLE"
27 | echo "CP_BUNDLING enabled; copying $TMP_BUNDLE to $DEST/"
28 | if [ -f "$TMP_BUNDLE" ]; then
29 | cp "$TMP_PATH/$MAIN_BUNDLE"* "$DEST/"
30 | else
31 | echo "CP_BUNDLING $TMP_BUNDLE does not exist!"
32 | fi
33 | fi
34 | exit 0;
35 | fi
36 |
37 | [ -z "$IS_DEV" ] && IS_DEV=$($PLISTBUDDY -c "Print :BundleDev" "${PLIST}")
38 | [ -z "$FORCE_BUNDLING" ] && FORCE_BUNDLING=$($PLISTBUDDY -c "Print :BundleForced" "${PLIST}")
39 |
40 | if [ -z "$IS_DEV" ]; then
41 | case "$CONFIGURATION" in
42 | *Debug*)
43 | if [[ "$PLATFORM_NAME" == *simulator ]]; then
44 | if [[ "$FORCE_BUNDLING" && $FORCE_BUNDLING == "true" ]]; then
45 | echo "FORCE_BUNDLING enabled; continuing to bundle."
46 | else
47 | echo "Skipping bundling in Debug for the Simulator (since the packager bundles for you). Use the FORCE_BUNDLING env flag or BundleForced plist key to change this behavior."
48 | exit 0;
49 | fi
50 | else
51 | echo "Bundling for physical device. Use the SKIP_BUNDLING flag to change this behavior."
52 | fi
53 |
54 | DEV=true
55 | ;;
56 | "")
57 | echo "$0 must be invoked by Xcode"
58 | exit 1
59 | ;;
60 | *)
61 | DEV=false
62 | ;;
63 | esac
64 | else
65 | if [[ "$PLATFORM_NAME" == *simulator ]]; then
66 | if [[ "$FORCE_BUNDLING" && $FORCE_BUNDLING == "true" ]]; then
67 | echo "FORCE_BUNDLING enabled; continuing to bundle."
68 | else
69 | echo "Skipping bundling in Debug for the Simulator (since the packager bundles for you). Use the FORCE_BUNDLING flag to change this behavior."
70 | exit 0;
71 | fi
72 | else
73 | echo "Bundling for physical device. Use the SKIP_BUNDLING flag to change this behavior."
74 | fi
75 | DEV=$IS_DEV
76 | fi
77 |
78 | # Path to react-native folder inside node_modules
79 | # REACT_NATIVE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
80 | # Path to react-native folder inside src/native/utils/bin
81 | REACT_NATIVE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../../node_modules/react-native" && pwd)"
82 | echo "REACT_NATIVE_DIR: $REACT_NATIVE_DIR"
83 |
84 | # Xcode project file for React Native apps is located in ios/ subfolder
85 | cd "${REACT_NATIVE_DIR}"/../..
86 |
87 | # Define NVM_DIR and source the nvm.sh setup script
88 | [ -z "$NVM_DIR" ] && export NVM_DIR="$HOME/.nvm"
89 |
90 | # Define default ENTRY_FILENAME
91 | [ -z "$ENTRY_FILENAME" ] && ENTRY_FILENAME=$($PLISTBUDDY -c "Print :BundleEntryFilename" "${PLIST}")
92 | [ -z "$ENTRY_FILENAME" ] && ENTRY_FILENAME="index.js"
93 | echo "ENTRY_FILENAME: $ENTRY_FILENAME"
94 |
95 | js_file_type=.js
96 | ios_file_type=.ios.js
97 | ios_file_name="${ENTRY_FILENAME/$js_file_type/$ios_file_type}"
98 |
99 | # Define entry file
100 | if [[ -s $ios_file_name ]]; then
101 | ENTRY_FILE=${1:-$ios_file_name}
102 | else
103 | ENTRY_FILE=${1:-$ENTRY_FILENAME}
104 | fi
105 |
106 | if [[ -s "$HOME/.nvm/nvm.sh" ]]; then
107 | . "$HOME/.nvm/nvm.sh"
108 | elif [[ -x "$(command -v brew)" && -s "$(brew --prefix nvm)/nvm.sh" ]]; then
109 | . "$(brew --prefix nvm)/nvm.sh"
110 | fi
111 |
112 | # Set up the nodenv node version manager if present
113 | if [[ -x "$HOME/.nodenv/bin/nodenv" ]]; then
114 | eval "$("$HOME/.nodenv/bin/nodenv" init -)"
115 | fi
116 |
117 | [ -z "$NODE_BINARY" ] && export NODE_BINARY="node"
118 |
119 | [ -z "$CLI_PATH" ] && export CLI_PATH="$REACT_NATIVE_DIR/local-cli/cli.js"
120 |
121 | nodejs_not_found()
122 | {
123 | echo "error: Can't find '$NODE_BINARY' binary to build React Native bundle" >&2
124 | echo "If you have non-standard nodejs installation, select your project in Xcode," >&2
125 | echo "find 'Build Phases' - 'Bundle React Native code and images'" >&2
126 | echo "and change NODE_BINARY to absolute path to your node executable" >&2
127 | echo "(you can find it by invoking 'which node' in the terminal)" >&2
128 | exit 2
129 | }
130 |
131 | type $NODE_BINARY >/dev/null 2>&1 || nodejs_not_found
132 |
133 | # Print commands before executing them (useful for troubleshooting)
134 | set -x
135 | # DEST=$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH
136 |
137 | if [[ "$CONFIGURATION" = "Debug" && ! "$PLATFORM_NAME" == *simulator ]]; then
138 | BUNDLE_SERVER=$($PLISTBUDDY -c "Print :BundleServer" "${PLIST}")
139 | echo "BUNDLE_SERVER: ${BUNDLE_SERVER}"
140 | if [ -z "$BUNDLE_SERVER" ]; then
141 | IP=$(ipconfig getifaddr en0)
142 | if [ -z "$IP" ]; then
143 | IP=$(ifconfig | grep 'inet ' | grep -v ' 127.' | cut -d\ -f2 | awk 'NR==1{print $1}')
144 | fi
145 | else
146 | IP=$BUNDLE_SERVER
147 | fi
148 |
149 | if [ -z ${DISABLE_XIP+x} ]; then
150 | IP="$IP.xip.io"
151 | fi
152 |
153 | $PLISTBUDDY -c "Add NSAppTransportSecurity:NSExceptionDomains:localhost:NSTemporaryExceptionAllowsInsecureHTTPLoads bool true" "$PLIST"
154 | $PLISTBUDDY -c "Add NSAppTransportSecurity:NSExceptionDomains:$IP:NSTemporaryExceptionAllowsInsecureHTTPLoads bool true" "$PLIST"
155 | echo "$IP" > "$DEST/ip.txt"
156 | fi
157 |
158 | $NODE_BINARY "$CLI_PATH" bundle \
159 | --entry-file "$ENTRY_FILE" \
160 | --platform ios \
161 | --dev $DEV \
162 | --reset-cache \
163 | --bundle-output "$BUNDLE_FILE" \
164 | --assets-dest "$DEST"
165 |
166 | if [[ $DEV != true && ! -f "$BUNDLE_FILE" ]]; then
167 | echo "error: File $BUNDLE_FILE does not exist. This must be a bug with" >&2
168 | echo "React Native, please report it here: https://github.com/facebook/react-native/issues"
169 | exit 2
170 | else
171 | cp "$BUNDLE_FILE"* $TMP_PATH
172 | if [[ $DEV == "true" ]]; then
173 | if nc -w 5 -z localhost 8081 ; then
174 | if ! curl -s "http://localhost:8081/status" | grep -q "packager-status:running"; then
175 | echo "Port 8081 already in use, packager is either not running or not running correctly"
176 | exit 0
177 | fi
178 | else
179 | open "$REACT_NATIVE_DIR/scripts/launchPackager.command" || echo "Can't start packager automatically"
180 | fi
181 | fi
182 | fi
183 |
--------------------------------------------------------------------------------
/ios/ReactNativeShareExtension.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 41B5DE3E1D0B50D300949BD5 /* ReactNativeShareExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 41B5DE3D1D0B50D300949BD5 /* ReactNativeShareExtension.m */; };
11 | /* End PBXBuildFile section */
12 |
13 | /* Begin PBXCopyFilesBuildPhase section */
14 | 41B5DE2E1D0B505800949BD5 /* 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 | 41B5DE301D0B505800949BD5 /* libReactNativeShareExtension.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libReactNativeShareExtension.a; sourceTree = BUILT_PRODUCTS_DIR; };
27 | 41B5DE3D1D0B50D300949BD5 /* ReactNativeShareExtension.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ReactNativeShareExtension.m; sourceTree = ""; };
28 | 41B5DE3F1D0B50FA00949BD5 /* ReactNativeShareExtension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ReactNativeShareExtension.h; sourceTree = ""; };
29 | /* End PBXFileReference section */
30 |
31 | /* Begin PBXFrameworksBuildPhase section */
32 | 41B5DE2D1D0B505800949BD5 /* Frameworks */ = {
33 | isa = PBXFrameworksBuildPhase;
34 | buildActionMask = 2147483647;
35 | files = (
36 | );
37 | runOnlyForDeploymentPostprocessing = 0;
38 | };
39 | /* End PBXFrameworksBuildPhase section */
40 |
41 | /* Begin PBXGroup section */
42 | 41B5DE271D0B505800949BD5 = {
43 | isa = PBXGroup;
44 | children = (
45 | 41B5DE3C1D0B506B00949BD5 /* src */,
46 | 41B5DE311D0B505800949BD5 /* Products */,
47 | );
48 | sourceTree = "";
49 | };
50 | 41B5DE311D0B505800949BD5 /* Products */ = {
51 | isa = PBXGroup;
52 | children = (
53 | 41B5DE301D0B505800949BD5 /* libReactNativeShareExtension.a */,
54 | );
55 | name = Products;
56 | sourceTree = "";
57 | };
58 | 41B5DE3C1D0B506B00949BD5 /* src */ = {
59 | isa = PBXGroup;
60 | children = (
61 | 41B5DE3F1D0B50FA00949BD5 /* ReactNativeShareExtension.h */,
62 | 41B5DE3D1D0B50D300949BD5 /* ReactNativeShareExtension.m */,
63 | );
64 | name = src;
65 | sourceTree = "";
66 | };
67 | /* End PBXGroup section */
68 |
69 | /* Begin PBXNativeTarget section */
70 | 41B5DE2F1D0B505800949BD5 /* ReactNativeShareExtension */ = {
71 | isa = PBXNativeTarget;
72 | buildConfigurationList = 41B5DE391D0B505800949BD5 /* Build configuration list for PBXNativeTarget "ReactNativeShareExtension" */;
73 | buildPhases = (
74 | 41B5DE2C1D0B505800949BD5 /* Sources */,
75 | 41B5DE2D1D0B505800949BD5 /* Frameworks */,
76 | 41B5DE2E1D0B505800949BD5 /* CopyFiles */,
77 | );
78 | buildRules = (
79 | );
80 | dependencies = (
81 | );
82 | name = ReactNativeShareExtension;
83 | productName = ReactNativeShareExtension;
84 | productReference = 41B5DE301D0B505800949BD5 /* libReactNativeShareExtension.a */;
85 | productType = "com.apple.product-type.library.static";
86 | };
87 | /* End PBXNativeTarget section */
88 |
89 | /* Begin PBXProject section */
90 | 41B5DE281D0B505800949BD5 /* Project object */ = {
91 | isa = PBXProject;
92 | attributes = {
93 | LastUpgradeCheck = 0730;
94 | ORGANIZATIONNAME = "Ali Najafizadeh";
95 | TargetAttributes = {
96 | 41B5DE2F1D0B505800949BD5 = {
97 | CreatedOnToolsVersion = 7.3.1;
98 | };
99 | };
100 | };
101 | buildConfigurationList = 41B5DE2B1D0B505800949BD5 /* Build configuration list for PBXProject "ReactNativeShareExtension" */;
102 | compatibilityVersion = "Xcode 3.2";
103 | developmentRegion = English;
104 | hasScannedForEncodings = 0;
105 | knownRegions = (
106 | en,
107 | );
108 | mainGroup = 41B5DE271D0B505800949BD5;
109 | productRefGroup = 41B5DE311D0B505800949BD5 /* Products */;
110 | projectDirPath = "";
111 | projectRoot = "";
112 | targets = (
113 | 41B5DE2F1D0B505800949BD5 /* ReactNativeShareExtension */,
114 | );
115 | };
116 | /* End PBXProject section */
117 |
118 | /* Begin PBXSourcesBuildPhase section */
119 | 41B5DE2C1D0B505800949BD5 /* Sources */ = {
120 | isa = PBXSourcesBuildPhase;
121 | buildActionMask = 2147483647;
122 | files = (
123 | 41B5DE3E1D0B50D300949BD5 /* ReactNativeShareExtension.m in Sources */,
124 | );
125 | runOnlyForDeploymentPostprocessing = 0;
126 | };
127 | /* End PBXSourcesBuildPhase section */
128 |
129 | /* Begin XCBuildConfiguration section */
130 | 41B5DE371D0B505800949BD5 /* Debug */ = {
131 | isa = XCBuildConfiguration;
132 | buildSettings = {
133 | ALWAYS_SEARCH_USER_PATHS = NO;
134 | CLANG_ANALYZER_NONNULL = YES;
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_INT_CONVERSION = YES;
145 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
146 | CLANG_WARN_UNREACHABLE_CODE = YES;
147 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
148 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
149 | COPY_PHASE_STRIP = NO;
150 | DEBUG_INFORMATION_FORMAT = dwarf;
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_WARN_64_TO_32_BIT_CONVERSION = YES;
162 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
163 | GCC_WARN_UNDECLARED_SELECTOR = YES;
164 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
165 | GCC_WARN_UNUSED_FUNCTION = YES;
166 | GCC_WARN_UNUSED_VARIABLE = YES;
167 | IPHONEOS_DEPLOYMENT_TARGET = 9.3;
168 | MTL_ENABLE_DEBUG_INFO = YES;
169 | ONLY_ACTIVE_ARCH = YES;
170 | SDKROOT = iphoneos;
171 | };
172 | name = Debug;
173 | };
174 | 41B5DE381D0B505800949BD5 /* Release */ = {
175 | isa = XCBuildConfiguration;
176 | buildSettings = {
177 | ALWAYS_SEARCH_USER_PATHS = NO;
178 | CLANG_ANALYZER_NONNULL = YES;
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_INT_CONVERSION = YES;
189 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
190 | CLANG_WARN_UNREACHABLE_CODE = YES;
191 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
192 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
193 | COPY_PHASE_STRIP = NO;
194 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
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 = 9.3;
206 | MTL_ENABLE_DEBUG_INFO = NO;
207 | SDKROOT = iphoneos;
208 | VALIDATE_PRODUCT = YES;
209 | };
210 | name = Release;
211 | };
212 | 41B5DE3A1D0B505800949BD5 /* Debug */ = {
213 | isa = XCBuildConfiguration;
214 | buildSettings = {
215 | HEADER_SEARCH_PATHS = (
216 | "$(inhereted)",
217 | "$(SRCROOT)/../../../node_module/React/**",
218 | "$(SRCROOT)/../../../node_modules/react-native/React/**",
219 | );
220 | OTHER_LDFLAGS = (
221 | "-ObjC",
222 | "-lc++",
223 | );
224 | PRODUCT_NAME = "$(TARGET_NAME)";
225 | SKIP_INSTALL = YES;
226 | };
227 | name = Debug;
228 | };
229 | 41B5DE3B1D0B505800949BD5 /* Release */ = {
230 | isa = XCBuildConfiguration;
231 | buildSettings = {
232 | HEADER_SEARCH_PATHS = (
233 | "$(inhereted)",
234 | "$(SRCROOT)/../../../node_module/React/**",
235 | "$(SRCROOT)/../../../node_modules/react-native/React/**",
236 | );
237 | OTHER_LDFLAGS = (
238 | "-ObjC",
239 | "-lc++",
240 | );
241 | PRODUCT_NAME = "$(TARGET_NAME)";
242 | SKIP_INSTALL = YES;
243 | };
244 | name = Release;
245 | };
246 | /* End XCBuildConfiguration section */
247 |
248 | /* Begin XCConfigurationList section */
249 | 41B5DE2B1D0B505800949BD5 /* Build configuration list for PBXProject "ReactNativeShareExtension" */ = {
250 | isa = XCConfigurationList;
251 | buildConfigurations = (
252 | 41B5DE371D0B505800949BD5 /* Debug */,
253 | 41B5DE381D0B505800949BD5 /* Release */,
254 | );
255 | defaultConfigurationIsVisible = 0;
256 | defaultConfigurationName = Release;
257 | };
258 | 41B5DE391D0B505800949BD5 /* Build configuration list for PBXNativeTarget "ReactNativeShareExtension" */ = {
259 | isa = XCConfigurationList;
260 | buildConfigurations = (
261 | 41B5DE3A1D0B505800949BD5 /* Debug */,
262 | 41B5DE3B1D0B505800949BD5 /* Release */,
263 | );
264 | defaultConfigurationIsVisible = 0;
265 | };
266 | /* End XCConfigurationList section */
267 | };
268 | rootObject = 41B5DE281D0B505800949BD5 /* Project object */;
269 | }
270 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # React Native Share Extension
2 |
3 | This is a helper module which brings react native as an engine to drive share extension for your app.
4 |
5 |
6 |
7 |
8 |
9 |
10 | # Installation
11 |
12 | Installation should be very easy by just installing it from npm.
13 |
14 | ```js
15 | npm install react-native-share-extension --save
16 | ```
17 |
18 | # Setup
19 |
20 | The setup requires a little bit more work. I will try to describe as detail as possible. I would love to use `rnpm` so I will welcome pull request.
21 |
22 | ## iOS
23 |
24 | - Click on your project's name
25 | - Click on `+` sign
26 |
27 |
28 |
29 |
30 |
31 | - Select `Share Extension` under `iOS > Application Extension`
32 |
33 |
34 |
35 |
36 |
37 | - Select a name for your new share extension, in my case I chose `MyShareEx`
38 |
39 |
40 |
41 |
42 |
43 | - Delete both `ShareViewController.h` and `ShareViewController.m`. make sure to click on the `Move to Trash` button during deletion.
44 |
45 |
46 |
47 |
48 |
49 | - Create a new file under your share extension group, in my case it was `MyShareEx`
50 |
51 |
52 |
53 |
54 |
55 | - Make sure that the type of that object is `Objective-C File`, e.g. for `MyShareEx` name it `MyShareEx.m`
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | - Since we deleted `ShareViewController.m`, we need to tell the storyboard of your share extension where the view needs to be loaded. So click on `MainInterface.storyboard` and replace the class field from `ShareViewController` to whatever you chose above (in my case `MyShareEx`)
66 |
67 |
68 |
69 |
70 |
71 | - Now it's time to add our library. Right click on the `Libraries` group and select `Add Files to "Sample1"...`
72 |
73 |
74 |
75 |
76 |
77 | - select `node_modules` > `react-native-share-extension` > `ios` > `ReactNativeShareExtension.xcodeproj`
78 |
79 |
80 |
81 |
82 |
83 | - Now we need to tell the share extension that we want to read new header files. Click on project name (in my case `Sample1`), then click on your extension name (in my case `MyShareEx`). After that click on Build Settings and search for `Header Search Paths`
84 |
85 |
86 |
87 |
88 |
89 | - Add the new path `$(SRCROOT)/../node_modules/react-native-share-extension/ios` with `recursive` selected
90 |
91 |
92 |
93 |
94 |
95 | - We need to add some linker flags as well, so search for `Other Linker Flags` and add `-ObjC` and `-lc++`
96 |
97 |
98 |
99 |
100 |
101 | - We also need to add all the static libraries such as `React` and `React Native Share Extension`. Select the `General` tab and under `Linked frameworks and Libraries` click on `+` and add all of the selected static binaries there
102 |
103 |
104 |
105 |
106 |
107 | - We need to modify the `Info.plist` inside the extension (e.g. `MyShareEx/Info.plist`) to make sure that our share extension can connect to internet. This is useful if you need your share extension connects to your API server or react-native remote server dev. For doing that we need to `App Transport Security Settings` to `Info.plist`
108 |
109 |
110 |
111 |
112 |
113 | - Now go back to your extension file (in my case `MyShareEx.m`) and paste the following code there **being sure to substitute `MyShareEx` in all three places for whatever you chose above**
114 |
115 | ```objective-c
116 | #import
117 | #import "ReactNativeShareExtension.h"
118 | #import
119 | #import
120 | #import
121 |
122 | @interface MyShareEx : ReactNativeShareExtension
123 | @end
124 |
125 | @implementation MyShareEx
126 |
127 | RCT_EXPORT_MODULE();
128 |
129 | - (UIView*) shareView {
130 | NSURL *jsCodeLocation;
131 |
132 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
133 |
134 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
135 | moduleName:@"MyShareEx"
136 | initialProperties:nil
137 | launchOptions:nil];
138 | rootView.backgroundColor = nil;
139 |
140 | // Uncomment for console output in Xcode console for release mode on device:
141 | // RCTSetLogThreshold(RCTLogLevelInfo - 1);
142 |
143 | return rootView;
144 | }
145 |
146 | @end
147 | ```
148 |
149 | # Set the NSExtensionActivationRule key in your Info.plist
150 |
151 | For the time being, this package only handles sharing of urls specifically from browsers. In order to tell the system to show your extension only when sharing a url, you must set the `NSExtensionActivationRule` key (under `NSExtensionAttributes`) in the share extension's Info.plist file as follows (this is also needed to pass Apple's reveiw):
152 |
153 | ```
154 | NSExtensionAttributes
155 |
156 | NSExtensionActivationRule
157 |
158 | NSExtensionActivationSupportsWebURLWithMaxCount
159 | 1
160 |
161 |
162 | ```
163 |
164 |
165 |
166 |
167 |
168 | Note that while the above will prevent many apps from wrongly sharing using your extension, some apps (e.g., YouTube) will still allow sharing using your extension, which might cause your extension to crash. Check out [this issue](https://github.com/alinz/react-native-share-extension/issues/40) for details.
169 |
170 | For reference about `NSExtensionActivationRule` checkout [Apple's docs](https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html#//apple_ref/doc/uid/TP40014214-CH21-SW8)
171 |
172 |
173 | - Try to build the project, it should now build successfully!
174 |
175 |
176 | ## Android
177 |
178 | - Edit `android/settings.gradle` and add the following
179 |
180 | ```
181 | include ':app', ':react-native-share-extension'
182 |
183 | project(':react-native-share-extension').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-share-extension/android')
184 | ```
185 |
186 | - Edit `android/app/build.gradle` and add the following line before the react section in dependencies
187 |
188 | ```
189 | dependencies {
190 | ...
191 | compile project(':react-native-share-extension')
192 | compile "com.facebook.react:react-native:+"
193 | }
194 | ```
195 |
196 | - Create a folder called `share` under your java project and create two files. Call them `ShareActivity.java` and `ShareApplication.java`....just like your main project.
197 |
198 | - ShareActivity should look like this
199 |
200 | ```java
201 | // define your share project, if your main project is com.sample1, then com.sample1.share makes sense....
202 | package com.sample1.share;
203 |
204 |
205 | // import ReactActivity
206 | import com.facebook.react.ReactActivity;
207 |
208 |
209 | public class ShareActivity extends ReactActivity {
210 | @Override
211 | protected String getMainComponentName() {
212 | // this is the name AppRegistry will use to launch the Share View
213 | return "MyShareEx";
214 | }
215 |
216 | }
217 | ```
218 |
219 | - ShareApplication should now look like this
220 |
221 | ```java
222 | // your package you defined in ShareActivity
223 | package com.sample1.share;
224 | // import build config
225 | import com.sample1.BuildConfig;
226 |
227 | import com.alinz.parkerdan.shareextension.SharePackage;
228 |
229 | import android.app.Application;
230 |
231 | import com.facebook.react.shell.MainReactPackage;
232 | import com.facebook.react.ReactNativeHost;
233 | import com.facebook.react.ReactApplication;
234 | import com.facebook.react.ReactPackage;
235 |
236 | import java.util.Arrays;
237 | import java.util.List;
238 |
239 |
240 | public class ShareApplication extends Application implements ReactApplication {
241 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
242 | @Override
243 | protected boolean getUseDeveloperSupport() {
244 | return BuildConfig.DEBUG;
245 |
246 | }
247 |
248 | @Override
249 | protected List getPackages() {
250 | return Arrays.asList(
251 | new MainReactPackage(),
252 | new SharePackage()
253 | );
254 | }
255 | };
256 |
257 | @Override
258 | public ReactNativeHost getReactNativeHost() {
259 | return mReactNativeHost;
260 | }
261 | }
262 | ```
263 |
264 | - MainApplication should now look like this
265 |
266 | ```java
267 | // your package you defined in ShareActivity
268 | package com.sample1;
269 |
270 | import android.app.Application;
271 | import android.util.Log;
272 |
273 | import com.facebook.react.ReactApplication;
274 | import com.facebook.react.ReactInstanceManager;
275 | import com.facebook.react.ReactNativeHost;
276 | import com.facebook.react.ReactPackage;
277 | import com.facebook.react.shell.MainReactPackage;
278 |
279 | import com.alinz.parkerdan.shareextension.SharePackage;
280 |
281 | import java.util.Arrays;
282 | import java.util.List;
283 |
284 | public class MainApplication extends Application implements ReactApplication {
285 |
286 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
287 | @Override
288 | protected boolean getUseDeveloperSupport() {
289 | return BuildConfig.DEBUG;
290 | }
291 |
292 | @Override
293 | protected List getPackages() {
294 | return Arrays.asList(
295 | new MainReactPackage(),
296 | new SharePackage()
297 | );
298 | }
299 | };
300 |
301 | @Override
302 | public ReactNativeHost getReactNativeHost() {
303 | return mReactNativeHost;
304 | }
305 | }
306 | ```
307 |
308 | - Edit `android/app/src/main/AndroidMainfest.xml` and add the new `activity` right after `devSettingActivity`.
309 |
310 | ```xml
311 |
312 |
313 |
320 |
321 |
322 |
323 | // for sharing links include
324 |
325 | // for sharing photos include
326 |
327 |
328 |
329 | ```
330 |
331 | in this new `activity` I have used 2 variables `@string/title_activity_share` and `@style/Theme.Share.Transparent`, you can add those in `res/values`.
332 |
333 | So in `values/strings.xml`
334 |
335 | ```xml
336 |
337 | ...
338 | MyShareEx
339 |
340 | ```
341 |
342 | and in `values/styles.xml`
343 |
344 | ```xml
345 |
346 | ...
347 |
351 |
352 |
361 |
362 | ```
363 |
364 | - Now you should be able to compile the code without any errors!
365 |
366 | > If you need to add more packages to your share extension, do not override
367 | `getPackages`, instead override the `getMorePackages` method under `ShareExActivity`.
368 |
369 | # Share Component
370 |
371 | So both share extension and main application are using the same code base, or same main.jsbundle file. So the trick to separate Share and Main App is registering 2 different Component entries with `AppRegistry.registerComponent`.
372 |
373 | In both the iOS and Android share extensions we are telling react to load the extension component (in my case `MyShareEx`) from js.
374 |
375 | So in `index.ios.js` and `index.android.js` we are writing the same code:
376 |
377 | ```js
378 | //index.android.js
379 | import React from 'react'
380 | import { AppRegistry } from 'react-native'
381 |
382 | import App from './app.android'
383 | import Share from './share.android'
384 |
385 | AppRegistry.registerComponent('Sample1', () => App)
386 | AppRegistry.registerComponent('MyShareEx', () => Share) // TODO: Replace MyShareEx with my extension name
387 | ```
388 |
389 | ```js
390 | //index.ios.js
391 | import React from 'react'
392 | import { AppRegistry } from 'react-native'
393 |
394 | import App from './app.ios'
395 | import Share from './share.ios'
396 |
397 | AppRegistry.registerComponent('Sample1', () => App)
398 | AppRegistry.registerComponent('MyShareEx', () => Share) // TODO: Replace MyShareEx with my extension name
399 | ```
400 |
401 | So the `app.ios` and `app.android.js` refers to main app and `share.ios.js` and `share.android.js` refers to share extension.
402 |
403 | # Share Extension APIs
404 |
405 | - `data()` is a function that returns a promise. Once the promise is resolved, you get two values, `type` and `value`.
406 |
407 |
408 | ```js
409 | import ShareExtension from 'react-native-share-extension'
410 | ...
411 |
412 | const { type, value } = await ShareExtension.data()
413 | ```
414 |
415 | - `close()`
416 |
417 | Simply closes the share extension and returns the touch event back to application that triggered the share.
418 |
419 | # On iOS: Re-harvesting a shared image
420 |
421 | If your share extension is being used to process shared images (be it to social media or processing the image for information), `react-native-share-extension` will provide a URL within `value` with the location of the image.
422 |
423 | If you wish to pass this URL back down to Swift or Objective-C for whatever reason, you can use the following to convert the URL back into a UIImage:
424 |
425 | ```swift
426 | func harvestImage(from imageURL: String) {
427 | if let imgData = FileManager.default.contents(atPath: imageURL) {
428 | if let img = UIImage(data: data){
429 | // Process image..
430 | }
431 | }
432 | }
433 | ```
434 |
435 | or in Objective-C:
436 |
437 | ```smalltalk
438 | -(void)harvestImage:(NSString *)imageURL {
439 | NSFileManager *fileManager = [NSFileManager defaultManager];
440 | NSData *imgData = [fileManager contentsAtPath:imageURL];
441 | UIImage img = [UIImage imageWithData:imgData];
442 | // Process Image..
443 | }
444 | ```
445 |
446 |
447 | # Test on Device without dev-server
448 |
449 | Because a share extension in ios is treated as a separate container, they do not have access to main app folder. A resolution for this is that you have to build the script twice and package it inside the share extension container. The easiest way of doing this is create a `New Script Phase` in `Build Phases` of your share extension and copy the following line
450 |
451 | ```bash
452 | export NODE_BINARY=node
453 | ../node_modules/react-native/scripts/react-native-xcode.sh
454 | ```
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 | # App and app extension bundles
466 |
467 | The app and app extension bundles can be shared or separated. Separating bundles allows for a minimal footprint for both app and app extension.
468 |
469 | #### plist key legend
470 |
471 | `BundleEntryFilename` - react-native index or shared index filename.
472 |
473 | `BundleSkipped` - Skips bundling when true.
474 |
475 | `BundleCopied` - Copies bundle instead of building when true. (Note: Should be set as true for share extension plist only when bundles are shared.)
476 |
477 | `BundleForced` - Forces bundling when true.
478 |
479 | ### Shared bundles
480 |
481 | The app extension target builds pre-loaded bundle and is copied to the app target.
482 |
483 | #### app plist values
484 |
485 | `BundleEntryFilename` = 'index.js'
486 |
487 | `BundleSkipped` = true
488 |
489 | `BundleCopied` = true
490 |
491 | #### app target's "Bundle React Native code and images" phase
492 | ```
493 | export NODE_BINARY=node
494 | ../bin/react-native-xcode.sh
495 | ```
496 |
497 | #### appShareExtension plist values
498 |
499 | `BundleEntryFilename` = 'index.js'
500 |
501 | `BundleForced` = true
502 |
503 | #### appShareExtension target's "Bundle React Native code and images" phase
504 | ```
505 | cd ../
506 | npm run cp-native-assets
507 | cd ios/
508 | export NODE_BINARY=node
509 | ../bin/react-native-xcode.sh
510 | ```
511 |
512 | ### Separated bundles
513 |
514 | The app extension and app targets build their own unique bundles.
515 |
516 | NSNotificationCenter will kill app extensions that are unable to free memory resources when receiving low memory warnings. Also, shared bundles introduce library/pod dependencies that aren't needed by both apps. Configuring separate bundles via Xcode requires customizing react-native-xcode.sh; a quick example customization can be found in the bin directory. Update the path to the packager in both the app and app extension target's "Bundle React Native code and images" Build Phases.
517 |
518 | Build time can be halved while debugging by disabling the bundle for whichever target you aren't debugging (app or app ex).
519 |
520 | #### app plist values
521 |
522 | `BundleEntryFilename` = 'index.js'
523 |
524 | #### app target's "Bundle React Native code and images" phase
525 | ```
526 | export NODE_BINARY=node
527 | #export ENTRY_FILENAME=index
528 | ../bin/react-native-xcode.sh
529 | ```
530 |
531 | #### appShareExtension plist values
532 |
533 | `BundleEntryFilename` = 'share.index.js'
534 |
535 | `BundleForced` = true
536 |
537 | #### appShareExtension target's "Bundle React Native code and images" phase
538 | ```
539 | cd ../
540 | npm run cp-native-assets
541 | cd ios/
542 | export NODE_BINARY=node
543 | ../bin/react-native-xcode.sh
544 | ```
545 |
546 | # Troubleshooting on iOS devices
547 |
548 | Using the iOS Simulator and remote react-native debugger to develop the extension can hide issues that won't occur until testing on device. If you're experiencing issues running the extension on iOS devices, examine the Xcode console or device log for any obvious errors. If the Xcode console isn't receiving console output, ensure that the OS_ACTIVITY_MODE=disable environment var isn't enabled for the active scheme (see https://github.com/facebook/react-native/issues/10027). OS_ACTIVITY_MODE will hide device logging in the Xcode console, so its use is only advisable for iOS Simulator. For release mode, in order to view console output and see all output in the syslog, uncomment the `RCTSetLogThreshold(RCTLogLevelInfo - 1);` statement in your MyShareEx class.
549 |
550 | 1. If you're using react-native latest, error boundaries might help with JS errors. Another option is to catch render exceptions or test for errors, then render that output with something like a Text component. As long as your share app initializes, you should be able to see yellowbox/redbox errors. If you're not seeing them, you likely have an initialization issue.
551 | 2. Disable bundling on the main target when debugging the extension target, it's not needed when you're not working with the main app.
552 | 3. [Enable breaking on exceptions](http://blog.manbolo.com/2012/01/23/xcode-tips-1-break-on-exceptions). This is helpful if there are any exceptions in the extension itself; perhaps most useful if you've customized the native module.
553 |
554 | # Final note
555 |
556 | I have used `react-native-modalbox` module to handle the showing and hiding share extension which makes the experience more enjoyable for the user.
557 |
558 | Cheers
559 |
--------------------------------------------------------------------------------
/examples/Sample1/ios/Sample1.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
11 | 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
12 | 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; };
13 | 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; };
14 | 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; };
15 | 00E356F31AD99517003FC87E /* Sample1Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* Sample1Tests.m */; };
16 | 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; };
17 | 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; };
18 | 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; };
19 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
20 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; };
21 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
22 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
23 | 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
24 | 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
25 | 415B982E1D7873A50090F804 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 415B982C1D7873A50090F804 /* MainInterface.storyboard */; };
26 | 415B98331D7873A50090F804 /* MyShareEx.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 415B98271D7873A50090F804 /* MyShareEx.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
27 | 415B98421D7873E30090F804 /* MyShareEx.m in Sources */ = {isa = PBXBuildFile; fileRef = 415B98411D7873E30090F804 /* MyShareEx.m */; };
28 | 415B98491D7875630090F804 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
29 | 415B984A1D7875630090F804 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
30 | 415B984B1D7875630090F804 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; };
31 | 415B984C1D7875630090F804 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; };
32 | 415B984D1D7875630090F804 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; };
33 | 415B984E1D7875630090F804 /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; };
34 | 415B984F1D7875630090F804 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
35 | 415B98501D7875630090F804 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; };
36 | 415B98511D7875630090F804 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; };
37 | 415B98521D7875630090F804 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
38 | 415B98531D7875630090F804 /* libReactNativeShareExtension.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 415B98481D7874710090F804 /* libReactNativeShareExtension.a */; };
39 | 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
40 | /* End PBXBuildFile section */
41 |
42 | /* Begin PBXContainerItemProxy section */
43 | 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = {
44 | isa = PBXContainerItemProxy;
45 | containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */;
46 | proxyType = 2;
47 | remoteGlobalIDString = 134814201AA4EA6300B7C361;
48 | remoteInfo = RCTActionSheet;
49 | };
50 | 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */ = {
51 | isa = PBXContainerItemProxy;
52 | containerPortal = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */;
53 | proxyType = 2;
54 | remoteGlobalIDString = 134814201AA4EA6300B7C361;
55 | remoteInfo = RCTGeolocation;
56 | };
57 | 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */ = {
58 | isa = PBXContainerItemProxy;
59 | containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */;
60 | proxyType = 2;
61 | remoteGlobalIDString = 58B5115D1A9E6B3D00147676;
62 | remoteInfo = RCTImage;
63 | };
64 | 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */ = {
65 | isa = PBXContainerItemProxy;
66 | containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */;
67 | proxyType = 2;
68 | remoteGlobalIDString = 58B511DB1A9E6C8500147676;
69 | remoteInfo = RCTNetwork;
70 | };
71 | 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */ = {
72 | isa = PBXContainerItemProxy;
73 | containerPortal = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */;
74 | proxyType = 2;
75 | remoteGlobalIDString = 832C81801AAF6DEF007FA2F7;
76 | remoteInfo = RCTVibration;
77 | };
78 | 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = {
79 | isa = PBXContainerItemProxy;
80 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
81 | proxyType = 1;
82 | remoteGlobalIDString = 13B07F861A680F5B00A75B9A;
83 | remoteInfo = Sample1;
84 | };
85 | 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = {
86 | isa = PBXContainerItemProxy;
87 | containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */;
88 | proxyType = 2;
89 | remoteGlobalIDString = 134814201AA4EA6300B7C361;
90 | remoteInfo = RCTSettings;
91 | };
92 | 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */ = {
93 | isa = PBXContainerItemProxy;
94 | containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
95 | proxyType = 2;
96 | remoteGlobalIDString = 3C86DF461ADF2C930047B81A;
97 | remoteInfo = RCTWebSocket;
98 | };
99 | 146834031AC3E56700842450 /* PBXContainerItemProxy */ = {
100 | isa = PBXContainerItemProxy;
101 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
102 | proxyType = 2;
103 | remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192;
104 | remoteInfo = React;
105 | };
106 | 415B98301D7873A50090F804 /* PBXContainerItemProxy */ = {
107 | isa = PBXContainerItemProxy;
108 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
109 | proxyType = 1;
110 | remoteGlobalIDString = 415B98261D7873A50090F804;
111 | remoteInfo = MyShareEx;
112 | };
113 | 415B98471D7874710090F804 /* PBXContainerItemProxy */ = {
114 | isa = PBXContainerItemProxy;
115 | containerPortal = 415B98431D7874710090F804 /* ReactNativeShareExtension.xcodeproj */;
116 | proxyType = 2;
117 | remoteGlobalIDString = 41B5DE301D0B505800949BD5;
118 | remoteInfo = ReactNativeShareExtension;
119 | };
120 | 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = {
121 | isa = PBXContainerItemProxy;
122 | containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */;
123 | proxyType = 2;
124 | remoteGlobalIDString = 134814201AA4EA6300B7C361;
125 | remoteInfo = RCTLinking;
126 | };
127 | 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = {
128 | isa = PBXContainerItemProxy;
129 | containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */;
130 | proxyType = 2;
131 | remoteGlobalIDString = 58B5119B1A9E6C1200147676;
132 | remoteInfo = RCTText;
133 | };
134 | /* End PBXContainerItemProxy section */
135 |
136 | /* Begin PBXCopyFilesBuildPhase section */
137 | 415B98321D7873A50090F804 /* Embed App Extensions */ = {
138 | isa = PBXCopyFilesBuildPhase;
139 | buildActionMask = 2147483647;
140 | dstPath = "";
141 | dstSubfolderSpec = 13;
142 | files = (
143 | 415B98331D7873A50090F804 /* MyShareEx.appex in Embed App Extensions */,
144 | );
145 | name = "Embed App Extensions";
146 | runOnlyForDeploymentPostprocessing = 0;
147 | };
148 | /* End PBXCopyFilesBuildPhase section */
149 |
150 | /* Begin PBXFileReference section */
151 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; };
152 | 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = ""; };
153 | 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = ""; };
154 | 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = ""; };
155 | 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = ""; };
156 | 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = ""; };
157 | 00E356EE1AD99517003FC87E /* Sample1Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Sample1Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
158 | 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
159 | 00E356F21AD99517003FC87E /* Sample1Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Sample1Tests.m; sourceTree = ""; };
160 | 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = ""; };
161 | 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = ""; };
162 | 13B07F961A680F5B00A75B9A /* Sample1.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Sample1.app; sourceTree = BUILT_PRODUCTS_DIR; };
163 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = Sample1/AppDelegate.h; sourceTree = ""; };
164 | 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = Sample1/AppDelegate.m; sourceTree = ""; };
165 | 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; };
166 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = Sample1/Images.xcassets; sourceTree = ""; };
167 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Sample1/Info.plist; sourceTree = ""; };
168 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Sample1/main.m; sourceTree = ""; };
169 | 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; };
170 | 415B98271D7873A50090F804 /* MyShareEx.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = MyShareEx.appex; sourceTree = BUILT_PRODUCTS_DIR; };
171 | 415B982D1D7873A50090F804 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = ""; };
172 | 415B982F1D7873A50090F804 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
173 | 415B98411D7873E30090F804 /* MyShareEx.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyShareEx.m; sourceTree = ""; };
174 | 415B98431D7874710090F804 /* ReactNativeShareExtension.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = ReactNativeShareExtension.xcodeproj; path = "../node_modules/react-native-share-extension/ios/ReactNativeShareExtension.xcodeproj"; sourceTree = ""; };
175 | 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; };
176 | 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; };
177 | /* End PBXFileReference section */
178 |
179 | /* Begin PBXFrameworksBuildPhase section */
180 | 00E356EB1AD99517003FC87E /* Frameworks */ = {
181 | isa = PBXFrameworksBuildPhase;
182 | buildActionMask = 2147483647;
183 | files = (
184 | 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */,
185 | );
186 | runOnlyForDeploymentPostprocessing = 0;
187 | };
188 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = {
189 | isa = PBXFrameworksBuildPhase;
190 | buildActionMask = 2147483647;
191 | files = (
192 | 146834051AC3E58100842450 /* libReact.a in Frameworks */,
193 | 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */,
194 | 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */,
195 | 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */,
196 | 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */,
197 | 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */,
198 | 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */,
199 | 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */,
200 | 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
201 | 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
202 | );
203 | runOnlyForDeploymentPostprocessing = 0;
204 | };
205 | 415B98241D7873A50090F804 /* Frameworks */ = {
206 | isa = PBXFrameworksBuildPhase;
207 | buildActionMask = 2147483647;
208 | files = (
209 | 415B98491D7875630090F804 /* libRCTActionSheet.a in Frameworks */,
210 | 415B984A1D7875630090F804 /* libRCTGeolocation.a in Frameworks */,
211 | 415B984B1D7875630090F804 /* libRCTImage.a in Frameworks */,
212 | 415B984C1D7875630090F804 /* libRCTLinking.a in Frameworks */,
213 | 415B984D1D7875630090F804 /* libRCTNetwork.a in Frameworks */,
214 | 415B984E1D7875630090F804 /* libRCTSettings.a in Frameworks */,
215 | 415B984F1D7875630090F804 /* libRCTText.a in Frameworks */,
216 | 415B98501D7875630090F804 /* libRCTVibration.a in Frameworks */,
217 | 415B98511D7875630090F804 /* libRCTWebSocket.a in Frameworks */,
218 | 415B98521D7875630090F804 /* libReact.a in Frameworks */,
219 | 415B98531D7875630090F804 /* libReactNativeShareExtension.a in Frameworks */,
220 | );
221 | runOnlyForDeploymentPostprocessing = 0;
222 | };
223 | /* End PBXFrameworksBuildPhase section */
224 |
225 | /* Begin PBXGroup section */
226 | 00C302A81ABCB8CE00DB3ED1 /* Products */ = {
227 | isa = PBXGroup;
228 | children = (
229 | 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */,
230 | );
231 | name = Products;
232 | sourceTree = "";
233 | };
234 | 00C302B61ABCB90400DB3ED1 /* Products */ = {
235 | isa = PBXGroup;
236 | children = (
237 | 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */,
238 | );
239 | name = Products;
240 | sourceTree = "";
241 | };
242 | 00C302BC1ABCB91800DB3ED1 /* Products */ = {
243 | isa = PBXGroup;
244 | children = (
245 | 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */,
246 | );
247 | name = Products;
248 | sourceTree = "";
249 | };
250 | 00C302D41ABCB9D200DB3ED1 /* Products */ = {
251 | isa = PBXGroup;
252 | children = (
253 | 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */,
254 | );
255 | name = Products;
256 | sourceTree = "";
257 | };
258 | 00C302E01ABCB9EE00DB3ED1 /* Products */ = {
259 | isa = PBXGroup;
260 | children = (
261 | 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */,
262 | );
263 | name = Products;
264 | sourceTree = "";
265 | };
266 | 00E356EF1AD99517003FC87E /* Sample1Tests */ = {
267 | isa = PBXGroup;
268 | children = (
269 | 00E356F21AD99517003FC87E /* Sample1Tests.m */,
270 | 00E356F01AD99517003FC87E /* Supporting Files */,
271 | );
272 | path = Sample1Tests;
273 | sourceTree = "";
274 | };
275 | 00E356F01AD99517003FC87E /* Supporting Files */ = {
276 | isa = PBXGroup;
277 | children = (
278 | 00E356F11AD99517003FC87E /* Info.plist */,
279 | );
280 | name = "Supporting Files";
281 | sourceTree = "";
282 | };
283 | 139105B71AF99BAD00B5F7CC /* Products */ = {
284 | isa = PBXGroup;
285 | children = (
286 | 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */,
287 | );
288 | name = Products;
289 | sourceTree = "";
290 | };
291 | 139FDEE71B06529A00C62182 /* Products */ = {
292 | isa = PBXGroup;
293 | children = (
294 | 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */,
295 | );
296 | name = Products;
297 | sourceTree = "";
298 | };
299 | 13B07FAE1A68108700A75B9A /* Sample1 */ = {
300 | isa = PBXGroup;
301 | children = (
302 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */,
303 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */,
304 | 13B07FB01A68108700A75B9A /* AppDelegate.m */,
305 | 13B07FB51A68108700A75B9A /* Images.xcassets */,
306 | 13B07FB61A68108700A75B9A /* Info.plist */,
307 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */,
308 | 13B07FB71A68108700A75B9A /* main.m */,
309 | );
310 | name = Sample1;
311 | sourceTree = "";
312 | };
313 | 146834001AC3E56700842450 /* Products */ = {
314 | isa = PBXGroup;
315 | children = (
316 | 146834041AC3E56700842450 /* libReact.a */,
317 | );
318 | name = Products;
319 | sourceTree = "";
320 | };
321 | 415B98281D7873A50090F804 /* MyShareEx */ = {
322 | isa = PBXGroup;
323 | children = (
324 | 415B98411D7873E30090F804 /* MyShareEx.m */,
325 | 415B982C1D7873A50090F804 /* MainInterface.storyboard */,
326 | 415B982F1D7873A50090F804 /* Info.plist */,
327 | );
328 | path = MyShareEx;
329 | sourceTree = "";
330 | };
331 | 415B98441D7874710090F804 /* Products */ = {
332 | isa = PBXGroup;
333 | children = (
334 | 415B98481D7874710090F804 /* libReactNativeShareExtension.a */,
335 | );
336 | name = Products;
337 | sourceTree = "";
338 | };
339 | 78C398B11ACF4ADC00677621 /* Products */ = {
340 | isa = PBXGroup;
341 | children = (
342 | 78C398B91ACF4ADC00677621 /* libRCTLinking.a */,
343 | );
344 | name = Products;
345 | sourceTree = "";
346 | };
347 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = {
348 | isa = PBXGroup;
349 | children = (
350 | 415B98431D7874710090F804 /* ReactNativeShareExtension.xcodeproj */,
351 | 146833FF1AC3E56700842450 /* React.xcodeproj */,
352 | 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */,
353 | 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */,
354 | 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */,
355 | 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */,
356 | 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */,
357 | 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */,
358 | 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */,
359 | 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
360 | 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
361 | );
362 | name = Libraries;
363 | sourceTree = "";
364 | };
365 | 832341B11AAA6A8300B99B32 /* Products */ = {
366 | isa = PBXGroup;
367 | children = (
368 | 832341B51AAA6A8300B99B32 /* libRCTText.a */,
369 | );
370 | name = Products;
371 | sourceTree = "";
372 | };
373 | 83CBB9F61A601CBA00E9B192 = {
374 | isa = PBXGroup;
375 | children = (
376 | 13B07FAE1A68108700A75B9A /* Sample1 */,
377 | 832341AE1AAA6A7D00B99B32 /* Libraries */,
378 | 00E356EF1AD99517003FC87E /* Sample1Tests */,
379 | 415B98281D7873A50090F804 /* MyShareEx */,
380 | 83CBBA001A601CBA00E9B192 /* Products */,
381 | );
382 | indentWidth = 2;
383 | sourceTree = "";
384 | tabWidth = 2;
385 | };
386 | 83CBBA001A601CBA00E9B192 /* Products */ = {
387 | isa = PBXGroup;
388 | children = (
389 | 13B07F961A680F5B00A75B9A /* Sample1.app */,
390 | 00E356EE1AD99517003FC87E /* Sample1Tests.xctest */,
391 | 415B98271D7873A50090F804 /* MyShareEx.appex */,
392 | );
393 | name = Products;
394 | sourceTree = "";
395 | };
396 | /* End PBXGroup section */
397 |
398 | /* Begin PBXNativeTarget section */
399 | 00E356ED1AD99517003FC87E /* Sample1Tests */ = {
400 | isa = PBXNativeTarget;
401 | buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "Sample1Tests" */;
402 | buildPhases = (
403 | 00E356EA1AD99517003FC87E /* Sources */,
404 | 00E356EB1AD99517003FC87E /* Frameworks */,
405 | 00E356EC1AD99517003FC87E /* Resources */,
406 | );
407 | buildRules = (
408 | );
409 | dependencies = (
410 | 00E356F51AD99517003FC87E /* PBXTargetDependency */,
411 | );
412 | name = Sample1Tests;
413 | productName = Sample1Tests;
414 | productReference = 00E356EE1AD99517003FC87E /* Sample1Tests.xctest */;
415 | productType = "com.apple.product-type.bundle.unit-test";
416 | };
417 | 13B07F861A680F5B00A75B9A /* Sample1 */ = {
418 | isa = PBXNativeTarget;
419 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Sample1" */;
420 | buildPhases = (
421 | 13B07F871A680F5B00A75B9A /* Sources */,
422 | 13B07F8C1A680F5B00A75B9A /* Frameworks */,
423 | 13B07F8E1A680F5B00A75B9A /* Resources */,
424 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
425 | 415B98321D7873A50090F804 /* Embed App Extensions */,
426 | );
427 | buildRules = (
428 | );
429 | dependencies = (
430 | 415B98311D7873A50090F804 /* PBXTargetDependency */,
431 | );
432 | name = Sample1;
433 | productName = "Hello World";
434 | productReference = 13B07F961A680F5B00A75B9A /* Sample1.app */;
435 | productType = "com.apple.product-type.application";
436 | };
437 | 415B98261D7873A50090F804 /* MyShareEx */ = {
438 | isa = PBXNativeTarget;
439 | buildConfigurationList = 415B98401D7873A50090F804 /* Build configuration list for PBXNativeTarget "MyShareEx" */;
440 | buildPhases = (
441 | 415B98231D7873A50090F804 /* Sources */,
442 | 415B98241D7873A50090F804 /* Frameworks */,
443 | 415B98251D7873A50090F804 /* Resources */,
444 | 415B98541D78760C0090F804 /* Bundle React Native code and images */,
445 | );
446 | buildRules = (
447 | );
448 | dependencies = (
449 | );
450 | name = MyShareEx;
451 | productName = MyShareEx;
452 | productReference = 415B98271D7873A50090F804 /* MyShareEx.appex */;
453 | productType = "com.apple.product-type.app-extension";
454 | };
455 | /* End PBXNativeTarget section */
456 |
457 | /* Begin PBXProject section */
458 | 83CBB9F71A601CBA00E9B192 /* Project object */ = {
459 | isa = PBXProject;
460 | attributes = {
461 | LastUpgradeCheck = 0610;
462 | ORGANIZATIONNAME = Facebook;
463 | TargetAttributes = {
464 | 00E356ED1AD99517003FC87E = {
465 | CreatedOnToolsVersion = 6.2;
466 | TestTargetID = 13B07F861A680F5B00A75B9A;
467 | };
468 | 415B98261D7873A50090F804 = {
469 | CreatedOnToolsVersion = 7.3.1;
470 | };
471 | };
472 | };
473 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Sample1" */;
474 | compatibilityVersion = "Xcode 3.2";
475 | developmentRegion = English;
476 | hasScannedForEncodings = 0;
477 | knownRegions = (
478 | en,
479 | Base,
480 | );
481 | mainGroup = 83CBB9F61A601CBA00E9B192;
482 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
483 | projectDirPath = "";
484 | projectReferences = (
485 | {
486 | ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */;
487 | ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */;
488 | },
489 | {
490 | ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */;
491 | ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */;
492 | },
493 | {
494 | ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */;
495 | ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */;
496 | },
497 | {
498 | ProductGroup = 78C398B11ACF4ADC00677621 /* Products */;
499 | ProjectRef = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */;
500 | },
501 | {
502 | ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */;
503 | ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */;
504 | },
505 | {
506 | ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */;
507 | ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */;
508 | },
509 | {
510 | ProductGroup = 832341B11AAA6A8300B99B32 /* Products */;
511 | ProjectRef = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */;
512 | },
513 | {
514 | ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */;
515 | ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */;
516 | },
517 | {
518 | ProductGroup = 139FDEE71B06529A00C62182 /* Products */;
519 | ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */;
520 | },
521 | {
522 | ProductGroup = 146834001AC3E56700842450 /* Products */;
523 | ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
524 | },
525 | {
526 | ProductGroup = 415B98441D7874710090F804 /* Products */;
527 | ProjectRef = 415B98431D7874710090F804 /* ReactNativeShareExtension.xcodeproj */;
528 | },
529 | );
530 | projectRoot = "";
531 | targets = (
532 | 13B07F861A680F5B00A75B9A /* Sample1 */,
533 | 00E356ED1AD99517003FC87E /* Sample1Tests */,
534 | 415B98261D7873A50090F804 /* MyShareEx */,
535 | );
536 | };
537 | /* End PBXProject section */
538 |
539 | /* Begin PBXReferenceProxy section */
540 | 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = {
541 | isa = PBXReferenceProxy;
542 | fileType = archive.ar;
543 | path = libRCTActionSheet.a;
544 | remoteRef = 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */;
545 | sourceTree = BUILT_PRODUCTS_DIR;
546 | };
547 | 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */ = {
548 | isa = PBXReferenceProxy;
549 | fileType = archive.ar;
550 | path = libRCTGeolocation.a;
551 | remoteRef = 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */;
552 | sourceTree = BUILT_PRODUCTS_DIR;
553 | };
554 | 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */ = {
555 | isa = PBXReferenceProxy;
556 | fileType = archive.ar;
557 | path = libRCTImage.a;
558 | remoteRef = 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */;
559 | sourceTree = BUILT_PRODUCTS_DIR;
560 | };
561 | 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */ = {
562 | isa = PBXReferenceProxy;
563 | fileType = archive.ar;
564 | path = libRCTNetwork.a;
565 | remoteRef = 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */;
566 | sourceTree = BUILT_PRODUCTS_DIR;
567 | };
568 | 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */ = {
569 | isa = PBXReferenceProxy;
570 | fileType = archive.ar;
571 | path = libRCTVibration.a;
572 | remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */;
573 | sourceTree = BUILT_PRODUCTS_DIR;
574 | };
575 | 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = {
576 | isa = PBXReferenceProxy;
577 | fileType = archive.ar;
578 | path = libRCTSettings.a;
579 | remoteRef = 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */;
580 | sourceTree = BUILT_PRODUCTS_DIR;
581 | };
582 | 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */ = {
583 | isa = PBXReferenceProxy;
584 | fileType = archive.ar;
585 | path = libRCTWebSocket.a;
586 | remoteRef = 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */;
587 | sourceTree = BUILT_PRODUCTS_DIR;
588 | };
589 | 146834041AC3E56700842450 /* libReact.a */ = {
590 | isa = PBXReferenceProxy;
591 | fileType = archive.ar;
592 | path = libReact.a;
593 | remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */;
594 | sourceTree = BUILT_PRODUCTS_DIR;
595 | };
596 | 415B98481D7874710090F804 /* libReactNativeShareExtension.a */ = {
597 | isa = PBXReferenceProxy;
598 | fileType = archive.ar;
599 | path = libReactNativeShareExtension.a;
600 | remoteRef = 415B98471D7874710090F804 /* PBXContainerItemProxy */;
601 | sourceTree = BUILT_PRODUCTS_DIR;
602 | };
603 | 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = {
604 | isa = PBXReferenceProxy;
605 | fileType = archive.ar;
606 | path = libRCTLinking.a;
607 | remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */;
608 | sourceTree = BUILT_PRODUCTS_DIR;
609 | };
610 | 832341B51AAA6A8300B99B32 /* libRCTText.a */ = {
611 | isa = PBXReferenceProxy;
612 | fileType = archive.ar;
613 | path = libRCTText.a;
614 | remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */;
615 | sourceTree = BUILT_PRODUCTS_DIR;
616 | };
617 | /* End PBXReferenceProxy section */
618 |
619 | /* Begin PBXResourcesBuildPhase section */
620 | 00E356EC1AD99517003FC87E /* Resources */ = {
621 | isa = PBXResourcesBuildPhase;
622 | buildActionMask = 2147483647;
623 | files = (
624 | );
625 | runOnlyForDeploymentPostprocessing = 0;
626 | };
627 | 13B07F8E1A680F5B00A75B9A /* Resources */ = {
628 | isa = PBXResourcesBuildPhase;
629 | buildActionMask = 2147483647;
630 | files = (
631 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
632 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */,
633 | );
634 | runOnlyForDeploymentPostprocessing = 0;
635 | };
636 | 415B98251D7873A50090F804 /* Resources */ = {
637 | isa = PBXResourcesBuildPhase;
638 | buildActionMask = 2147483647;
639 | files = (
640 | 415B982E1D7873A50090F804 /* MainInterface.storyboard in Resources */,
641 | );
642 | runOnlyForDeploymentPostprocessing = 0;
643 | };
644 | /* End PBXResourcesBuildPhase section */
645 |
646 | /* Begin PBXShellScriptBuildPhase section */
647 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = {
648 | isa = PBXShellScriptBuildPhase;
649 | buildActionMask = 2147483647;
650 | files = (
651 | );
652 | inputPaths = (
653 | );
654 | name = "Bundle React Native code and images";
655 | outputPaths = (
656 | );
657 | runOnlyForDeploymentPostprocessing = 0;
658 | shellPath = /bin/sh;
659 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh";
660 | };
661 | 415B98541D78760C0090F804 /* Bundle React Native code and images */ = {
662 | isa = PBXShellScriptBuildPhase;
663 | buildActionMask = 2147483647;
664 | files = (
665 | );
666 | inputPaths = (
667 | );
668 | name = "Bundle React Native code and images";
669 | outputPaths = (
670 | );
671 | runOnlyForDeploymentPostprocessing = 0;
672 | shellPath = /bin/sh;
673 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh";
674 | };
675 | /* End PBXShellScriptBuildPhase section */
676 |
677 | /* Begin PBXSourcesBuildPhase section */
678 | 00E356EA1AD99517003FC87E /* Sources */ = {
679 | isa = PBXSourcesBuildPhase;
680 | buildActionMask = 2147483647;
681 | files = (
682 | 00E356F31AD99517003FC87E /* Sample1Tests.m in Sources */,
683 | );
684 | runOnlyForDeploymentPostprocessing = 0;
685 | };
686 | 13B07F871A680F5B00A75B9A /* Sources */ = {
687 | isa = PBXSourcesBuildPhase;
688 | buildActionMask = 2147483647;
689 | files = (
690 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */,
691 | 13B07FC11A68108700A75B9A /* main.m in Sources */,
692 | );
693 | runOnlyForDeploymentPostprocessing = 0;
694 | };
695 | 415B98231D7873A50090F804 /* Sources */ = {
696 | isa = PBXSourcesBuildPhase;
697 | buildActionMask = 2147483647;
698 | files = (
699 | 415B98421D7873E30090F804 /* MyShareEx.m in Sources */,
700 | );
701 | runOnlyForDeploymentPostprocessing = 0;
702 | };
703 | /* End PBXSourcesBuildPhase section */
704 |
705 | /* Begin PBXTargetDependency section */
706 | 00E356F51AD99517003FC87E /* PBXTargetDependency */ = {
707 | isa = PBXTargetDependency;
708 | target = 13B07F861A680F5B00A75B9A /* Sample1 */;
709 | targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */;
710 | };
711 | 415B98311D7873A50090F804 /* PBXTargetDependency */ = {
712 | isa = PBXTargetDependency;
713 | target = 415B98261D7873A50090F804 /* MyShareEx */;
714 | targetProxy = 415B98301D7873A50090F804 /* PBXContainerItemProxy */;
715 | };
716 | /* End PBXTargetDependency section */
717 |
718 | /* Begin PBXVariantGroup section */
719 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = {
720 | isa = PBXVariantGroup;
721 | children = (
722 | 13B07FB21A68108700A75B9A /* Base */,
723 | );
724 | name = LaunchScreen.xib;
725 | path = Sample1;
726 | sourceTree = "";
727 | };
728 | 415B982C1D7873A50090F804 /* MainInterface.storyboard */ = {
729 | isa = PBXVariantGroup;
730 | children = (
731 | 415B982D1D7873A50090F804 /* Base */,
732 | );
733 | name = MainInterface.storyboard;
734 | sourceTree = "";
735 | };
736 | /* End PBXVariantGroup section */
737 |
738 | /* Begin XCBuildConfiguration section */
739 | 00E356F61AD99517003FC87E /* Debug */ = {
740 | isa = XCBuildConfiguration;
741 | buildSettings = {
742 | BUNDLE_LOADER = "$(TEST_HOST)";
743 | GCC_PREPROCESSOR_DEFINITIONS = (
744 | "DEBUG=1",
745 | "$(inherited)",
746 | );
747 | INFOPLIST_FILE = Sample1Tests/Info.plist;
748 | IPHONEOS_DEPLOYMENT_TARGET = 8.2;
749 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
750 | PRODUCT_NAME = "$(TARGET_NAME)";
751 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Sample1.app/Sample1";
752 | };
753 | name = Debug;
754 | };
755 | 00E356F71AD99517003FC87E /* Release */ = {
756 | isa = XCBuildConfiguration;
757 | buildSettings = {
758 | BUNDLE_LOADER = "$(TEST_HOST)";
759 | COPY_PHASE_STRIP = NO;
760 | INFOPLIST_FILE = Sample1Tests/Info.plist;
761 | IPHONEOS_DEPLOYMENT_TARGET = 8.2;
762 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
763 | PRODUCT_NAME = "$(TARGET_NAME)";
764 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Sample1.app/Sample1";
765 | };
766 | name = Release;
767 | };
768 | 13B07F941A680F5B00A75B9A /* Debug */ = {
769 | isa = XCBuildConfiguration;
770 | buildSettings = {
771 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
772 | DEAD_CODE_STRIPPING = NO;
773 | HEADER_SEARCH_PATHS = (
774 | "$(inherited)",
775 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
776 | "$(SRCROOT)/../node_modules/react-native/React/**",
777 | );
778 | INFOPLIST_FILE = Sample1/Info.plist;
779 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
780 | OTHER_LDFLAGS = (
781 | "$(inherited)",
782 | "-ObjC",
783 | "-lc++",
784 | );
785 | PRODUCT_NAME = Sample1;
786 | };
787 | name = Debug;
788 | };
789 | 13B07F951A680F5B00A75B9A /* Release */ = {
790 | isa = XCBuildConfiguration;
791 | buildSettings = {
792 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
793 | HEADER_SEARCH_PATHS = (
794 | "$(inherited)",
795 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
796 | "$(SRCROOT)/../node_modules/react-native/React/**",
797 | );
798 | INFOPLIST_FILE = Sample1/Info.plist;
799 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
800 | OTHER_LDFLAGS = (
801 | "$(inherited)",
802 | "-ObjC",
803 | "-lc++",
804 | );
805 | PRODUCT_NAME = Sample1;
806 | };
807 | name = Release;
808 | };
809 | 415B98341D7873A50090F804 /* Debug */ = {
810 | isa = XCBuildConfiguration;
811 | buildSettings = {
812 | CLANG_ANALYZER_NONNULL = YES;
813 | DEBUG_INFORMATION_FORMAT = dwarf;
814 | ENABLE_TESTABILITY = YES;
815 | GCC_NO_COMMON_BLOCKS = YES;
816 | INFOPLIST_FILE = MyShareEx/Info.plist;
817 | IPHONEOS_DEPLOYMENT_TARGET = 9.3;
818 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
819 | PRODUCT_BUNDLE_IDENTIFIER = org.reactjs.native.example.Sample1.MyShareEx;
820 | PRODUCT_NAME = "$(TARGET_NAME)";
821 | SKIP_INSTALL = YES;
822 | };
823 | name = Debug;
824 | };
825 | 415B98351D7873A50090F804 /* Release */ = {
826 | isa = XCBuildConfiguration;
827 | buildSettings = {
828 | CLANG_ANALYZER_NONNULL = YES;
829 | COPY_PHASE_STRIP = NO;
830 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
831 | GCC_NO_COMMON_BLOCKS = YES;
832 | INFOPLIST_FILE = MyShareEx/Info.plist;
833 | IPHONEOS_DEPLOYMENT_TARGET = 9.3;
834 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
835 | PRODUCT_BUNDLE_IDENTIFIER = org.reactjs.native.example.Sample1.MyShareEx;
836 | PRODUCT_NAME = "$(TARGET_NAME)";
837 | SKIP_INSTALL = YES;
838 | };
839 | name = Release;
840 | };
841 | 83CBBA201A601CBA00E9B192 /* Debug */ = {
842 | isa = XCBuildConfiguration;
843 | buildSettings = {
844 | ALWAYS_SEARCH_USER_PATHS = NO;
845 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
846 | CLANG_CXX_LIBRARY = "libc++";
847 | CLANG_ENABLE_MODULES = YES;
848 | CLANG_ENABLE_OBJC_ARC = YES;
849 | CLANG_WARN_BOOL_CONVERSION = YES;
850 | CLANG_WARN_CONSTANT_CONVERSION = YES;
851 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
852 | CLANG_WARN_EMPTY_BODY = YES;
853 | CLANG_WARN_ENUM_CONVERSION = YES;
854 | CLANG_WARN_INT_CONVERSION = YES;
855 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
856 | CLANG_WARN_UNREACHABLE_CODE = YES;
857 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
858 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
859 | COPY_PHASE_STRIP = NO;
860 | ENABLE_STRICT_OBJC_MSGSEND = YES;
861 | GCC_C_LANGUAGE_STANDARD = gnu99;
862 | GCC_DYNAMIC_NO_PIC = NO;
863 | GCC_OPTIMIZATION_LEVEL = 0;
864 | GCC_PREPROCESSOR_DEFINITIONS = (
865 | "DEBUG=1",
866 | "$(inherited)",
867 | );
868 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
869 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
870 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
871 | GCC_WARN_UNDECLARED_SELECTOR = YES;
872 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
873 | GCC_WARN_UNUSED_FUNCTION = YES;
874 | GCC_WARN_UNUSED_VARIABLE = YES;
875 | HEADER_SEARCH_PATHS = (
876 | "$(inherited)",
877 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
878 | "$(SRCROOT)/../node_modules/react-native/React/**",
879 | "$(SRCROOT)/../node_modules/react-native-share-extension/ios/**",
880 | );
881 | IPHONEOS_DEPLOYMENT_TARGET = 7.0;
882 | MTL_ENABLE_DEBUG_INFO = YES;
883 | ONLY_ACTIVE_ARCH = YES;
884 | OTHER_LDFLAGS = (
885 | "-ObjC",
886 | "-lc++",
887 | );
888 | SDKROOT = iphoneos;
889 | };
890 | name = Debug;
891 | };
892 | 83CBBA211A601CBA00E9B192 /* Release */ = {
893 | isa = XCBuildConfiguration;
894 | buildSettings = {
895 | ALWAYS_SEARCH_USER_PATHS = NO;
896 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
897 | CLANG_CXX_LIBRARY = "libc++";
898 | CLANG_ENABLE_MODULES = YES;
899 | CLANG_ENABLE_OBJC_ARC = YES;
900 | CLANG_WARN_BOOL_CONVERSION = YES;
901 | CLANG_WARN_CONSTANT_CONVERSION = YES;
902 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
903 | CLANG_WARN_EMPTY_BODY = YES;
904 | CLANG_WARN_ENUM_CONVERSION = YES;
905 | CLANG_WARN_INT_CONVERSION = YES;
906 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
907 | CLANG_WARN_UNREACHABLE_CODE = YES;
908 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
909 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
910 | COPY_PHASE_STRIP = YES;
911 | ENABLE_NS_ASSERTIONS = NO;
912 | ENABLE_STRICT_OBJC_MSGSEND = YES;
913 | GCC_C_LANGUAGE_STANDARD = gnu99;
914 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
915 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
916 | GCC_WARN_UNDECLARED_SELECTOR = YES;
917 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
918 | GCC_WARN_UNUSED_FUNCTION = YES;
919 | GCC_WARN_UNUSED_VARIABLE = YES;
920 | HEADER_SEARCH_PATHS = (
921 | "$(inherited)",
922 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
923 | "$(SRCROOT)/../node_modules/react-native/React/**",
924 | "$(SRCROOT)/../node_modules/react-native-share-extension/ios/**",
925 | );
926 | IPHONEOS_DEPLOYMENT_TARGET = 7.0;
927 | MTL_ENABLE_DEBUG_INFO = NO;
928 | OTHER_LDFLAGS = (
929 | "-ObjC",
930 | "-lc++",
931 | );
932 | SDKROOT = iphoneos;
933 | VALIDATE_PRODUCT = YES;
934 | };
935 | name = Release;
936 | };
937 | /* End XCBuildConfiguration section */
938 |
939 | /* Begin XCConfigurationList section */
940 | 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "Sample1Tests" */ = {
941 | isa = XCConfigurationList;
942 | buildConfigurations = (
943 | 00E356F61AD99517003FC87E /* Debug */,
944 | 00E356F71AD99517003FC87E /* Release */,
945 | );
946 | defaultConfigurationIsVisible = 0;
947 | defaultConfigurationName = Release;
948 | };
949 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Sample1" */ = {
950 | isa = XCConfigurationList;
951 | buildConfigurations = (
952 | 13B07F941A680F5B00A75B9A /* Debug */,
953 | 13B07F951A680F5B00A75B9A /* Release */,
954 | );
955 | defaultConfigurationIsVisible = 0;
956 | defaultConfigurationName = Release;
957 | };
958 | 415B98401D7873A50090F804 /* Build configuration list for PBXNativeTarget "MyShareEx" */ = {
959 | isa = XCConfigurationList;
960 | buildConfigurations = (
961 | 415B98341D7873A50090F804 /* Debug */,
962 | 415B98351D7873A50090F804 /* Release */,
963 | );
964 | defaultConfigurationIsVisible = 0;
965 | };
966 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Sample1" */ = {
967 | isa = XCConfigurationList;
968 | buildConfigurations = (
969 | 83CBBA201A601CBA00E9B192 /* Debug */,
970 | 83CBBA211A601CBA00E9B192 /* Release */,
971 | );
972 | defaultConfigurationIsVisible = 0;
973 | defaultConfigurationName = Release;
974 | };
975 | /* End XCConfigurationList section */
976 | };
977 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */;
978 | }
979 |
--------------------------------------------------------------------------------