expo-template-bare-minimum 45.0.3 → 46.0.0

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.
@@ -80,15 +80,16 @@ import org.apache.tools.ant.taskdefs.condition.Os
80
80
 
81
81
  def projectRoot = rootDir.getAbsoluteFile().getParentFile().getAbsolutePath()
82
82
 
83
+ def reactNativeRoot = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath()
84
+
83
85
  project.ext.react = [
84
86
  entryFile: ["node", "-e", "require('expo/scripts/resolveAppEntry')", projectRoot, "android"].execute(null, rootDir).text.trim(),
85
87
  enableHermes: (findProperty('expo.jsEngine') ?: "jsc") == "hermes",
86
- cliPath: new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/cli.js",
87
- hermesCommand: new File(["node", "--print", "require.resolve('hermes-engine/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/%OS-BIN%/hermesc",
88
- composeSourceMapsPath: new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/scripts/compose-source-maps.js",
88
+ cliPath: "${reactNativeRoot}/cli.js",
89
+ composeSourceMapsPath: "${reactNativeRoot}/scripts/compose-source-maps.js",
89
90
  ]
90
91
 
91
- apply from: new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), "../react.gradle")
92
+ apply from: new File(reactNativeRoot, "react.gradle")
92
93
 
93
94
  /**
94
95
  * Set this to true to create two separate APKs instead of one:
@@ -157,8 +158,9 @@ android {
157
158
  "NDK_TOOLCHAIN_VERSION=clang",
158
159
  "GENERATED_SRC_DIR=$buildDir/generated/source",
159
160
  "PROJECT_BUILD_DIR=$buildDir",
160
- "REACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
161
- "REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build"
161
+ "REACT_ANDROID_DIR=${reactNativeRoot}/ReactAndroid",
162
+ "REACT_ANDROID_BUILD_DIR=${reactNativeRoot}/build",
163
+ "NODE_MODULES_DIR=$rootDir/../node_modules"
162
164
  cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1"
163
165
  cppFlags "-std=c++17"
164
166
  // Make sure this target name is the same you specify inside the
@@ -167,8 +169,7 @@ android {
167
169
 
168
170
  // Fix for windows limit on number of character in file paths and in command lines
169
171
  if (Os.isFamily(Os.FAMILY_WINDOWS)) {
170
- arguments "NDK_OUT=${rootProject.projectDir.getParent()}\\.cxx",
171
- "NDK_APP_SHORT_COMMANDS=true"
172
+ arguments "NDK_APP_SHORT_COMMANDS=true"
172
173
  }
173
174
  }
174
175
  }
@@ -295,25 +296,25 @@ dependencies {
295
296
  def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";
296
297
  def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";
297
298
  def isWebpAnimatedEnabled = (findProperty('expo.webp.animated') ?: "") == "true";
299
+ def frescoVersion = rootProject.ext.frescoVersion
298
300
 
299
301
  // If your app supports Android versions before Ice Cream Sandwich (API level 14)
300
- // All fresco packages should use the same version
301
302
  if (isGifEnabled || isWebpEnabled) {
302
- implementation 'com.facebook.fresco:fresco:2.0.0'
303
- implementation 'com.facebook.fresco:imagepipeline-okhttp3:2.0.0'
303
+ implementation "com.facebook.fresco:fresco:${frescoVersion}"
304
+ implementation "com.facebook.fresco:imagepipeline-okhttp3:${frescoVersion}"
304
305
  }
305
306
 
306
307
  if (isGifEnabled) {
307
308
  // For animated gif support
308
- implementation 'com.facebook.fresco:animated-gif:2.0.0'
309
+ implementation "com.facebook.fresco:animated-gif:${frescoVersion}"
309
310
  }
310
311
 
311
312
  if (isWebpEnabled) {
312
313
  // For webp support
313
- implementation 'com.facebook.fresco:webpsupport:2.0.0'
314
+ implementation "com.facebook.fresco:webpsupport:${frescoVersion}"
314
315
  if (isWebpAnimatedEnabled) {
315
316
  // Animated webp support
316
- implementation 'com.facebook.fresco:animated-webp:2.0.0'
317
+ implementation "com.facebook.fresco:animated-webp:${frescoVersion}"
317
318
  }
318
319
  }
319
320
 
@@ -330,8 +331,10 @@ dependencies {
330
331
  }
331
332
 
332
333
  if (enableHermes) {
333
- debugImplementation files(new File(["node", "--print", "require.resolve('hermes-engine/package.json')"].execute(null, rootDir).text.trim(), "../android/hermes-debug.aar"))
334
- releaseImplementation files(new File(["node", "--print", "require.resolve('hermes-engine/package.json')"].execute(null, rootDir).text.trim(), "../android/hermes-release.aar"))
334
+ //noinspection GradleDynamicVersion
335
+ implementation("com.facebook.react:hermes-engine:+") { // From node_modules
336
+ exclude group:'com.facebook.fbjni'
337
+ }
335
338
  } else {
336
339
  implementation jscFlavor
337
340
  }
@@ -344,7 +347,11 @@ if (isNewArchitectureEnabled()) {
344
347
  configurations.all {
345
348
  resolutionStrategy.dependencySubstitution {
346
349
  substitute(module("com.facebook.react:react-native"))
347
- .using(project(":ReactAndroid")).because("On New Architecture we're building React Native from source")
350
+ .using(project(":ReactAndroid"))
351
+ .because("On New Architecture we're building React Native from source")
352
+ substitute(module("com.facebook.react:hermes-engine"))
353
+ .using(project(":ReactAndroid:hermes-engine"))
354
+ .because("On New Architecture we're building Hermes from source")
348
355
  }
349
356
  }
350
357
  }
@@ -28,10 +28,15 @@ public class MainActivity extends ReactActivity {
28
28
  return "main";
29
29
  }
30
30
 
31
+ /**
32
+ * Returns the instance of the {@link ReactActivityDelegate}. There the RootView is created and
33
+ * you can specify the renderer you wish to use - the new renderer (Fabric) or the old renderer
34
+ * (Paper).
35
+ */
31
36
  @Override
