Skip to content

Commit

Permalink
chore: update example app to latest RN version 0.76.2 (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
jokerttu authored Nov 19, 2024
1 parent 3d75d92 commit 3218cb1
Show file tree
Hide file tree
Showing 23 changed files with 2,558 additions and 349 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ jobs:
- name: Build example for Android
env:
JAVA_OPTS: '-XX:MaxHeapSize=6g'
JAVA_OPTS: '-Xmx4g -XX:MaxMetaspaceSize=1g'
run: |
echo "MAPS_API_KEY=FAKE_API_KEY" > example/android/local.properties
yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}"
Expand Down Expand Up @@ -195,6 +195,8 @@ jobs:
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
echo "turbo_cache_hit=1" >> $GITHUB_ENV
else
echo "turbo_cache_hit=0" >> $GITHUB_ENV
fi
- name: Cache cocoapods
Expand All @@ -212,7 +214,7 @@ jobs:
if: env.turbo_cache_hit != 1 || steps.cocoapods-cache.outputs.cache-hit != 'true'
run: |
cd example/ios
pod install
RCT_NEW_ARCH_ENABLED=0 pod install
env:
NO_FLIPPER: 1

Expand Down
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 18.20.1
6 changes: 2 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ if (isNewArchitectureEnabled()) {

android {
namespace "com.google.android.react.navsdk"

compileSdkVersion 31
compileSdkVersion 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -49,7 +48,7 @@ android {

defaultConfig {
minSdkVersion 23
targetSdkVersion 31
targetSdkVersion 34
versionCode 1
// get version name from package.json version
versionName "1.0"
Expand All @@ -76,7 +75,6 @@ dependencies {
implementation "androidx.car.app:app:1.4.0"
implementation "androidx.car.app:app-projected:1.4.0"
implementation 'com.facebook.react:react-native:+'
implementation 'com.android.support:multidex:1.0.3'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation "com.google.android.libraries.navigation:navigation:6.0.0"
api 'com.google.guava:guava:31.0.1-android'
Expand Down
8 changes: 4 additions & 4 deletions example/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ source 'https://rubygems.org'
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby ">= 2.6.10"

# Cocoapods 1.15 introduced a bug which break the build. The upper
# bound in can be removed with next React Native release >0.74.1.
gem 'cocoapods', '>= 1.13', '< 1.15'
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
gem 'xcodeproj', '< 1.26.0'
2 changes: 1 addition & 1 deletion example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ First, make sure you go through the setup from the main [README](../README.md).

1. Using your preferred terminal, go to example/ios folder and run the command below.

`pod install` or `yarn prepare`
`RCT_NEW_ARCH_ENABLED=0 pod install`

2. Copy the `Keys.plist.sample` file located in `example/ios/SampleApp/` to a new file named `Keys.plist`. This file is git ignored and won't be accidentally committed. In your Google cloud console, add the Google API key to the project and add this newly created API key to the `Keys.plist` file.

Expand Down
36 changes: 25 additions & 11 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ apply plugin: 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
*/
react {
/* Folders */
// The root of your project, i.e. where "package.json" lives. Default is '..'
// root = file("../")
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
// reactNativeDir = file("../node_modules/react-native")
// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
// codegenDir = file("../node_modules/@react-native/codegen")
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
// cliFile = file("../node_modules/react-native/cli.js")
// The root of your project, i.e. where "package.json" lives. Default is '../..'
// root = file("../../")
// The folder where the react-native NPM package is. Default is ../../node_modules/react-native
// reactNativeDir = file("../../node_modules/react-native")
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
// codegenDir = file("../../node_modules/@react-native/codegen")
// The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
// cliFile = file("../../node_modules/react-native/cli.js")

/* Variants */
// The list of variants to that are debuggable. For those we're going to
Expand Down Expand Up @@ -63,6 +63,12 @@ react {
//
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
// hermesFlags = ["-O", "-output-source-map"]

/* This example app uses typescript index file, so we need to specify the entry file */
entryFile = file("index.ts")

/* Autolinking */
autolinkLibrariesWithApp()
}

/**
Expand Down Expand Up @@ -116,6 +122,11 @@ android {
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
}

dependencies {
Expand All @@ -128,10 +139,15 @@ dependencies {
implementation jscFlavor
}

// For Android Auto Sample support
// Include packages for the Android Auto support.
implementation "androidx.car.app:app:1.4.0"
implementation "androidx.car.app:app-projected:1.4.0"

// Include the Google Navigation SDK.
implementation 'com.google.android.libraries.navigation:navigation:6.0.0'

// Desugar Java 8+ APIs
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs_nio:2.0.4'
}

secrets {
Expand All @@ -149,5 +165,3 @@ secrets {
// Ignore all keys matching the regexp "sdk.*"
ignoreList.add("sdk.*")
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
2 changes: 1 addition & 1 deletion example/android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<application
android:usesCleartextTraffic="true"
tools:targetApi="28"
tools:targetApi="34"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" />
</application>
Expand Down
3 changes: 2 additions & 1 deletion example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
android:supportsRtl="true">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@
package com.sampleapp;

import android.app.Application;
import androidx.annotation.NonNull;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
import com.facebook.react.defaults.DefaultReactNativeHost;
import com.facebook.react.soloader.OpenSourceMergedSoMapping;
import com.facebook.soloader.SoLoader;
import java.io.IOException;
import java.util.List;

public class MainApplication extends Application implements ReactApplication {
Expand Down Expand Up @@ -60,6 +63,7 @@ protected Boolean isHermesEnabled() {
}
};

@NonNull
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
Expand All @@ -68,7 +72,11 @@ public ReactNativeHost getReactNativeHost() {
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
try {
SoLoader.init(this, OpenSourceMergedSoMapping.INSTANCE);
} catch (IOException e) {
throw new RuntimeException(e);
}
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
DefaultNewArchitectureEntryPoint.load();
Expand Down
8 changes: 4 additions & 4 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

buildscript {
ext {
buildToolsVersion = "34.0.0"
minSdkVersion = 23
compileSdkVersion = 34
buildToolsVersion = "35.0.0"
minSdkVersion = 24
compileSdkVersion = 35
targetSdkVersion = 34
ndkVersion = "26.1.10909125"
}
Expand All @@ -25,7 +25,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath('com.android.tools.build:gradle:8.4.0')
classpath('com.android.tools.build:gradle:8.6.1')
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.1")
}
Expand Down
7 changes: 6 additions & 1 deletion example/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
org.gradle.jvmargs=-Xmx2g -XX\:MaxHeapSize\=4g -XX:MaxMetaspaceSize=1g
org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g

# CI heap issue fixes
org.gradle.parallel=true
org.gradle.daemon=true

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
Expand All @@ -21,6 +25,7 @@ org.gradle.jvmargs=-Xmx2g -XX\:MaxHeapSize\=4g -XX:MaxMetaspaceSize=1g
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true

# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

Expand Down
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
9 changes: 6 additions & 3 deletions example/android/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,8 +57,8 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions example/android/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
4 changes: 3 additions & 1 deletion example/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
plugins { id("com.facebook.react.settings") }
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
rootProject.name = 'SampleApp'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')
5 changes: 4 additions & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Disable new arch as it is not supported by the current version of package
ENV['RCT_NEW_ARCH_ENABLED'] = '0'

def node_require(script)
# Resolve script with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
Expand All @@ -10,7 +13,7 @@ end
node_require('react-native/scripts/react_native_pods.rb')
node_require('react-native-permissions/scripts/setup.rb')

platform :ios, "15.0"
platform :ios, "15.1"
prepare_react_native_project!

setup_permissions([
Expand Down
5 changes: 3 additions & 2 deletions example/ios/SampleApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
29F89EA4FF546EABE968E1D2 /* libPods-SampleApp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 354226CC8A58229ECC025410 /* libPods-SampleApp.a */; };
2A20E8122C8994DB00DB7ADA /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
2A20E8142C8994DB00DB7ADA /* (null) in Frameworks */ = {isa = PBXBuildFile; };
2A20E8142C8994DB00DB7ADA /* BuildFile in Frameworks */ = {isa = PBXBuildFile; };
2A20E8282C899A1400DB7ADA /* Info-CarPlay.plist in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB61A68108700A75B9A /* Info-CarPlay.plist */; };
2AB8C27A2C89A07000250560 /* Keys.plist in Resources */ = {isa = PBXBuildFile; fileRef = 52D4271C2C81D3F300C7FB36 /* Keys.plist */; };
2AB8C27E2C89A0B400250560 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
Expand Down Expand Up @@ -96,7 +96,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
2A20E8142C8994DB00DB7ADA /* (null) in Frameworks */,
2A20E8142C8994DB00DB7ADA /* BuildFile in Frameworks */,
29F89EA4FF546EABE968E1D2 /* libPods-SampleApp.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -898,6 +898,7 @@
OTHER_LDFLAGS = "$(inherited)";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
USE_HERMES = true;
};
name = Debug;
Expand Down
8 changes: 3 additions & 5 deletions example/ios/SampleApp/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@
</dict>
</dict>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>[Enter any description related to the key]</string>
<string>[Add your description here]</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>[Add your description here]</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>[Add your description here]</string>
<key>UIBackgroundModes</key>
<array>
<string>location</string>
Expand All @@ -60,9 +62,5 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>[NSLocationAlwaysUsageDescription]</key>
<string>Enter any description related to the key</string>
<key>[NSLocationWhenInUseUsageDescription]</key>
<string>Enter any description related to the key</string>
</dict>
</plist>
10 changes: 5 additions & 5 deletions example/ios/SampleApp/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>C617.1</string>
<string>CA92.1</string>
<string>1C8F.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
<string>1C8F.1</string>
<string>C617.1</string>
</array>
</dict>
<dict>
Expand Down
Loading

0 comments on commit 3218cb1

Please sign in to comment.