expo-template-bare-minimum 45.0.5 → 46.0.2

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
@@ -329,8 +331,10 @@ dependencies {
329
331
  }
330
332
 
331
333
  if (enableHermes) {
332
- debugImplementation files(new File(["node", "--print", "require.resolve('hermes-engine/package.json')"].execute(null, rootDir).text.trim(), "../android/hermes-debug.aar"))
333
- 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
+ }
334
338
  } else {
335
339
  implementation jscFlavor
336
340
  }
@@ -343,7 +347,11 @@ if (isNewArchitectureEnabled()) {
343
347
  configurations.all {
344
348
  resolutionStrategy.dependencySubstitution {
345
349
  substitute(module("com.facebook.react:react-native"))
346
- .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")
347
355
  }
348
356
  }
349
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 \
@@ -26,9 +26,9 @@ buildscript {
26
26
  mavenCentral()
27
27
  }
28
28
  dependencies {
29
- classpath('com.android.tools.build:gradle:7.0.4')
29
+ classpath('com.android.tools.build:gradle:7.1.1')
30
30
  classpath('com.facebook.react:react-native-gradle-plugin')
31
- classpath('de.undercouch:gradle-download-task:4.1.2')
31
+ classpath('de.undercouch:gradle-download-task:5.0.1')
32
32
  // NOTE: Do not place your application dependencies here; they belong
33
33
  // in the individual module build.gradle files
34
34
  }
@@ -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
@@ -5,7 +5,7 @@ require File.join(File.dirname(`node --print "require.resolve('@react-native-com
5
5
  require 'json'
6
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.5",
4
+ "version": "46.0.2",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "start": "expo start --dev-client",
@@ -10,13 +10,13 @@
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",
16
- "react": "17.0.2",
17
- "react-dom": "17.0.2",
18
- "react-native": "0.68.2",
19
- "react-native-web": "0.17.7"
13
+ "expo": "~46.0.0-alpha.3",
14
+ "expo-splash-screen": "~0.16.0",
15
+ "expo-status-bar": "~1.4.0",
16
+ "react": "18.0.0",
17
+ "react-dom": "18.0.0",
18
+ "react-native": "0.69.1",
19
+ "react-native-web": "~0.18.6"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@babel/core": "^7.12.9"