expo-template-bare-minimum 50.0.7 → 50.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  apply plugin: "com.android.application"
2
+ apply plugin: "org.jetbrains.kotlin.android"
2
3
  apply plugin: "com.facebook.react"
3
4
 
4
5
  def projectRoot = rootDir.getAbsoluteFile().getParentFile().getAbsolutePath()
@@ -79,7 +80,8 @@ def jscFlavor = 'org.webkit:android-jsc:+'
79
80
  android {
80
81
  ndkVersion rootProject.ext.ndkVersion
81
82
 
82
- compileSdkVersion rootProject.ext.compileSdkVersion
83
+ buildToolsVersion rootProject.ext.buildToolsVersion
84
+ compileSdk rootProject.ext.compileSdkVersion
83
85
 
84
86
  namespace "com.helloworld"
85
87
  defaultConfig {
@@ -163,11 +165,7 @@ dependencies {
163
165
  }
164
166
  }
165
167
 
166
- debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
167
- debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
168
- exclude group:'com.squareup.okhttp3', module:'okhttp'
169
- }
170
- debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
168
+ implementation("com.facebook.react:flipper-integration")
171
169
 
172
170
  if (hermesEnabled.toBoolean()) {
173
171
  implementation("com.facebook.react:hermes-android")
@@ -0,0 +1,61 @@
1
+ package com.helloworld
2
+
3
+ import android.os.Build
4
+ import android.os.Bundle
5
+
6
+ import com.facebook.react.ReactActivity
7
+ import com.facebook.react.ReactActivityDelegate
8
+ import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
9
+ import com.facebook.react.defaults.DefaultReactActivityDelegate
10
+
11
+ import expo.modules.ReactActivityDelegateWrapper
12
+
13
+ class MainActivity : ReactActivity() {
14
+ override fun onCreate(savedInstanceState: Bundle?) {
15
+ // Set the theme to AppTheme BEFORE onCreate to support
16
+ // coloring the background, status bar, and navigation bar.
17
+ // This is required for expo-splash-screen.
18
+ setTheme(R.style.AppTheme);
19
+ super.onCreate(null)
20
+ }
21
+
22
+ /**
23
+ * Returns the name of the main component registered from JavaScript. This is used to schedule
24
+ * rendering of the component.
25
+ */
26
+ override fun getMainComponentName(): String = "main"
27
+
28
+ /**
29
+ * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
30
+ * which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
31
+ */
32
+ override fun createReactActivityDelegate(): ReactActivityDelegate {
33
+ return ReactActivityDelegateWrapper(
34
+ this,
35
+ BuildConfig.IS_NEW_ARCHITECTURE_ENABLED,
36
+ object : DefaultReactActivityDelegate(
37
+ this,
38
+ mainComponentName,
39
+ fabricEnabled
40
+ ){})
41
+ }
42
+
43
+ /**
44
+ * Align the back button behavior with Android S
45
+ * where moving root activities to background instead of finishing activities.
46
+ * @see <a href="https://developer.android.com/reference/android/app/Activity#onBackPressed()">onBackPressed</a>
47
+ */
48
+ override fun invokeDefaultOnBackPressed() {
49
+ if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) {
50
+ if (!moveTaskToBack(false)) {
51
+ // For non-root activities, use the default implementation to finish them.
52
+ super.invokeDefaultOnBackPressed()
53
+ }
54
+ return
55
+ }
56
+
57
+ // Use the default back button implementation on Android S
58
+ // because it's doing more than [Activity.moveTaskToBack] in fact.
59
+ super.invokeDefaultOnBackPressed()
60
+ }
61
+ }
@@ -0,0 +1,63 @@
1
+ package com.helloworld
2
+
3
+ import android.app.Application
4
+ import android.content.res.Configuration
5
+ import androidx.annotation.NonNull
6
+
7
+ import com.facebook.react.PackageList
8
+ import com.facebook.react.ReactApplication
9
+ import com.facebook.react.ReactNativeHost
10
+ import com.facebook.react.ReactPackage
11
+ import com.facebook.react.ReactHost
12
+ import com.facebook.react.config.ReactFeatureFlags
13
+ import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
14
+ import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
15
+ import com.facebook.react.defaults.DefaultReactNativeHost
16
+ import com.facebook.react.flipper.ReactNativeFlipper
17
+ import com.facebook.soloader.SoLoader
18
+
19
+ import expo.modules.ApplicationLifecycleDispatcher
20
+ import expo.modules.ReactNativeHostWrapper
21
+
22
+ class MainApplication : Application(), ReactApplication {
23
+
24
+ override val reactNativeHost: ReactNativeHost = ReactNativeHostWrapper(
25
+ this,
26
+ object : DefaultReactNativeHost(this) {
27
+ override fun getPackages(): List<ReactPackage> {
28
+ // Packages that cannot be autolinked yet can be added manually here, for example:
29
+ // packages.add(new MyReactNativePackage());
30
+ return PackageList(this).packages
31
+ }
32
+
33
+ override fun getJSMainModuleName(): String = ".expo/.virtual-metro-entry"
34
+
35
+ override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
36
+
37
+ override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
38
+ override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
39
+ }
40
+ )
41
+
42
+ override val reactHost: ReactHost
43
+ get() = getDefaultReactHost(this.applicationContext, reactNativeHost)
44
+
45
+ override fun onCreate() {
46
+ super.onCreate()
47
+ SoLoader.init(this, false)
48
+ if (!BuildConfig.REACT_NATIVE_UNSTABLE_USE_RUNTIME_SCHEDULER_ALWAYS) {
49
+ ReactFeatureFlags.unstable_useRuntimeSchedulerAlways = false
50
+ }
51
+ if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
52
+ // If you opted-in for the New Architecture, we load the native entry point for this app.
53
+ load()
54
+ }
55
+ ReactNativeFlipper.initializeFlipper(this, reactNativeHost.reactInstanceManager)
56
+ ApplicationLifecycleDispatcher.onApplicationCreate(this)
57
+ }
58
+
59
+ override fun onConfigurationChanged(newConfig: Configuration) {
60
+ super.onConfigurationChanged(newConfig)
61
+ ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig)
62
+ }
63
+ }
@@ -2,26 +2,27 @@
2
2
 