32
37
  protected ReactActivityDelegate createReactActivityDelegate() {
33
- return new ReactActivityDelegateWrapper(this,
34
- new ReactActivityDelegate(this, getMainComponentName())
38
+ return new ReactActivityDelegateWrapper(this, BuildConfig.IS_NEW_ARCHITECTURE_ENABLED,
39
+ new MainActivityDelegate(this, getMainComponentName())
35
40
  );
36
41
  }
37
42
 
@@ -54,4 +59,25 @@ public class MainActivity extends ReactActivity {
54
59
  // because it's doing more than {@link Activity#moveTaskToBack} in fact.
55
60
  super.invokeDefaultOnBackPressed();
56
61
  }
62
+
63
+ public static class MainActivityDelegate extends ReactActivityDelegate {
64
+ public MainActivityDelegate(ReactActivity activity, String mainComponentName) {
65
+ super(activity, mainComponentName);
66
+ }
67
+
68
+ @Override
69
+ protected ReactRootView createRootView() {
70
+ ReactRootView reactRootView = new ReactRootView(getContext());
71
+ // If you opted-in for the New Architecture, we enable the Fabric Renderer.
72
+ reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
73
+ return reactRootView;
74
+ }
75
+
76
+ @Override
77
+ protected boolean isConcurrentRootEnabled() {
78
+ // If you opted-in for the New Architecture, we enable Concurrent Root (i.e. React 18).
79
+ // More on this on https://reactjs.org/blog/2022/03/29/react-v18.html
80
+ return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
81
+ }
82
+ }
57
83
  }
@@ -18,6 +18,7 @@ import com.facebook.react.fabric.ComponentFactory;
18
18
  import com.facebook.react.fabric.CoreComponentsRegistry;
19
19
  import com.facebook.react.fabric.EmptyReactNativeConfig;
20
20
  import com.facebook.react.fabric.FabricJSIModuleProvider;
21
+ import com.facebook.react.fabric.ReactNativeConfig;
21
22
  import com.facebook.react.uimanager.ViewManagerRegistry;
22
23
  import com.helloworld.BuildConfig;
23
24
  import com.helloworld.newarchitecture.components.MainComponentsRegistry;
@@ -105,7 +106,7 @@ public class MainApplicationReactNativeHost extends ReactNativeHost {
105
106
  return new FabricJSIModuleProvider(
106
107
  reactApplicationContext,
107
108
  componentFactory,
108
- new EmptyReactNativeConfig(),
109
+ ReactNativeConfig.DEFAULT_CONFIG,
109
110
  viewManagerRegistry);
110
111
  }
111
112
  });
@@ -17,7 +17,7 @@ LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp)
17
17
  LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
18
18
 
19
19
  # If you wish to add a custom TurboModule or Fabric component in your app you
20
- # will have to uncomment those lines to include the generated source
20
+ # will have to uncomment those lines to include the generated source
21
21
  # files from the codegen (placed in $(GENERATED_SRC_DIR)/codegen/jni)
