findViewById(R.id.react_native_version).setText(BuildConfig.REACT_NATIVE_VERSION);
33 |
34 | findViewById(R.id.go_back_button).setOnClickListener(new View.OnClickListener() {
35 | @Override
36 | public void onClick(View view) {
37 | onBackPressed();
38 | }
39 | });
40 |
41 | findViewById(R.id.trigger_alert_button).setOnClickListener(new View.OnClickListener() {
42 | @Override
43 | public void onClick(View view) {
44 | // The target of this event does two things:
45 | // 1. It sets the "extra text" that shows up when you tap "Call JavaScript from Java"
46 | // on the front page. This should always work.
47 | // 2. It calls "alert". This does note work unless this activity forwards lifecycle
48 | // events to React Native. The easiest way to do that is to inherit ReactActivity
49 | // instead of ReactActivity, but you can code it yourself if you want.
50 | // The iOS version does not suffer from this problem.
51 | EventEmitterModule.emitEvent("Hello from " + ExampleActivity.class.getSimpleName());
52 | Toast.makeText(ExampleActivity.this, "Extra message was changed", Toast.LENGTH_SHORT).show();
53 | }
54 | });
55 |
56 | findViewById(R.id.call_javascript_button).setOnClickListener(new View.OnClickListener() {
57 | @Override
58 | public void onClick(View view) {
59 | MainApplication application = (MainApplication) ExampleActivity.this.getApplication();
60 | ReactNativeHost reactNativeHost = application.getReactNativeHost();
61 | ReactInstanceManager reactInstanceManager = reactNativeHost.getReactInstanceManager();
62 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
63 |
64 | if (reactContext != null) {
65 | CatalystInstance catalystInstance = reactContext.getCatalystInstance();
66 | WritableNativeArray params = new WritableNativeArray();
67 | params.pushString("Set Extra Message was called!");
68 |
69 | // AFAIK, this approach to communicate from Java to JavaScript is officially undocumented.
70 | // Use at own risk; prefer events.
71 |
72 | // Note: Here we call 'setMessage', which does not show UI. That means it is okay
73 | // to call it from an activity that doesn't forward lifecycle events to React Native.
74 | catalystInstance.callFunction("JavaScriptVisibleToJava", "setMessage", params);
75 | Toast.makeText(ExampleActivity.this, "Extra message was changed", Toast.LENGTH_SHORT).show();
76 |
77 | try {
78 | // Need new params, as the old has been consumed and would cause an exception
79 | params = new WritableNativeArray();
80 | params.pushString("Hello, alert! From native side!");
81 |
82 | // Note: Here we call 'alert', which does show UI. That means it does nothing if
83 | // called from an activity that doesn't forward lifecycle events to React Native.
84 | // See comments on EventEmitterModule.emitEvent above.
85 | catalystInstance.callFunction("JavaScriptVisibleToJava", "alert", params);
86 | } catch (Exception e) {
87 | Toast.makeText(ExampleActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
88 | }
89 | }
90 | }
91 | });
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/android/app/src/main/java/com/demo/activity/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.demo.activity;
2 |
3 | import android.os.Bundle;
4 |
5 | import androidx.annotation.CallSuper;
6 | import androidx.annotation.Nullable;
7 | import androidx.appcompat.app.AlertDialog;
8 | import androidx.core.app.NotificationManagerCompat;
9 | import android.widget.Toast;
10 |
11 | import com.facebook.react.ReactActivity;
12 | import com.facebook.react.ReactActivityDelegate;
13 | import com.facebook.react.ReactInstanceManager;
14 | import com.facebook.react.ReactNativeHost;
15 | import com.facebook.react.devsupport.interfaces.DevOptionHandler;
16 | import com.facebook.react.devsupport.interfaces.DevSupportManager;
17 |
18 | /**
19 | * The main activity, which hosts the React Native view registered in {@code index.js}.
20 | */
21 | public final class MainActivity extends ReactActivity {
22 |
23 | private static final String CUSTOM_DEV_OPTION_MESSAGE = "Hello from custom dev option!";
24 |
25 | /**
26 | * Returns the name of the main component registered from JavaScript.
27 | * This is used to schedule rendering of the component.
28 | * Because this class overrides {@link #createReactActivityDelegate()}, we don't really need
29 | * to override this.
30 | */
31 | @Override
32 | protected String getMainComponentName() {
33 | return "ActivityDemoComponent";
34 | }
35 |
36 | /**
37 | * We override to provide launch options that we can read in JavaScript (see buildType).
38 | */
39 | @Override
40 | protected ReactActivityDelegate createReactActivityDelegate() {
41 | return new ReactActivityDelegate(this, getMainComponentName()) {
42 | @Override
43 | protected Bundle getLaunchOptions() {
44 | Bundle launchOptions = new Bundle();
45 | launchOptions.putString("buildType", BuildConfig.BUILD_TYPE);
46 | return launchOptions;
47 | }
48 | };
49 | }
50 |
51 | /**
52 | * Demonstrates how to add a custom option to the dev menu.
53 | * https://stackoverflow.com/a/44882371/3968276
54 | * This only works from the debug build with dev options enabled.
55 | */
56 | @Override
57 | @CallSuper
58 | protected void onCreate(@Nullable Bundle savedInstanceState) {
59 | super.onCreate(savedInstanceState);
60 | MainApplication application = (MainApplication) getApplication();
61 | ReactNativeHost reactNativeHost = application.getReactNativeHost();
62 | ReactInstanceManager reactInstanceManager = reactNativeHost.getReactInstanceManager();
63 | DevSupportManager devSupportManager = reactInstanceManager.getDevSupportManager();
64 | devSupportManager.addCustomDevOption("Custom dev option", new DevOptionHandler() {
65 | @Override
66 | public void onOptionSelected() {
67 | if (NotificationManagerCompat.from(MainActivity.this).areNotificationsEnabled()) {
68 | Toast.makeText(MainActivity.this, CUSTOM_DEV_OPTION_MESSAGE, Toast.LENGTH_LONG).show();
69 | } else {
70 | AlertDialog dialog = new AlertDialog.Builder(MainActivity.this).create();
71 | dialog.setTitle("Dev option");
72 | dialog.setMessage(CUSTOM_DEV_OPTION_MESSAGE);
73 | dialog.show();
74 | }
75 | }
76 | });
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/android/app/src/main/java/com/demo/activity/MainApplication.java:
--------------------------------------------------------------------------------
1 | package com.demo.activity;
2 |
3 | import android.app.Application;
4 |
5 | import androidx.annotation.CallSuper;
6 | import androidx.annotation.NonNull;
7 |
8 | import com.facebook.react.ReactApplication;
9 | import com.facebook.react.ReactNativeHost;
10 | import com.facebook.react.ReactPackage;
11 | import com.facebook.react.shell.MainReactPackage;
12 | import com.facebook.soloader.SoLoader;
13 |
14 | import java.util.Arrays;
15 | import java.util.List;
16 |
17 | /**
18 | * Base class for maintaining global application state -- in this case, the {@link ReactNativeHost}.
19 | */
20 | public final class MainApplication extends Application implements ReactApplication {
21 |
22 | private static final String JS_BUNDLE_NAME = "index.bundle";
23 | private static final String JS_MAIN_MODULE_NAME = "index";
24 |
25 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
26 | @Override
27 | public boolean getUseDeveloperSupport() {
28 | return BuildConfig.USE_DEVELOPER_SUPPORT;
29 | }
30 |
31 | /**
32 | * Returns the name of the main module. Determines the URL used to fetch the JS bundle
33 | * from the packager server. It is only used when dev support is enabled.
34 | */
35 | @NonNull
36 | @Override
37 | protected String getJSMainModuleName() {
38 | return JS_MAIN_MODULE_NAME;
39 | }
40 |
41 | /**
42 | * Returns the name of the bundle in assets.
43 | */
44 | @NonNull
45 | @Override
46 | protected String getBundleAssetName() {
47 | return JS_BUNDLE_NAME;
48 | }
49 |
50 | /**
51 | *
52 | * Returns a list of {@link ReactPackage}s used by the app.
53 | *
54 | *
55 | * This method is called by the React Native framework.
56 | * It is not normally called by the application itself.
57 | *
58 | */
59 | @Override
60 | protected List getPackages() {
61 | return Arrays.asList(
62 | new ActivityStarterReactPackage(),
63 | new MainReactPackage()
64 | );
65 | }
66 | };
67 |
68 | /**
69 | * Get the {@link ReactNativeHost} for this app.
70 | */
71 | @Override
72 | @NonNull
73 | public ReactNativeHost getReactNativeHost() {
74 | return mReactNativeHost;
75 | }
76 |
77 | /**
78 | * Called when the application is starting, before any activity, service,
79 | * or receiver objects (excluding content providers) have been created.
80 | *
81 | * This implementation loads the React Native JNI libraries.
82 | */
83 | @Override
84 | @CallSuper
85 | public void onCreate() {
86 | super.onCreate();
87 | SoLoader.init(this, false);
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/android/app/src/main/java/com/demo/activity/ReverseTextActivity.java:
--------------------------------------------------------------------------------
1 | package com.demo.activity;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.widget.TextView;
7 |
8 | import androidx.annotation.CallSuper;
9 | import androidx.annotation.NonNull;
10 | import androidx.annotation.Nullable;
11 |
12 | /**
13 | * Handles custom edit menu "Reverse string" item.
14 | * https://medium.com/androiddevelopers/custom-text-selection-actions-with-action-process-text-191f792d2999
15 | *
16 | * This functionality has nothing to do with React Native per se; I added this just to verify that
17 | * the mechanism works as expected on a React Native {@code TextInput}.
18 | *
19 | * I'm not aware of any comparable iOS functionality -- this thing works globally. iOS has something
20 | * you can apply to individual{@code UITextView}s:
21 | * https://stackoverflow.com/questions/37870889/how-do-i-add-a-custom-action-to-the-text-selection-edit-menu-in-ios
22 | */
23 | public class ReverseTextActivity extends Activity {
24 |
25 | @Override
26 | @CallSuper
27 | protected void onCreate(@Nullable Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 | setContentView(R.layout.activity_reverse_text);
30 | CharSequence text = getIntent().getCharSequenceExtra(Intent.EXTRA_PROCESS_TEXT);
31 | this.findViewById(R.id.reverse_text).setText(reverse(text));
32 | }
33 |
34 | @NonNull
35 | private CharSequence reverse(@NonNull CharSequence text) {
36 | StringBuilder sb = new StringBuilder();
37 | for (int i = text.length() - 1; i >= 0; --i) {
38 | sb.append(text.charAt(i));
39 | }
40 |
41 | return sb.toString();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/android/app/src/main/res/layout/activity_example.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
19 |
28 |
38 |
44 |
52 |
60 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/android/app/src/main/res/layout/activity_reverse_text.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
20 |
21 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/petterh/react-native-android-activity/a461f170b2dcae3c8cb2532ba020dbf8ee47ab64/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/petterh/react-native-android-activity/a461f170b2dcae3c8cb2532ba020dbf8ee47ab64/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/petterh/react-native-android-activity/a461f170b2dcae3c8cb2532ba020dbf8ee47ab64/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/petterh/react-native-android-activity/a461f170b2dcae3c8cb2532ba020dbf8ee47ab64/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | React Native Android Activity Demo
3 | ExampleActivity
4 | Example activity
5 | Go back!
6 | Trigger event
7 | Reversed text!
8 | Reverse text
9 | Call JavaScript from Java
10 |
11 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/app/src/release/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | import groovy.json.JsonSlurper
2 |
3 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
4 |
5 | buildscript {
6 | repositories {
7 | google()
8 | jcenter()
9 | }
10 |
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:3.5.3'
13 |
14 | // NOTE: Do not place your application dependencies here; they belong
15 | // in the individual module build.gradle files
16 | }
17 | }
18 |
19 | final reactNativePath = '/react-native/android'
20 | final jscAndroidPath = '/jsc-android/dist'
21 |
22 | allprojects {
23 | repositories {
24 | maven {
25 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
26 | url findNodeModules() + reactNativePath
27 | }
28 |
29 | maven {
30 | // Android JSC is installed from npm
31 | url findNodeModules() + jscAndroidPath
32 | }
33 |
34 | google()
35 | jcenter()
36 | }
37 | }
38 |
39 | final findNodeModules() {
40 | final reactNativePath = 'node_modules'
41 | final notFoundMessage = 'Unable to find node_modules folder. Have you run yarn from the root?'
42 |
43 | def root = file("$rootDir")
44 | if (root == null) {
45 | throw new GradleException(notFoundMessage)
46 | }
47 |
48 | def reactNativeDir = new File(root, reactNativePath)
49 | while (!reactNativeDir.exists()) {
50 | root = root.parentFile
51 | if (root == null) {
52 | throw new GradleException(notFoundMessage)
53 | }
54 |
55 | reactNativeDir = new File(root, reactNativePath)
56 | }
57 |
58 | return reactNativeDir.toString()
59 | }
60 |
61 | ext {
62 | sdkVersion = 28
63 | minSdkVersion = 23
64 | projectVersion = getProjectVersion()
65 | projectVersionCode = Integer.parseInt(projectVersion.substring(0, projectVersion.indexOf('.')))
66 | reactNativeVersion = getReactNativeVersion()
67 | }
68 |
69 | /**
70 | * Get the React Native version from package.json
71 | */
72 | final getReactNativeVersion() {
73 | final json = new JsonSlurper()
74 | final packageJsonFile = file('../package.json')
75 | if (!packageJsonFile.exists()) {
76 | throw new Exception('No package.json found')
77 | }
78 |
79 | final packageJson = json.parse packageJsonFile
80 | def version = packageJson.dependencies."react-native"
81 | if (!version) {
82 | throw new Exception('No react native version found in package.json dependencies')
83 | }
84 |
85 | println "React native version: $version"
86 |
87 | if (version.startsWith('^')) {
88 | version = version.substring(1)
89 | }
90 |
91 | return version
92 | }
93 |
94 | /**
95 | * Get the Project version from package.json
96 | */
97 | final getProjectVersion() {
98 | final json = new JsonSlurper()
99 | final packageJsonFile = file('../package.json')
100 | if (!packageJsonFile.exists()) {
101 | throw new Exception('No package.json found')
102 | }
103 |
104 | final packageJson = json.parse packageJsonFile
105 | def version = packageJson.version
106 | if (!version) {
107 | throw new Exception('No project version found in package.json')
108 | }
109 |
110 | println "Project version: $version"
111 |
112 | return version
113 | }
114 |
--------------------------------------------------------------------------------
/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.debug.obsoleteApi=true
21 |
22 | bundleInDebug=true
23 |
24 | android.useAndroidX=true
25 | android.enableJetifier=true
26 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/petterh/react-native-android-activity/a461f170b2dcae3c8cb2532ba020dbf8ee47ab64/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Aug 21 09:12:57 CEST 2019
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
7 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/android/keystores/BUCK:
--------------------------------------------------------------------------------
1 | keystore(
2 | name = "debug",
3 | properties = "debug.keystore.properties",
4 | store = "debug.keystore",
5 | visibility = [
6 | "PUBLIC",
7 | ],
8 | )
9 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'ReactNativeActivityDemo'
2 |
3 | // https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.0
4 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle")
5 | applyNativeModulesSettingsGradle(settings)
6 |
7 | include ':app'
8 |
--------------------------------------------------------------------------------
/img/AndroidScreenShot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/petterh/react-native-android-activity/a461f170b2dcae3c8cb2532ba020dbf8ee47ab64/img/AndroidScreenShot.png
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Sample React Native App
3 | * https://github.com/facebook/react-native
4 | */
5 |
6 | import React, { Component } from 'react';
7 |
8 | import {
9 | AppRegistry,
10 | Button,
11 | NativeEventEmitter,
12 | NativeModules,
13 | Platform,
14 | StyleSheet,
15 | Text,
16 | TextInput,
17 | View
18 | } from 'react-native';
19 |
20 | import BatchedBridge from "react-native/Libraries/BatchedBridge/BatchedBridge";
21 |
22 | export class ExposedToJava {
23 | extraMessage = "Be aware that this way of calling JavaScript is officially undocumented.\n\nIf possible, use events instead!";
24 |
25 | setMessage(message) {
26 | this.extraMessage = message;
27 | }
28 |
29 | /**
30 | * If this is called from an activity that doesn't forward Android life-cycle events
31 | * to React Native, the alert will appear to do nothing.
32 | */
33 | alert(message) {
34 | alert(message + "\n\n" + this.extraMessage);
35 | }
36 | }
37 |
38 | const exposedToJava = new ExposedToJava();
39 | BatchedBridge.registerCallableModule("JavaScriptVisibleToJava", exposedToJava);
40 |
41 | const activityStarter = NativeModules.ActivityStarter;
42 | const eventEmitterModule = NativeModules.EventEmitter;
43 |
44 | export default class ActivityDemoComponent extends Component {
45 | constructor(props) {
46 | super(props);
47 | this.state = { text: 'Demo text for custom edit menu' };
48 | }
49 |
50 | render() {
51 | return (
52 |
53 |
54 | Welcome to React Native ({this.props.buildType})!
55 |
56 |
57 | To get started, edit
58 | index.js
59 | .
60 |
61 |
62 | Double tap R on your keyboard to reload,{'\n'}
63 | Shake or press menu button for dev menu
64 |
65 | {
66 | Platform.select({
67 | android: (
68 | this.setState({text})}
72 | />)
73 | })
74 | }
75 |
76 |
108 |
109 | );
110 | }
111 | }
112 |
113 | const styles = StyleSheet.create({
114 | bold: {
115 | fontWeight: "bold",
116 | },
117 | buttonContainer: {
118 | height: 300,
119 | width: "80%",
120 | justifyContent: 'space-between',
121 | marginTop: 30,
122 | },
123 | container: {
124 | flex: 1,
125 | justifyContent: 'center',
126 | alignItems: 'center',
127 | backgroundColor: '#E5ECFF',
128 | },
129 | instructions: {
130 | textAlign: 'center',
131 | color: '#333333',
132 | marginBottom: 5,
133 | },
134 | textInput: {
135 | backgroundColor: 'white',
136 | borderColor: 'gray',
137 | borderWidth: 1,
138 | height: 40,
139 | marginTop: 20,
140 | textAlign: "center",
141 | width: "80%",
142 | },
143 | welcome: {
144 | fontSize: 20,
145 | textAlign: 'center',
146 | margin: 10,
147 | },
148 | });
149 |
150 | AppRegistry.registerComponent('ActivityDemoComponent', () => ActivityDemoComponent);
151 |
152 | const eventEmitter = new NativeEventEmitter(eventEmitterModule);
153 | eventEmitter.addListener(eventEmitterModule.MyEventName, (params) => {
154 | exposedToJava.setMessage(params);
155 | alert(params);
156 | });
157 |
--------------------------------------------------------------------------------
/ios.yaml:
--------------------------------------------------------------------------------
1 | # Xcode
2 | # Build, test, and archive an Xcode workspace on macOS.
3 | # Add steps that install certificates, test, sign, and distribute an app, save build artifacts, and more:
4 | # https://docs.microsoft.com/azure/devops/pipelines/languages/xcode
5 |
6 | trigger:
7 | - master
8 |
9 | pool:
10 | vmImage: 'macos-latest'
11 |
12 | steps:
13 | - task: NodeTool@0
14 | inputs:
15 | versionSpec: '10.x'
16 | displayName: 'Install Node.js'
17 |
18 | - task: Npm@1
19 | inputs:
20 | command: 'install'
21 | displayName: 'npm install'
22 |
23 | - task: CocoaPods@0
24 | inputs:
25 | workingDirectory: 'ios'
26 | forceRepoUpdate: false
27 | - task: Xcode@5
28 | inputs:
29 | actions: 'build'
30 | args: '-UseModernBuildSystem=NO'
31 | configuration: 'Debug'
32 | scheme: 'Activity'
33 | sdk: 'iphoneos'
34 | xcWorkspacePath: '**/Activity.xcworkspace'
35 | xcodeVersion: 'default' # Options: 8, 9, 10, default, specifyPath
36 |
--------------------------------------------------------------------------------
/ios/Activity.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
11 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; };
12 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13 | 269F46B9BCF7CE46684631F9 /* libPods-Activity.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6FFCF058A49BD2A94242B9B2 /* libPods-Activity.a */; };
14 | E980106A224A7479004F93F3 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E9801069224A7479004F93F3 /* JavaScriptCore.framework */; };
15 | E9A14664224E2702001AB682 /* EventEmitter.m in Sources */ = {isa = PBXBuildFile; fileRef = E9A1465C224E2701001AB682 /* EventEmitter.m */; };
16 | E9A14665224E2702001AB682 /* ExampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = E9A1465E224E2702001AB682 /* ExampleView.m */; };
17 | E9A14666224E2702001AB682 /* ActivityStarterModule.m in Sources */ = {isa = PBXBuildFile; fileRef = E9A14661224E2702001AB682 /* ActivityStarterModule.m */; };
18 | E9A14667224E2702001AB682 /* ExampleView.xib in Resources */ = {isa = PBXBuildFile; fileRef = E9A14662224E2702001AB682 /* ExampleView.xib */; };
19 | E9A14668224E2702001AB682 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E9A14663224E2702001AB682 /* main.m */; };
20 | /* End PBXBuildFile section */
21 |
22 | /* Begin PBXFileReference section */
23 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; };
24 | 084045C15FD6E0BD1EA44CED /* Pods-Activity.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Activity.release.xcconfig"; path = "Target Support Files/Pods-Activity/Pods-Activity.release.xcconfig"; sourceTree = ""; };
25 | 13B07F961A680F5B00A75B9A /* Activity.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Activity.app; sourceTree = BUILT_PRODUCTS_DIR; };
26 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = Activity/AppDelegate.h; sourceTree = ""; };
27 | 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = Activity/AppDelegate.m; sourceTree = ""; };
28 | 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; };
29 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = Activity/Images.xcassets; sourceTree = ""; };
30 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Activity/Info.plist; sourceTree = ""; };
31 | 599495E37E14A89E3CAFBF84 /* Pods-Activity.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Activity.debug.xcconfig"; path = "Target Support Files/Pods-Activity/Pods-Activity.debug.xcconfig"; sourceTree = ""; };
32 | 6FFCF058A49BD2A94242B9B2 /* libPods-Activity.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Activity.a"; sourceTree = BUILT_PRODUCTS_DIR; };
33 | E9801069224A7479004F93F3 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
34 | E9A1465C224E2701001AB682 /* EventEmitter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EventEmitter.m; path = Activity/EventEmitter.m; sourceTree = ""; };
35 | E9A1465D224E2702001AB682 /* EventEmitter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EventEmitter.h; path = Activity/EventEmitter.h; sourceTree = ""; };
36 | E9A1465E224E2702001AB682 /* ExampleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ExampleView.m; path = Activity/ExampleView.m; sourceTree = ""; };
37 | E9A1465F224E2702001AB682 /* ExampleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ExampleView.h; path = Activity/ExampleView.h; sourceTree = ""; };
38 | E9A14660224E2702001AB682 /* ActivityStarterModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ActivityStarterModule.h; path = Activity/ActivityStarterModule.h; sourceTree = ""; };
39 | E9A14661224E2702001AB682 /* ActivityStarterModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ActivityStarterModule.m; path = Activity/ActivityStarterModule.m; sourceTree = ""; };
40 | E9A14662224E2702001AB682 /* ExampleView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = ExampleView.xib; path = Activity/ExampleView.xib; sourceTree = ""; };
41 | E9A14663224E2702001AB682 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Activity/main.m; sourceTree = ""; };
42 | /* End PBXFileReference section */
43 |
44 | /* Begin PBXFrameworksBuildPhase section */
45 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = {
46 | isa = PBXFrameworksBuildPhase;
47 | buildActionMask = 2147483647;
48 | files = (
49 | E980106A224A7479004F93F3 /* JavaScriptCore.framework in Frameworks */,
50 | 269F46B9BCF7CE46684631F9 /* libPods-Activity.a in Frameworks */,
51 | );
52 | runOnlyForDeploymentPostprocessing = 0;
53 | };
54 | /* End PBXFrameworksBuildPhase section */
55 |
56 | /* Begin PBXGroup section */
57 | 13B07FAE1A68108700A75B9A /* Activity */ = {
58 | isa = PBXGroup;
59 | children = (
60 | E9A14660224E2702001AB682 /* ActivityStarterModule.h */,
61 | E9A14661224E2702001AB682 /* ActivityStarterModule.m */,
62 | E9A1465D224E2702001AB682 /* EventEmitter.h */,
63 | E9A1465C224E2701001AB682 /* EventEmitter.m */,
64 | E9A1465F224E2702001AB682 /* ExampleView.h */,
65 | E9A1465E224E2702001AB682 /* ExampleView.m */,
66 | E9A14662224E2702001AB682 /* ExampleView.xib */,
67 | E9A14663224E2702001AB682 /* main.m */,
68 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */,
69 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */,
70 | 13B07FB01A68108700A75B9A /* AppDelegate.m */,
71 | 13B07FB51A68108700A75B9A /* Images.xcassets */,
72 | 13B07FB61A68108700A75B9A /* Info.plist */,
73 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */,
74 | );
75 | name = Activity;
76 | sourceTree = "";
77 | };
78 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = {
79 | isa = PBXGroup;
80 | children = (
81 | );
82 | name = Libraries;
83 | sourceTree = "";
84 | };
85 | 83CBB9F61A601CBA00E9B192 = {
86 | isa = PBXGroup;
87 | children = (
88 | 13B07FAE1A68108700A75B9A /* Activity */,
89 | 832341AE1AAA6A7D00B99B32 /* Libraries */,
90 | 83CBBA001A601CBA00E9B192 /* Products */,
91 | E980102D224A7479004F93F3 /* Frameworks */,
92 | AD22D38B7C56F56DF62C99B6 /* Pods */,
93 | );
94 | indentWidth = 2;
95 | sourceTree = "";
96 | tabWidth = 2;
97 | };
98 | 83CBBA001A601CBA00E9B192 /* Products */ = {
99 | isa = PBXGroup;
100 | children = (
101 | 13B07F961A680F5B00A75B9A /* Activity.app */,
102 | );
103 | name = Products;
104 | sourceTree = "";
105 | };
106 | AD22D38B7C56F56DF62C99B6 /* Pods */ = {
107 | isa = PBXGroup;
108 | children = (
109 | 599495E37E14A89E3CAFBF84 /* Pods-Activity.debug.xcconfig */,
110 | 084045C15FD6E0BD1EA44CED /* Pods-Activity.release.xcconfig */,
111 | );
112 | path = Pods;
113 | sourceTree = "";
114 | };
115 | E980102D224A7479004F93F3 /* Frameworks */ = {
116 | isa = PBXGroup;
117 | children = (
118 | E9801069224A7479004F93F3 /* JavaScriptCore.framework */,
119 | 6FFCF058A49BD2A94242B9B2 /* libPods-Activity.a */,
120 | );
121 | name = Frameworks;
122 | sourceTree = "";
123 | };
124 | /* End PBXGroup section */
125 |
126 | /* Begin PBXNativeTarget section */
127 | 13B07F861A680F5B00A75B9A /* Activity */ = {
128 | isa = PBXNativeTarget;
129 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Activity" */;
130 | buildPhases = (
131 | E2B8FEE7CED179FEE322285F /* [CP] Check Pods Manifest.lock */,
132 | 13B07F871A680F5B00A75B9A /* Sources */,
133 | 13B07F8C1A680F5B00A75B9A /* Frameworks */,
134 | 13B07F8E1A680F5B00A75B9A /* Resources */,
135 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
136 | );
137 | buildRules = (
138 | );
139 | dependencies = (
140 | );
141 | name = Activity;
142 | productName = "Hello World";
143 | productReference = 13B07F961A680F5B00A75B9A /* Activity.app */;
144 | productType = "com.apple.product-type.application";
145 | };
146 | /* End PBXNativeTarget section */
147 |
148 | /* Begin PBXProject section */
149 | 83CBB9F71A601CBA00E9B192 /* Project object */ = {
150 | isa = PBXProject;
151 | attributes = {
152 | LastUpgradeCheck = 1020;
153 | ORGANIZATIONNAME = Facebook;
154 | };
155 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Activity" */;
156 | compatibilityVersion = "Xcode 3.2";
157 | developmentRegion = en;
158 | hasScannedForEncodings = 0;
159 | knownRegions = (
160 | en,
161 | Base,
162 | );
163 | mainGroup = 83CBB9F61A601CBA00E9B192;
164 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
165 | projectDirPath = "";
166 | projectRoot = "";
167 | targets = (
168 | 13B07F861A680F5B00A75B9A /* Activity */,
169 | );
170 | };
171 | /* End PBXProject section */
172 |
173 | /* Begin PBXResourcesBuildPhase section */
174 | 13B07F8E1A680F5B00A75B9A /* Resources */ = {
175 | isa = PBXResourcesBuildPhase;
176 | buildActionMask = 2147483647;
177 | files = (
178 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
179 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */,
180 | E9A14667224E2702001AB682 /* ExampleView.xib in Resources */,
181 | );
182 | runOnlyForDeploymentPostprocessing = 0;
183 | };
184 | /* End PBXResourcesBuildPhase section */
185 |
186 | /* Begin PBXShellScriptBuildPhase section */
187 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = {
188 | isa = PBXShellScriptBuildPhase;
189 | buildActionMask = 2147483647;
190 | files = (
191 | );
192 | inputPaths = (
193 | );
194 | name = "Bundle React Native code and images";
195 | outputPaths = (
196 | );
197 | runOnlyForDeploymentPostprocessing = 0;
198 | shellPath = /bin/sh;
199 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n";
200 | };
201 | E2B8FEE7CED179FEE322285F /* [CP] Check Pods Manifest.lock */ = {
202 | isa = PBXShellScriptBuildPhase;
203 | buildActionMask = 2147483647;
204 | files = (
205 | );
206 | inputFileListPaths = (
207 | );
208 | inputPaths = (
209 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
210 | "${PODS_ROOT}/Manifest.lock",
211 | );
212 | name = "[CP] Check Pods Manifest.lock";
213 | outputFileListPaths = (
214 | );
215 | outputPaths = (
216 | "$(DERIVED_FILE_DIR)/Pods-Activity-checkManifestLockResult.txt",
217 | );
218 | runOnlyForDeploymentPostprocessing = 0;
219 | shellPath = /bin/sh;
220 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
221 | showEnvVarsInLog = 0;
222 | };
223 | /* End PBXShellScriptBuildPhase section */
224 |
225 | /* Begin PBXSourcesBuildPhase section */
226 | 13B07F871A680F5B00A75B9A /* Sources */ = {
227 | isa = PBXSourcesBuildPhase;
228 | buildActionMask = 2147483647;
229 | files = (
230 | E9A14668224E2702001AB682 /* main.m in Sources */,
231 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */,
232 | E9A14664224E2702001AB682 /* EventEmitter.m in Sources */,
233 | E9A14666224E2702001AB682 /* ActivityStarterModule.m in Sources */,
234 | E9A14665224E2702001AB682 /* ExampleView.m in Sources */,
235 | );
236 | runOnlyForDeploymentPostprocessing = 0;
237 | };
238 | /* End PBXSourcesBuildPhase section */
239 |
240 | /* Begin PBXVariantGroup section */
241 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = {
242 | isa = PBXVariantGroup;
243 | children = (
244 | 13B07FB21A68108700A75B9A /* Base */,
245 | );
246 | name = LaunchScreen.xib;
247 | path = Activity;
248 | sourceTree = "";
249 | };
250 | /* End PBXVariantGroup section */
251 |
252 | /* Begin XCBuildConfiguration section */
253 | 13B07F941A680F5B00A75B9A /* Debug */ = {
254 | isa = XCBuildConfiguration;
255 | baseConfigurationReference = 599495E37E14A89E3CAFBF84 /* Pods-Activity.debug.xcconfig */;
256 | buildSettings = {
257 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
258 | CURRENT_PROJECT_VERSION = 1;
259 | DEAD_CODE_STRIPPING = NO;
260 | GCC_NO_COMMON_BLOCKS = NO;
261 | INFOPLIST_FILE = Activity/Info.plist;
262 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
263 | OTHER_LDFLAGS = (
264 | "$(inherited)",
265 | "-ObjC",
266 | "-lc++",
267 | );
268 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
269 | PRODUCT_NAME = Activity;
270 | VERSIONING_SYSTEM = "apple-generic";
271 | };
272 | name = Debug;
273 | };
274 | 13B07F951A680F5B00A75B9A /* Release */ = {
275 | isa = XCBuildConfiguration;
276 | baseConfigurationReference = 084045C15FD6E0BD1EA44CED /* Pods-Activity.release.xcconfig */;
277 | buildSettings = {
278 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
279 | CURRENT_PROJECT_VERSION = 1;
280 | GCC_NO_COMMON_BLOCKS = NO;
281 | INFOPLIST_FILE = Activity/Info.plist;
282 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
283 | OTHER_LDFLAGS = (
284 | "$(inherited)",
285 | "-ObjC",
286 | "-lc++",
287 | );
288 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
289 | PRODUCT_NAME = Activity;
290 | VERSIONING_SYSTEM = "apple-generic";
291 | };
292 | name = Release;
293 | };
294 | 83CBBA201A601CBA00E9B192 /* Debug */ = {
295 | isa = XCBuildConfiguration;
296 | buildSettings = {
297 | ALWAYS_SEARCH_USER_PATHS = NO;
298 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
299 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
300 | CLANG_CXX_LIBRARY = "libc++";
301 | CLANG_ENABLE_MODULES = YES;
302 | CLANG_ENABLE_OBJC_ARC = YES;
303 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
304 | CLANG_WARN_BOOL_CONVERSION = YES;
305 | CLANG_WARN_COMMA = YES;
306 | CLANG_WARN_CONSTANT_CONVERSION = YES;
307 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
308 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
309 | CLANG_WARN_EMPTY_BODY = YES;
310 | CLANG_WARN_ENUM_CONVERSION = YES;
311 | CLANG_WARN_INFINITE_RECURSION = YES;
312 | CLANG_WARN_INT_CONVERSION = YES;
313 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
314 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
315 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
316 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
317 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
318 | CLANG_WARN_STRICT_PROTOTYPES = YES;
319 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
320 | CLANG_WARN_UNREACHABLE_CODE = YES;
321 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
322 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
323 | COPY_PHASE_STRIP = NO;
324 | ENABLE_STRICT_OBJC_MSGSEND = YES;
325 | ENABLE_TESTABILITY = YES;
326 | GCC_C_LANGUAGE_STANDARD = gnu99;
327 | GCC_DYNAMIC_NO_PIC = NO;
328 | GCC_NO_COMMON_BLOCKS = YES;
329 | GCC_OPTIMIZATION_LEVEL = 0;
330 | GCC_PREPROCESSOR_DEFINITIONS = (
331 | "DEBUG=1",
332 | "$(inherited)",
333 | );
334 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
335 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
336 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
337 | GCC_WARN_UNDECLARED_SELECTOR = YES;
338 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
339 | GCC_WARN_UNUSED_FUNCTION = YES;
340 | GCC_WARN_UNUSED_VARIABLE = YES;
341 | IPHONEOS_DEPLOYMENT_TARGET = 9.1;
342 | MTL_ENABLE_DEBUG_INFO = YES;
343 | ONLY_ACTIVE_ARCH = YES;
344 | SDKROOT = iphoneos;
345 | };
346 | name = Debug;
347 | };
348 | 83CBBA211A601CBA00E9B192 /* Release */ = {
349 | isa = XCBuildConfiguration;
350 | buildSettings = {
351 | ALWAYS_SEARCH_USER_PATHS = NO;
352 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
353 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
354 | CLANG_CXX_LIBRARY = "libc++";
355 | CLANG_ENABLE_MODULES = YES;
356 | CLANG_ENABLE_OBJC_ARC = YES;
357 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
358 | CLANG_WARN_BOOL_CONVERSION = YES;
359 | CLANG_WARN_COMMA = YES;
360 | CLANG_WARN_CONSTANT_CONVERSION = YES;
361 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
362 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
363 | CLANG_WARN_EMPTY_BODY = YES;
364 | CLANG_WARN_ENUM_CONVERSION = YES;
365 | CLANG_WARN_INFINITE_RECURSION = YES;
366 | CLANG_WARN_INT_CONVERSION = YES;
367 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
368 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
369 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
370 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
371 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
372 | CLANG_WARN_STRICT_PROTOTYPES = YES;
373 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
374 | CLANG_WARN_UNREACHABLE_CODE = YES;
375 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
376 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
377 | COPY_PHASE_STRIP = YES;
378 | ENABLE_NS_ASSERTIONS = NO;
379 | ENABLE_STRICT_OBJC_MSGSEND = YES;
380 | GCC_C_LANGUAGE_STANDARD = gnu99;
381 | GCC_NO_COMMON_BLOCKS = YES;
382 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
383 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
384 | GCC_WARN_UNDECLARED_SELECTOR = YES;
385 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
386 | GCC_WARN_UNUSED_FUNCTION = YES;
387 | GCC_WARN_UNUSED_VARIABLE = YES;
388 | IPHONEOS_DEPLOYMENT_TARGET = 9.1;
389 | MTL_ENABLE_DEBUG_INFO = NO;
390 | SDKROOT = iphoneos;
391 | VALIDATE_PRODUCT = YES;
392 | };
393 | name = Release;
394 | };
395 | /* End XCBuildConfiguration section */
396 |
397 | /* Begin XCConfigurationList section */
398 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "Activity" */ = {
399 | isa = XCConfigurationList;
400 | buildConfigurations = (
401 | 13B07F941A680F5B00A75B9A /* Debug */,
402 | 13B07F951A680F5B00A75B9A /* Release */,
403 | );
404 | defaultConfigurationIsVisible = 0;
405 | defaultConfigurationName = Release;
406 | };
407 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "Activity" */ = {
408 | isa = XCConfigurationList;
409 | buildConfigurations = (
410 | 83CBBA201A601CBA00E9B192 /* Debug */,
411 | 83CBBA211A601CBA00E9B192 /* Release */,
412 | );
413 | defaultConfigurationIsVisible = 0;
414 | defaultConfigurationName = Release;
415 | };
416 | /* End XCConfigurationList section */
417 | };
418 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */;
419 | }
420 |
--------------------------------------------------------------------------------
/ios/Activity.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Activity.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Activity.xcodeproj/xcshareddata/xcschemes/Activity.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
43 |
49 |
50 |
51 |
52 |
53 |
58 |
59 |
61 |
67 |
68 |
69 |
70 |
71 |
77 |
78 |
79 |
80 |
81 |
82 |
92 |
94 |
100 |
101 |
102 |
103 |
104 |
105 |
111 |
113 |
119 |
120 |
121 |
122 |
124 |
125 |
128 |
129 |
130 |
--------------------------------------------------------------------------------
/ios/Activity.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ios/Activity.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Activity/ActivityStarterModule.h:
--------------------------------------------------------------------------------
1 | #ifndef ActivityStarterModule_h
2 | #define ActivityStarterModule_h
3 |
4 | #import
5 |
6 | @interface ActivityStarterModule : NSObject
7 |
8 | @end
9 |
10 | #endif /* ActivityStarterModule_h */
11 |
--------------------------------------------------------------------------------
/ios/Activity/ActivityStarterModule.m:
--------------------------------------------------------------------------------
1 | // React Native module that exposes some Objective-C methods to JavaScript.
2 |
3 | #import
4 | #import
5 | #import
6 | #import "ActivityStarterModule.h"
7 | #import "AppDelegate.h"
8 | #import "ExampleView.h"
9 |
10 | @implementation ActivityStarterModule
11 |
12 | RCT_EXPORT_MODULE(ActivityStarter);
13 |
14 | RCT_EXPORT_METHOD(navigateToExample)
15 | {
16 | dispatch_async(dispatch_get_main_queue(), ^{
17 | AppDelegate *appDelegate = (AppDelegate *) [UIApplication sharedApplication].delegate;
18 | [appDelegate navigateToExampleView];
19 | });
20 | }
21 |
22 | RCT_EXPORT_METHOD(dialNumber:(NSString *) number)
23 | {
24 | #ifdef TARGET_IPHONE_SIMULATOR
25 | NSLog(@"Cannot dial on simulator");
26 | #else
27 | NSString *url = [@"tel://" stringByAppendingString:number];
28 | dispatch_async(dispatch_get_main_queue(), ^{
29 | BOOL success = [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
30 | NSLog(@"Open phone URL: %s", success ? "YES" : "NO");
31 | });
32 | #endif
33 | }
34 |
35 | RCT_EXPORT_METHOD(getActivityName:(RCTResponseSenderBlock) callback)
36 | {
37 | callback(@[@"ActivityStarter (callback)"]);
38 | }
39 |
40 | RCT_REMAP_METHOD(getActivityNameAsPromise,
41 | getActivityNameAsPromiseWithResolver:(RCTPromiseResolveBlock)resolve
42 | rejecter:(RCTPromiseRejectBlock)reject)
43 | {
44 | resolve(@[@"ActivityStarter (promise)"]);
45 | }
46 |
47 | RCT_EXPORT_METHOD(callJavaScript)
48 | {
49 | AppDelegate *appDelegate = (AppDelegate *) [UIApplication sharedApplication].delegate;
50 | [appDelegate callJavaScript];
51 | }
52 |
53 | @end
54 |
--------------------------------------------------------------------------------
/ios/Activity/AppDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | @interface AppDelegate : UIResponder
5 |
6 | @property (nonatomic, strong) UIWindow *window;
7 | @property (nonatomic, strong) RCTBridge *reactBridge;
8 |
9 | - (void) navigateToExampleView;
10 | - (void) navigateBack;
11 | - (void) callJavaScript;
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/ios/Activity/AppDelegate.m:
--------------------------------------------------------------------------------
1 | // Creates the React Native bridge and adds a custom menu item to the dev menu,
2 | // then opens the main React Native view.
3 |
4 | #import
5 | #import
6 | #import
7 |
8 | #import "AppDelegate.h"
9 | #import "ExampleView.h"
10 |
11 | @implementation AppDelegate
12 | {
13 | UINavigationController *navigationController;
14 | }
15 |
16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
17 | {
18 | self.reactBridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
19 |
20 | RCTDevMenuItem *devMenuItem = [RCTDevMenuItem buttonItemWithTitle:@"Custom menu item"
21 | handler:^{
22 | NSLog(@"Custom menu item clicked!");
23 | }];
24 | [self.reactBridge.devMenu addItem:devMenuItem];
25 |
26 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:self.reactBridge
27 | moduleName:@"ActivityDemoComponent"
28 | initialProperties:nil];
29 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
30 |
31 | UIViewController *rootViewController = [UIViewController new];
32 | rootViewController.view = rootView;
33 | navigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
34 |
35 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
36 | self.window.rootViewController = navigationController;
37 | [self.window makeKeyAndVisible];
38 |
39 | return YES;
40 | }
41 |
42 | - (void) navigateToExampleView
43 | {
44 | ExampleView *viewController = [[ExampleView alloc] initWithNibName:@"ExampleView" bundle:nil];
45 | [navigationController pushViewController:viewController animated:YES];
46 | }
47 |
48 | - (void) navigateBack
49 | {
50 | [navigationController popViewControllerAnimated:YES];
51 | }
52 |
53 | - (void) callJavaScript
54 | {
55 | [self.reactBridge enqueueJSCall:@"JavaScriptVisibleToJava"
56 | method:@"alert"
57 | args:@[@"Hello, JavaScript!"]
58 | completion:nil];
59 | }
60 |
61 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
62 | NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"
63 | fallbackResource:nil];
64 | return jsCodeLocation;
65 | }
66 |
67 | @end
68 |
--------------------------------------------------------------------------------
/ios/Activity/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
24 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/ios/Activity/EventEmitter.h:
--------------------------------------------------------------------------------
1 | #ifndef EventEmitter_h
2 | #define EventEmitter_h
3 |
4 | #import
5 |
6 | @interface EventEmitter : RCTEventEmitter
7 |
8 | - (void) emitEvent:(NSString *) message;
9 |
10 | @end
11 |
12 | #endif /* EventEmitter_h */
13 |
--------------------------------------------------------------------------------
/ios/Activity/EventEmitter.m:
--------------------------------------------------------------------------------
1 | // React Native module that lets Objective-C send events to JavaScript.
2 |
3 | #import
4 | #import "EventEmitter.h"
5 |
6 | @implementation EventEmitter
7 | {
8 | BOOL hasObservers; // This is purely a performance thing
9 | }
10 |
11 | RCT_EXPORT_MODULE(EventEmitter)
12 |
13 | /*! @brief Required because we export constantsToExport */
14 | + (BOOL) requiresMainQueueSetup
15 | {
16 | return YES;
17 | }
18 |
19 | /*!
20 | * Allows us to write 'EventEmitter.MyEventName' in JavaScript and get 'MyEventValue.
21 | * Hardcoding 'MyEventValue' in JavaScript would have the same effect.
22 | */
23 | - (NSDictionary *) constantsToExport
24 | {
25 | return @{@"MyEventName": @"MyEventValue"};
26 | }
27 |
28 | - (NSArray *) supportedEvents
29 | {
30 | return @[@"MyEventValue"];
31 | }
32 |
33 | - (void) startObserving
34 | {
35 | hasObservers = YES;
36 | }
37 |
38 | - (void) stopObserving
39 | {
40 | hasObservers = NO;
41 | }
42 |
43 | - (void) emitEvent:(NSString *) message
44 | {
45 | if (hasObservers) {
46 | [self sendEventWithName:@"MyEventValue" body:message];
47 | }
48 | }
49 |
50 | @end
51 |
--------------------------------------------------------------------------------
/ios/Activity/ExampleView.h:
--------------------------------------------------------------------------------
1 | #ifndef ExampleViewController_h
2 | #define ExampleViewController_h
3 |
4 | #include
5 |
6 | @interface ExampleView : UIViewController
7 |
8 | @property (weak, nonatomic) IBOutlet UIButton *goBackButton;
9 | @property (weak, nonatomic) IBOutlet UIButton *triggerEventButton;
10 | @property (weak, nonatomic) IBOutlet UIButton *callJavaScriptButton;
11 |
12 | @end
13 |
14 | #endif /* ExampleViewController_h */
15 |
--------------------------------------------------------------------------------
/ios/Activity/ExampleView.m:
--------------------------------------------------------------------------------
1 | // A view controller that we start from JavaScript.
2 |
3 | #import
4 | #import
5 | #import
6 |
7 | #import "AppDelegate.h"
8 | #import "EventEmitter.h"
9 | #import "ExampleView.h"
10 |
11 | @implementation ExampleView
12 |
13 | - (AppDelegate *) appDelegate
14 | {
15 | return (AppDelegate *) [UIApplication sharedApplication].delegate;
16 | }
17 |
18 | - (IBAction)handleGoBackButton:(id)sender {
19 | [self.appDelegate navigateBack];
20 | }
21 |
22 | - (IBAction)handleTriggerEvent:(id)sender {
23 | RCTBridge *reactBridge = [self.appDelegate reactBridge];
24 | EventEmitter *eventEmitter = [reactBridge moduleForName:@"EventEmitter"];
25 | [eventEmitter emitEvent:@"Hello from iOS event emitter!"];
26 | }
27 |
28 | - (IBAction)handleCallJavaScript:(id)sender {
29 | [self.appDelegate callJavaScript];
30 | }
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/ios/Activity/ExampleView.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 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/ios/Activity/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "60x60",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "size" : "60x60",
41 | "scale" : "3x"
42 | },
43 | {
44 | "idiom" : "ios-marketing",
45 | "size" : "1024x1024",
46 | "scale" : "1x"
47 | }
48 | ],
49 | "info" : {
50 | "version" : 1,
51 | "author" : "xcode"
52 | }
53 | }
--------------------------------------------------------------------------------
/ios/Activity/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ActivityDemoComponent
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | LSRequiresIPhoneOS
26 |
27 | NSAppTransportSecurity
28 |
29 | NSExceptionDomains
30 |
31 | localhost
32 |
33 | NSExceptionAllowsInsecureHTTPLoads
34 |
35 |
36 |
37 |
38 | NSLocationWhenInUseUsageDescription
39 |
40 | UILaunchStoryboardName
41 | LaunchScreen
42 | UIRequiredDeviceCapabilities
43 |
44 | armv7
45 |
46 | UISupportedInterfaceOrientations
47 |
48 | UIInterfaceOrientationPortrait
49 | UIInterfaceOrientationLandscapeLeft
50 | UIInterfaceOrientationLandscapeRight
51 |
52 | UIViewControllerBasedStatusBarAppearance
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/ios/Activity/main.m:
--------------------------------------------------------------------------------
1 | #import
2 |
3 | #import "AppDelegate.h"
4 |
5 | int main(int argc, char * argv[]) {
6 | @autoreleasepool {
7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/ios/Podfile:
--------------------------------------------------------------------------------
1 | platform :ios, '9.1'
2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
3 | target 'Activity' do
4 | # Pods for Activity
5 | pod 'React', :path => '../node_modules/react-native/'
6 | pod 'React-Core', :path => '../node_modules/react-native/React'
7 | pod 'React-DevSupport', :path => '../node_modules/react-native/React'
8 | pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
9 | pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
10 | pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
11 | pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
12 | pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
13 | pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
14 | pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
15 | pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
16 | pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
17 | pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'
18 | pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
19 | pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
20 | pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
21 | pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
22 | pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
23 | pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
24 | pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
25 | pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
26 | use_native_modules!
27 | end
28 |
--------------------------------------------------------------------------------
/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - boost-for-react-native (1.63.0)
3 | - DoubleConversion (1.1.6)
4 | - Folly (2018.10.22.00):
5 | - boost-for-react-native
6 | - DoubleConversion
7 | - Folly/Default (= 2018.10.22.00)
8 | - glog
9 | - Folly/Default (2018.10.22.00):
10 | - boost-for-react-native
11 | - DoubleConversion
12 | - glog
13 | - glog (0.3.5)
14 | - React (0.60.5):
15 | - React-Core (= 0.60.5)
16 | - React-DevSupport (= 0.60.5)
17 | - React-RCTActionSheet (= 0.60.5)
18 | - React-RCTAnimation (= 0.60.5)
19 | - React-RCTBlob (= 0.60.5)
20 | - React-RCTImage (= 0.60.5)
21 | - React-RCTLinking (= 0.60.5)
22 | - React-RCTNetwork (= 0.60.5)
23 | - React-RCTSettings (= 0.60.5)
24 | - React-RCTText (= 0.60.5)
25 | - React-RCTVibration (= 0.60.5)
26 | - React-RCTWebSocket (= 0.60.5)
27 | - React-Core (0.60.5):
28 | - Folly (= 2018.10.22.00)
29 | - React-cxxreact (= 0.60.5)
30 | - React-jsiexecutor (= 0.60.5)
31 | - yoga (= 0.60.5.React)
32 | - React-cxxreact (0.60.5):
33 | - boost-for-react-native (= 1.63.0)
34 | - DoubleConversion
35 | - Folly (= 2018.10.22.00)
36 | - glog
37 | - React-jsinspector (= 0.60.5)
38 | - React-DevSupport (0.60.5):
39 | - React-Core (= 0.60.5)
40 | - React-RCTWebSocket (= 0.60.5)
41 | - React-jsi (0.60.5):
42 | - boost-for-react-native (= 1.63.0)
43 | - DoubleConversion
44 | - Folly (= 2018.10.22.00)
45 | - glog
46 | - React-jsi/Default (= 0.60.5)
47 | - React-jsi/Default (0.60.5):
48 | - boost-for-react-native (= 1.63.0)
49 | - DoubleConversion
50 | - Folly (= 2018.10.22.00)
51 | - glog
52 | - React-jsiexecutor (0.60.5):
53 | - DoubleConversion
54 | - Folly (= 2018.10.22.00)
55 | - glog
56 | - React-cxxreact (= 0.60.5)
57 | - React-jsi (= 0.60.5)
58 | - React-jsinspector (0.60.5)
59 | - React-RCTActionSheet (0.60.5):
60 | - React-Core (= 0.60.5)
61 | - React-RCTAnimation (0.60.5):
62 | - React-Core (= 0.60.5)
63 | - React-RCTBlob (0.60.5):
64 | - React-Core (= 0.60.5)
65 | - React-RCTNetwork (= 0.60.5)
66 | - React-RCTWebSocket (= 0.60.5)
67 | - React-RCTImage (0.60.5):
68 | - React-Core (= 0.60.5)
69 | - React-RCTNetwork (= 0.60.5)
70 | - React-RCTLinking (0.60.5):
71 | - React-Core (= 0.60.5)
72 | - React-RCTNetwork (0.60.5):
73 | - React-Core (= 0.60.5)
74 | - React-RCTSettings (0.60.5):
75 | - React-Core (= 0.60.5)
76 | - React-RCTText (0.60.5):
77 | - React-Core (= 0.60.5)
78 | - React-RCTVibration (0.60.5):
79 | - React-Core (= 0.60.5)
80 | - React-RCTWebSocket (0.60.5):
81 | - React-Core (= 0.60.5)
82 | - yoga (0.60.5.React)
83 |
84 | DEPENDENCIES:
85 | - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
86 | - Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`)
87 | - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
88 | - React (from `../node_modules/react-native/`)
89 | - React-Core (from `../node_modules/react-native/React`)
90 | - React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`)
91 | - React-DevSupport (from `../node_modules/react-native/React`)
92 | - React-jsi (from `../node_modules/react-native/ReactCommon/jsi`)
93 | - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
94 | - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
95 | - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
96 | - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
97 | - React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`)
98 | - React-RCTImage (from `../node_modules/react-native/Libraries/Image`)
99 | - React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`)
100 | - React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`)
101 | - React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`)
102 | - React-RCTText (from `../node_modules/react-native/Libraries/Text`)
103 | - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
104 | - React-RCTWebSocket (from `../node_modules/react-native/Libraries/WebSocket`)
105 | - yoga (from `../node_modules/react-native/ReactCommon/yoga`)
106 |
107 | SPEC REPOS:
108 | https://github.com/cocoapods/specs.git:
109 | - boost-for-react-native
110 |
111 | EXTERNAL SOURCES:
112 | DoubleConversion:
113 | :podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
114 | Folly:
115 | :podspec: "../node_modules/react-native/third-party-podspecs/Folly.podspec"
116 | glog:
117 | :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec"
118 | React:
119 | :path: "../node_modules/react-native/"
120 | React-Core:
121 | :path: "../node_modules/react-native/React"
122 | React-cxxreact:
123 | :path: "../node_modules/react-native/ReactCommon/cxxreact"
124 | React-DevSupport:
125 | :path: "../node_modules/react-native/React"
126 | React-jsi:
127 | :path: "../node_modules/react-native/ReactCommon/jsi"
128 | React-jsiexecutor:
129 | :path: "../node_modules/react-native/ReactCommon/jsiexecutor"
130 | React-jsinspector:
131 | :path: "../node_modules/react-native/ReactCommon/jsinspector"
132 | React-RCTActionSheet:
133 | :path: "../node_modules/react-native/Libraries/ActionSheetIOS"
134 | React-RCTAnimation:
135 | :path: "../node_modules/react-native/Libraries/NativeAnimation"
136 | React-RCTBlob:
137 | :path: "../node_modules/react-native/Libraries/Blob"
138 | React-RCTImage:
139 | :path: "../node_modules/react-native/Libraries/Image"
140 | React-RCTLinking:
141 | :path: "../node_modules/react-native/Libraries/LinkingIOS"
142 | React-RCTNetwork:
143 | :path: "../node_modules/react-native/Libraries/Network"
144 | React-RCTSettings:
145 | :path: "../node_modules/react-native/Libraries/Settings"
146 | React-RCTText:
147 | :path: "../node_modules/react-native/Libraries/Text"
148 | React-RCTVibration:
149 | :path: "../node_modules/react-native/Libraries/Vibration"
150 | React-RCTWebSocket:
151 | :path: "../node_modules/react-native/Libraries/WebSocket"
152 | yoga:
153 | :path: "../node_modules/react-native/ReactCommon/yoga"
154 |
155 | SPEC CHECKSUMS:
156 | boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
157 | DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2
158 | Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51
159 | glog: 1f3da668190260b06b429bb211bfbee5cd790c28
160 | React: 53c53c4d99097af47cf60594b8706b4e3321e722
161 | React-Core: ba421f6b4f4cbe2fb17c0b6fc675f87622e78a64
162 | React-cxxreact: 8384287780c4999351ad9b6e7a149d9ed10a2395
163 | React-DevSupport: 197fb409737cff2c4f9986e77c220d7452cb9f9f
164 | React-jsi: 4d8c9efb6312a9725b18d6fc818ffc103f60fec2
165 | React-jsiexecutor: 90ad2f9db09513fc763bc757fdc3c4ff8bde2a30
166 | React-jsinspector: e08662d1bf5b129a3d556eb9ea343a3f40353ae4
167 | React-RCTActionSheet: b0f1ea83f4bf75fb966eae9bfc47b78c8d3efd90
168 | React-RCTAnimation: 359ba1b5690b1e87cc173558a78e82d35919333e
169 | React-RCTBlob: 5e2b55f76e9a1c7ae52b826923502ddc3238df24
170 | React-RCTImage: f5f1c50922164e89bdda67bcd0153952a5cfe719
171 | React-RCTLinking: d0ecbd791e9ddddc41fa1f66b0255de90e8ee1e9
172 | React-RCTNetwork: e26946300b0ab7bb6c4a6348090e93fa21f33a9d
173 | React-RCTSettings: d0d37cb521b7470c998595a44f05847777cc3f42
174 | React-RCTText: b074d89033583d4f2eb5faf7ea2db3a13c7553a2
175 | React-RCTVibration: 2105b2e0e2b66a6408fc69a46c8a7fb5b2fdade0
176 | React-RCTWebSocket: cd932a16b7214898b6b7f788c8bddb3637246ac4
177 | yoga: 312528f5bbbba37b4dcea5ef00e8b4033fdd9411
178 |
179 | PODFILE CHECKSUM: d7ad5fbc71c9d1ffe43145aac502756d17700744
180 |
181 | COCOAPODS: 1.6.1
182 |
--------------------------------------------------------------------------------
/jsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "allowJs": true,
4 | "allowSyntheticDefaultImports": true
5 | },
6 | "exclude": [
7 | "node_modules"
8 | ]
9 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "activity",
3 | "repository": {
4 | "type": "git",
5 | "url": "https://github.com/petterh/react-native-android-activity.git"
6 | },
7 | "version": "5.1.0",
8 | "private": true,
9 | "scripts": {
10 | "start": "node node_modules/react-native/local-cli/cli.js start"
11 | },
12 | "dependencies": {
13 | "react": "16.8.6",
14 | "react-native": "0.60.5"
15 | },
16 | "devDependencies": {
17 | "babel-loader": "8.0.6",
18 | "babel-plugin-transform-runtime": "6.23.0",
19 | "metro-react-native-babel-preset": "0.55.0",
20 | "ws": ">=3.3.1"
21 | }
22 | }
23 |
--------------------------------------------------------------------------------