3
3
  buildscript {
4
4
  ext {
5
- buildToolsVersion = findProperty('android.buildToolsVersion') ?: '33.0.0'
5
+ buildToolsVersion = findProperty('android.buildToolsVersion') ?: '34.0.0'
6
6
  minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '21')
7
- compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '33')
8
- targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '33')
7
+ compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '34')
8
+ targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '34')
9
9
  kotlinVersion = findProperty('android.kotlinVersion') ?: '1.8.10'
10
10
  frescoVersion = findProperty('expo.frescoVersion') ?: '2.5.0'
11
11
 
12
- // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
13
- ndkVersion = "23.1.7779620"
12
+ ndkVersion = "25.1.8937393"
14
13
  }
15
14
  repositories {
16
15
  google()
17
16
  mavenCentral()
18
17
  }
19
18
  dependencies {
20
- classpath('com.android.tools.build:gradle:7.4.2')
19
+ classpath('com.android.tools.build:gradle')
21
20
  classpath('com.facebook.react:react-native-gradle-plugin')
22
21
  }
23
22
  }
24
23
 
24
+ apply plugin: "com.facebook.react.rootproject"
25
+
25
26
  allprojects {
26
27
  repositories {
27
28
  maven {
@@ -1,6 +1,7 @@
1
1
  distributionBase=GRADLE_USER_HOME
2
2
  distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
4
4
  networkTimeout=10000
5
+ validateDistributionUrl=true
5
6
  zipStoreBase=GRADLE_USER_HOME
6
7
  zipStorePath=wrapper/dists
@@ -25,9 +25,6 @@ android.useAndroidX=true
25
25
  # Automatically convert third-party libraries to use AndroidX
26
26
  android.enableJetifier=true
27
27
 
28
- # Version of flipper SDK to use with React Native
29
- FLIPPER_VERSION=0.182.0
30
-
31
28
  # Use this property to specify which architecture you want to build.
32
29
  # You can also override it from the CLI using
33
30
  # ./gradlew <task> -PreactNativeArchitectures=x86_64
package/android/gradlew CHANGED
@@ -55,7 +55,7 @@
55
55
  # Darwin, MinGW, and NonStop.
56
56
  #
57
57
  # (3) This script is generated from the Groovy template
58
- # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
58
+ # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59
59
  # within the Gradle project.
60
60
  #
61
61
  # You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,13 +80,11 @@ do
80
80
  esac
81
81
  done
82
82
 
83
- APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84
-
85
- APP_NAME="Gradle"
83
+ # This is normally unused
84
+ # shellcheck disable=SC2034
86
85
  APP_BASE_NAME=${0##*/}
87
-
88
- # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89
- DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
86
+ # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87
+ APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
90
88
 
91
89
  # Use the maximum available, or set MAX_FD != -1 to use that value.
92
90
  MAX_FD=maximum
@@ -133,22 +131,29 @@ location of your Java installation."
133
131
  fi
134
132
  else
135
133
  JAVACMD=java
136
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
134
+ if ! command -v java >/dev/null 2>&1
135
+ then
136
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137
137
 
138
138
  Please set the JAVA_HOME variable in your environment to match the
139
139
  location of your Java installation."
140
+ fi
140
141
  fi
141
142
 
142
143
  # Increase the maximum file descriptors if we can.
143
144
  if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144
145
  case $MAX_FD in #(
145
146
  max*)
147
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
148
+ # shellcheck disable=SC2039,SC3045
146
149
  MAX_FD=$( ulimit -H -n ) ||
147
150
  warn "Could not query maximum file descriptor limit"
148
151
  esac
149
152
  case $MAX_FD in #(
150
153
  '' | soft) :;; #(
151
154
  *)
155
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
156
+ # shellcheck disable=SC2039,SC3045
152
157
  ulimit -n "$MAX_FD" ||
153
158
  warn "Could not set maximum file descriptor limit to $MAX_FD"
154
159
  esac
@@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then
193
198
  done
194
199
  fi
195
200
 
196
- # Collect all arguments for the java command;
197
- # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
198
- # shell script including quotes and variable substitutions, so put them in
199
- # double quotes to make sure that they get re-expanded; and
200
- # * put everything else in single quotes, so that it's not re-expanded.
201
+
202
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203
+ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204
+
205
+ # Collect all arguments for the java command:
206
+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207
+ # and any embedded shellness will be escaped.
208
+ # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209
+ # treated as '${Hostname}' itself on the command line.
201
210
 
202
211
  set -- \
203
212
  "-Dorg.gradle.appname=$APP_BASE_NAME" \
@@ -17,6 +17,11 @@
17
17
  }