22
22
  #
23
23
  # LOCAL_C_INCLUDES += $(GENERATED_SRC_DIR)/codegen/jni
@@ -28,8 +28,7 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
28
28
  LOCAL_SHARED_LIBRARIES := \
29
29
  libfabricjni \
30
30
  libfbjni \
31
- libfolly_futures \
32
- libfolly_json \
31
+ libfolly_runtime \
33
32
  libglog \
34
33
  libjsi \
35
34
  libreact_codegen_rncore \
@@ -4,24 +4,21 @@ import org.apache.tools.ant.taskdefs.condition.Os
4
4
 
5
5
  buildscript {
6
6
  ext {
7
- buildToolsVersion = findProperty('android.buildToolsVersion') ?: "31.0.0"
8
- minSdkVersion = 21
9
- compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: "31")
10
- targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: "31")
11
- if (hasProperty('android.kotlinVersion')) {
7
+ buildToolsVersion = findProperty('android.buildToolsVersion') ?: '31.0.0'
8
+ minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '21')
9
+ compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '31')
10
+ targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '31')
11
+ if (findProperty('android.kotlinVersion')) {
12
12
  kotlinVersion = findProperty('android.kotlinVersion')
13
13
  }
14
+ frescoVersion = findProperty('expo.frescoVersion') ?: '2.5.0'
14
15
 
15
- if (System.properties['os.arch'] == "aarch64") {
16
+ if (System.properties['os.arch'] == 'aarch64') {
16
17
  // For M1 Users we need to use the NDK 24 which added support for aarch64
17
- ndkVersion = "24.0.8215888"
18
- } else if (Os.isFamily(Os.FAMILY_WINDOWS)) {
19
- // For Android Users, we need to use NDK 23, otherwise the build will
20
- // fail due to paths longer than the OS limit
21
- ndkVersion = "23.1.7779620"
18
+ ndkVersion = '24.0.8215888'
22
19
  } else {
23
20
  // Otherwise we default to the side-by-side NDK version from AGP.
24
- ndkVersion = "21.4.7075529"
21
+ ndkVersion = '21.4.7075529'
25
22
  }
26
23
  }
27
24
  repositories {
@@ -29,9 +26,9 @@ buildscript {
29
26
  mavenCentral()
30
27
  }
31
28
  dependencies {
32
- classpath("com.android.tools.build:gradle:7.0.4")
33
- classpath("com.facebook.react:react-native-gradle-plugin")
34
- classpath("de.undercouch:gradle-download-task:4.1.2")
29
+ classpath('com.android.tools.build:gradle:7.1.1')
30
+ classpath('com.facebook.react:react-native-gradle-plugin')
31
+ classpath('de.undercouch:gradle-download-task:5.0.1')
35
32
  // NOTE: Do not place your application dependencies here; they belong
36
33
  // in the individual module build.gradle files
37
34
  }
@@ -42,11 +39,11 @@ allprojects {
42
39
  mavenLocal()
43
40
  maven {
44
41
  // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
45
- url(new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), "../android"))
42
+ url(new File(['node', '--print', "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), '../android'))
46
43
  }
47
44
  maven {
48
45
  // Android JSC is installed from npm
49
- url(new File(["node", "--print", "require.resolve('jsc-android/package.json')"].execute(null, rootDir).text.trim(), "../dist"))
46
+ url(new File(['node', '--print', "require.resolve('jsc-android/package.json')"].execute(null, rootDir).text.trim(), '../dist'))
50
47
  }
51
48
 
52
49
  google()
@@ -54,7 +51,7 @@ allprojects {
54
51
  // We don't want to fetch react-native from Maven Central as there are
55
52
  // older versions over there.
56
53
  content {
57
- excludeGroup "com.facebook.react"
54
+ excludeGroup 'com.facebook.react'
58
55
  }
59
56
  }
60
57
  maven { url 'https://www.jitpack.io' }
@@ -12,4 +12,6 @@ includeBuild(new File(["node", "--print", "require.resolve('react-native-gradle-
12
12
  if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") {
13
13
  include(":ReactAndroid")
14
14
  project(":ReactAndroid").projectDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), "../ReactAndroid");
15
+ include(":ReactAndroid:hermes-engine")
16
+ project(":ReactAndroid:hermes-engine").projectDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), "../ReactAndroid/hermes-engine");
15
17
  }
package/ios/.xcode.env ADDED
@@ -0,0 +1,11 @@
1
+ # This `.xcode.env` file is versioned and is used to source the environment
2
+ # used when running script phases inside Xcode.
3
+ # To customize your local environment, you can create an `.xcode.env.local`
4
+ # file that is not versioned.
5
+
6
+ # NODE_BINARY variable contains the PATH to the node executable.
7
+ #
8
+ # Customize the NODE_BINARY variable here.
9
+ # For example, to use nvm with brew, add the following line
10
+ # . "$(brew --prefix nvm)/nvm.sh" --no-use
11
+ export NODE_BINARY=$(command -v node)
@@ -18,6 +18,8 @@
18
18
 
19
19
  #import <react/config/ReactNativeConfig.h>
20
20
 
21
+ static NSString *const kRNConcurrentRoot = @"concurrentRoot";
22
+
21
23
  @interface AppDelegate () <RCTCxxBridgeDelegate, RCTTurboModuleManagerDelegate> {
22
24
  RCTTurboModuleManager *_turboModuleManager;
23
25
  RCTSurfacePresenterBridgeAdapter *_bridgeAdapter;
@@ -43,7 +45,8 @@
43
45
  bridge.surfacePresenter = _bridgeAdapter.surfacePresenter;
44
46
  #endif
45
47
 
46
- UIView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"main" initialProperties:nil];
48
+ NSDictionary *initProps = [self prepareInitialProps];
49
+ UIView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"main" initialProperties:initProps];
47
50
 