18
18
 
19
19
  - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
20
+ {
21
+ return [self getBundleURL];
22
+ }
23
+
24
+ - (NSURL *)getBundleURL
20
25
  {
21
26
  #if DEBUG
22
27
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@".expo/.virtual-metro-entry"];
@@ -2,6 +2,8 @@
2
2
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
3
  <plist version="1.0">
4
4
  <dict>
5
+ <key>CADisableMinimumFrameDurationOnPhone</key>
6
+ <true/>
5
7
  <key>CFBundleDevelopmentRegion</key>
6
8
  <string>$(DEVELOPMENT_LANGUAGE)</string>
7
9
  <key>CFBundleExecutable</key>
@@ -14,10 +16,10 @@
14
16
  <string>$(PRODUCT_NAME)</string>
15
17
  <key>CFBundlePackageType</key>
16
18
  <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
17
- <key>CFBundleSignature</key>
18
- <string>????</string>
19
19
  <key>CFBundleShortVersionString</key>
20
20
  <string>1.0</string>
21
+ <key>CFBundleSignature</key>
22
+ <string>????</string>
21
23
  <key>CFBundleVersion</key>
22
24
  <string>1</string>
23
25
  <key>LSRequiresIPhoneOS</key>
@@ -25,15 +27,9 @@
25
27
  <key>NSAppTransportSecurity</key>
26
28
  <dict>
27
29
  <key>NSAllowsArbitraryLoads</key>
30
+ <false/>
31
+ <key>NSAllowsLocalNetworking</key>
28
32
  <true/>
29
- <key>NSExceptionDomains</key>
30
- <dict>
31
- <key>localhost</key>
32
- <dict>
33
- <key>NSExceptionAllowsInsecureHTTPLoads</key>
34
- <true/>
35
- </dict>
36
- </dict>
37
33
  </dict>
38
34
  <key>UILaunchStoryboardName</key>
39
35
  <string>SplashScreen</string>
@@ -41,6 +37,8 @@
41
37
  <array>
42
38
  <string>armv7</string>
43
39
  </array>
40
+ <key>UIStatusBarStyle</key>
41
+ <string>UIStatusBarStyleDefault</string>
44
42
  <key>UISupportedInterfaceOrientations</key>
45
43
  <array>
46
44
  <string>UIInterfaceOrientationPortrait</string>
@@ -49,9 +47,5 @@
49
47
  </array>
50
48
  <key>UIViewControllerBasedStatusBarAppearance</key>
51
49
  <false/>
52
- <key>UIStatusBarStyle</key>
53
- <string>UIStatusBarStyleDefault</string>
54
- <key>CADisableMinimumFrameDurationOnPhone</key>
55
- <true/>
56
50
  </dict>
57
51
  </plist>
@@ -245,13 +245,13 @@
245
245
  "${PODS_ROOT}/Target Support Files/Pods-HelloWorld/Pods-HelloWorld-resources.sh",
246
246
  "${PODS_CONFIGURATION_BUILD_DIR}/EXConstants/EXConstants.bundle",
247
247
  "${PODS_CONFIGURATION_BUILD_DIR}/EXUpdates/EXUpdates.bundle",
248
- "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle",
248
+ "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/RCTI18nStrings.bundle",
249
249
  );
250
250
  name = "[CP] Copy Pods Resources";
251
251
  outputPaths = (
252
252
  "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EXConstants.bundle",
253
253
  "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EXUpdates.bundle",
254
- "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle",
254
+ "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RCTI18nStrings.bundle",
255
255
  );
256
256
  runOnlyForDeploymentPostprocessing = 0;
257
257
  shellPath = /bin/sh;
@@ -289,7 +289,7 @@
289
289
  INFOPLIST_FILE = HelloWorld/Info.plist;
290
290
  IPHONEOS_DEPLOYMENT_TARGET = 13.4;
291
291
  LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