48
51
  rootView.backgroundColor = [UIColor whiteColor];
49
52
  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
@@ -63,6 +66,26 @@
63
66
  return @[];
64
67
  }
65
68
 
69
+ /// This method controls whether the `concurrentRoot`feature of React18 is turned on or off.
70
+ ///
71
+ /// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
72
+ /// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
73
+ /// @return: `true` if the `concurrentRoot` feture is enabled. Otherwise, it returns `false`.
74
+ - (BOOL)concurrentRootEnabled
75
+ {
76
+ // Switch this bool to turn on and off the concurrent root
77
+ return true;
78
+ }
79
+
80
+ - (NSDictionary *)prepareInitialProps
81
+ {
82
+ NSMutableDictionary *initProps = [NSMutableDictionary new];
83
+ #if RCT_NEW_ARCH_ENABLED
84
+ initProps[kRNConcurrentRoot] = @([self concurrentRootEnabled]);
85
+ #endif
86
+ return initProps;
87
+ }
88
+
66
89
  - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
67
90
  {
68
91
  #if DEBUG
package/ios/Podfile CHANGED
@@ -3,9 +3,9 @@ require File.join(File.dirname(`node --print "require.resolve('react-native/pack
3
3
  require File.join(File.dirname(`node --print "require.resolve('@react-native-community/cli-platform-ios/package.json')"`), "native_modules")
4
4
 
5
5
  require 'json'
6
- podfile_properties = JSON.parse(File.read('./Podfile.properties.json')) rescue {}
6
+ podfile_properties = JSON.parse(File.read(File.join(__dir__, 'Podfile.properties.json'))) rescue {}
7
7
 
8
- platform :ios, podfile_properties['ios.deploymentTarget'] || '12.0'
8
+ platform :ios, podfile_properties['ios.deploymentTarget'] || '12.4'
9
9
  install! 'cocoapods',
10
10
  :deterministic_uuids => false
11
11
 
package/ios/gitignore CHANGED
@@ -21,6 +21,7 @@ DerivedData
21
21
  *.ipa
22
22
  *.xcuserstate
23
23
  project.xcworkspace
24
+ .xcode.env.local
24
25
 
25
26
  # Bundle artifacts
26
27
  *.jsbundle
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": "45.0.3",
4
+ "version": "46.0.0",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "start": "expo start --dev-client",
@@ -10,12 +10,12 @@
10
10
  "web": "expo start --web"
11
11
  },
12
12
  "dependencies": {
13
- "expo": "~45.0.0",
14
- "expo-splash-screen": "~0.15.1",
15
- "expo-status-bar": "~1.3.0",
13
+ "expo": "~46.0.0-alpha.0",
14
+ "expo-splash-screen": "~0.16.0",
15
+ "expo-status-bar": "~1.4.0",
16
16
  "react": "17.0.2",
17
17
  "react-dom": "17.0.2",
18
- "react-native": "0.68.1",
18
+ "react-native": "0.68.2",
19
19
  "react-native-web": "0.17.7"
20
20
  },
21
21
  "devDependencies": {