292
- MARKETING_VERSION = 1.0;
292
+ MARKETING_VERSION = 1.0;
293
293
  OTHER_LDFLAGS = (
294
294
  "$(inherited)",
295
295
  "-ObjC",
@@ -313,7 +313,7 @@
313
313
  INFOPLIST_FILE = HelloWorld/Info.plist;
314
314
  IPHONEOS_DEPLOYMENT_TARGET = 13.4;
315
315
  LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
316
- MARKETING_VERSION = 1.0;
316
+ MARKETING_VERSION = 1.0;
317
317
  OTHER_LDFLAGS = (
318
318
  "$(inherited)",
319
319
  "-ObjC",
@@ -331,7 +331,7 @@
331
331
  buildSettings = {
332
332
  ALWAYS_SEARCH_USER_PATHS = NO;
333
333
  CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
334
- CLANG_CXX_LANGUAGE_STANDARD = "c++17";
334
+ CLANG_CXX_LANGUAGE_STANDARD = "c++20";
335
335
  CLANG_CXX_LIBRARY = "libc++";
336
336
  CLANG_ENABLE_MODULES = YES;
337
337
  CLANG_ENABLE_OBJC_ARC = YES;
@@ -387,7 +387,7 @@
387
387
  buildSettings = {
388
388
  ALWAYS_SEARCH_USER_PATHS = NO;
389
389
  CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
390
- CLANG_CXX_LANGUAGE_STANDARD = "c++17";
390
+ CLANG_CXX_LANGUAGE_STANDARD = "c++20";
391
391
  CLANG_CXX_LIBRARY = "libc++";
392
392
  CLANG_ENABLE_MODULES = YES;
393
393
  CLANG_ENABLE_OBJC_ARC = YES;
package/ios/Podfile CHANGED
@@ -44,13 +44,9 @@ target 'HelloWorld' do
44
44
  use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
45
45
  use_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS']
46
46
 
47
- # Flags change depending on the env values.
48
- flags = get_default_flags()
49
-
50
47
  use_react_native!(
51
48
  :path => config[:reactNativePath],
52
49
  :hermes_enabled => podfile_properties['expo.jsEngine'] == nil || podfile_properties['expo.jsEngine'] == 'hermes',
53
- :fabric_enabled => flags[:fabric_enabled],
54
50
  # An absolute path to your application root.
55
51
  :app_path => "#{Pod::Config.instance.installation_root}/..",
56
52
  # Note that if you have use_frameworks! enabled, Flipper will not work if enabled
@@ -63,7 +59,6 @@ target 'HelloWorld' do
63
59
  config[:reactNativePath],
64
60
  :mac_catalyst_enabled => false
65
61
  )
66
- __apply_Xcode_12_5_M1_post_install_workaround(installer)
67
62
 
68
63
  # This is necessary for Xcode 14, because it signs resource bundles by default
69
64
  # when building for devices.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "expo-template-bare-minimum",
3
3
  "description": "This bare project template includes a minimal setup for using unimodules with React Native.",
4
- "version": "50.0.7",
4
+ "version": "50.0.9",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "start": "expo start --dev-client",
@@ -13,7 +13,7 @@
13
13
  "expo": "~50.0.0-alpha.7",
14
14
  "expo-status-bar": "~1.10.0",
15
15
  "react": "18.2.0",
16
- "react-native": "0.72.5"
16
+ "react-native": "0.73.0-rc.6"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@babel/core": "^7.20.0"
@@ -1,75 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * <p>This source code is licensed under the MIT license found in the LICENSE file in the root
5
- * directory of this source tree.
6
- */
7
- package com.helloworld;
8
-
9
- import android.content.Context;
10
- import com.facebook.flipper.android.AndroidFlipperClient;
11
- import com.facebook.flipper.android.utils.FlipperUtils;
12
- import com.facebook.flipper.core.FlipperClient;
13
- import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
14
- import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
15
- import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
16
- import com.facebook.flipper.plugins.inspector.DescriptorMapping;
17
- import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
18
- import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
19
- import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
20
- import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
21
- import com.facebook.react.ReactInstanceEventListener;
22
- import com.facebook.react.ReactInstanceManager;
23
- import com.facebook.react.bridge.ReactContext;
24
- import com.facebook.react.modules.network.NetworkingModule;
25
- import okhttp3.OkHttpClient;
26
-
27
- /**
28
- * Class responsible of loading Flipper inside your React Native application. This is the debug
29
- * flavor of it. Here you can add your own plugins and customize the Flipper setup.
30
- */
31
- public class ReactNativeFlipper {
32
- public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
33
- if (FlipperUtils.shouldEnableFlipper(context)) {
34
- final FlipperClient client = AndroidFlipperClient.getInstance(context);
35
-
36
- client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
37
- client.addPlugin(new DatabasesFlipperPlugin(context));
38
- client.addPlugin(new SharedPreferencesFlipperPlugin(context));
39
- client.addPlugin(CrashReporterPlugin.getInstance());
40
-
41
- NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
42
- NetworkingModule.setCustomClientBuilder(
43
- new NetworkingModule.CustomClientBuilder() {
44
- @Override
45
- public void apply(OkHttpClient.Builder builder) {
46
- builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
47
- }
48
- });
49
- client.addPlugin(networkFlipperPlugin);
50
- client.start();
51
-
52
- // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
53
- // Hence we run if after all native modules have been initialized
54
- ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
55
- if (reactContext == null) {
56
- reactInstanceManager.addReactInstanceEventListener(
57
- new ReactInstanceEventListener() {
58
- @Override
59
- public void onReactContextInitialized(ReactContext reactContext) {
60
- reactInstanceManager.removeReactInstanceEventListener(this);
61
- reactContext.runOnNativeModulesQueueThread(
62
- new Runnable() {
63
- @Override
64
- public void run() {
65
- client.addPlugin(new FrescoFlipperPlugin());
66
- }
67
- });
68
- }
69
- });
70
- } else {
71
- client.addPlugin(new FrescoFlipperPlugin());
72
- }
73
- }
74
- }
75
- }
@@ -1,65 +0,0 @@
1
- package com.helloworld;
2
-
3
- import android.os.Build;
4
- import android.os.Bundle;
5
-
6
- import com.facebook.react.ReactActivity;
7
- import com.facebook.react.ReactActivityDelegate;
8
- import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
9
- import com.facebook.react.defaults.DefaultReactActivityDelegate;
10
-
11
- import expo.modules.ReactActivityDelegateWrapper;
12
-
13
- public class MainActivity extends ReactActivity {
14
- @Override
15
- protected void onCreate(Bundle savedInstanceState) {
16
- // Set the theme to AppTheme BEFORE onCreate to support
17
- // coloring the background, status bar, and navigation bar.
18
- // This is required for expo-splash-screen.
19
- setTheme(R.style.AppTheme);
20
- super.onCreate(null);
21
- }
22
-
23
- /**
24
- * Returns the name of the main component registered from JavaScript.
25
- * This is used to schedule rendering of the component.
26
- */
27
- @Override
28
- protected String getMainComponentName() {
29
- return "main";
30
- }
31
-
32
- /**
33
- * Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link
34
- * DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React
35
- * (aka React 18) with two boolean flags.
36
- */
37
- @Override
38
- protected ReactActivityDelegate createReactActivityDelegate() {
39
- return new ReactActivityDelegateWrapper(this, BuildConfig.IS_NEW_ARCHITECTURE_ENABLED, new DefaultReactActivityDelegate(
40
- this,
41
- getMainComponentName(),
42
- // If you opted-in for the New Architecture, we enable the Fabric Renderer.
43
- DefaultNewArchitectureEntryPoint.getFabricEnabled()));
44
- }
45
-
46
- /**
47
- * Align the back button behavior with Android S
48
- * where moving root activities to background instead of finishing activities.
49
- * @see <a href="https://developer.android.com/reference/android/app/Activity#onBackPressed()">onBackPressed</a>
50
- */
51
- @Override
52
- public void invokeDefaultOnBackPressed() {
53
- if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) {
54
- if (!moveTaskToBack(false)) {
55
- // For non-root activities, use the default implementation to finish them.
56
- super.invokeDefaultOnBackPressed();
57
- }
58
- return;
59
- }
60
-
61
- // Use the default back button implementation on Android S
62
- // because it's doing more than {@link Activity#moveTaskToBack} in fact.
63
- super.invokeDefaultOnBackPressed();
64
- }
65
- }
@@ -1,80 +0,0 @@
1
- package com.helloworld;
2
-
3
- import android.app.Application;
4
- import android.content.res.Configuration;
5
- import androidx.annotation.NonNull;
6
-
7
- import com.facebook.react.PackageList;
8
- import com.facebook.react.ReactApplication;
9
- import com.facebook.react.ReactNativeHost;
10
- import com.facebook.react.ReactPackage;
11
- import com.facebook.react.config.ReactFeatureFlags;
12
- import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
13
- import com.facebook.react.defaults.DefaultReactNativeHost;
14
- import com.facebook.soloader.SoLoader;
15
-
16
- import expo.modules.ApplicationLifecycleDispatcher;
17
- import expo.modules.ReactNativeHostWrapper;
18
-
19
- import java.util.List;
20
-
21
- public class MainApplication extends Application implements ReactApplication {
22
-
23
- private final ReactNativeHost mReactNativeHost =
24
- new ReactNativeHostWrapper(this, new DefaultReactNativeHost(this) {
25
- @Override
26
- public boolean getUseDeveloperSupport() {
27
- return BuildConfig.DEBUG;
28
- }
29
-
30
- @Override
31
- protected List<ReactPackage> getPackages() {
32
- @SuppressWarnings("UnnecessaryLocalVariable")
33
- List<ReactPackage> packages = new PackageList(this).getPackages();
34
- // Packages that cannot be autolinked yet can be added manually here, for example:
35
- // packages.add(new MyReactNativePackage());
36
- return packages;
37
- }
38
-
39
- @Override
40
- protected String getJSMainModuleName() {
41
- return ".expo/.virtual-metro-entry";
42
- }
43
-
44
- @Override
45
- protected boolean isNewArchEnabled() {
46
- return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
47
- }
48
-
49
- @Override
50
- protected Boolean isHermesEnabled() {
51
- return BuildConfig.IS_HERMES_ENABLED;
52
- }
53
- });
54
-
55
- @Override
56
- public ReactNativeHost getReactNativeHost() {
57
- return mReactNativeHost;
58
- }
59
-
60
- @Override
61
- public void onCreate() {
62
- super.onCreate();
63
- SoLoader.init(this, /* native exopackage */ false);
64
- if (!BuildConfig.REACT_NATIVE_UNSTABLE_USE_RUNTIME_SCHEDULER_ALWAYS) {
65
- ReactFeatureFlags.unstable_useRuntimeSchedulerAlways = false;
66
- }
67
- if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
68
- // If you opted-in for the New Architecture, we load the native entry point for this app.
69
- DefaultNewArchitectureEntryPoint.load();
70
- }
71
- ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
72
- ApplicationLifecycleDispatcher.onApplicationCreate(this);
73
- }
74
-
75
- @Override
76
- public void onConfigurationChanged(@NonNull Configuration newConfig) {
77
- super.onConfigurationChanged(newConfig);
78
- ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig);
79
- }
80
- }
@@ -1,20 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * <p>This source code is licensed under the MIT license found in the LICENSE file in the root
5
- * directory of this source tree.
6
- */
7
- package com.helloworld;
8
-
9
- import android.content.Context;
10
- import com.facebook.react.ReactInstanceManager;
11
-
12
- /**
13
- * Class responsible of loading Flipper inside your React Native application. This is the release
14
- * flavor of it so it's empty as we don't want to load Flipper.
15
- */
16
- public class ReactNativeFlipper {
17
- public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
18
- // Do nothing as we don't want to initialize Flipper on Release.
19
- }
20
- }