Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Native Example - react native update fix #978

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion examples/example-react-native-app/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ source 'https://rubygems.org'
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby '2.7.5'

gem 'cocoapods', '~> 1.11', '>= 1.11.2'
# Cocoapods 1.15 introduced a bug which break the build. We will remove the upper
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😢

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah not that the iOS stuff here matters but oh well

# bound in the template on Cocoapods with next React Native release.
gem 'cocoapods', '>= 1.13', '< 1.15'
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
8 changes: 2 additions & 6 deletions examples/example-react-native-app/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"

/**
Expand Down Expand Up @@ -71,6 +72,7 @@ def jscFlavor = 'org.webkit:android-jsc:+'
android {
ndkVersion rootProject.ext.ndkVersion

buildToolsVersion rootProject.ext.buildToolsVersion
compileSdkVersion rootProject.ext.compileSdkVersion

namespace "com.exampleapp"
Expand Down Expand Up @@ -107,12 +109,6 @@ dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.squareup.okhttp3', module:'okhttp'
}

debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@
<application
android:usesCleartextTraffic="true"
tools:targetApi="28"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" />
</application>
tools:ignore="GoogleAppIndexingWarning"/>
</manifest>

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.exampleapp

import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate

class MainActivity : ReactActivity() {

/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
override fun getMainComponentName(): String = "ExampleApp"

/**
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
*/
override fun createReactActivityDelegate(): ReactActivityDelegate =
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.exampleapp

import android.app.Application
import com.facebook.react.PackageList
import com.facebook.react.ReactApplication
import com.facebook.react.ReactHost
import com.facebook.react.ReactNativeHost
import com.facebook.react.ReactPackage
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.soloader.SoLoader

class MainApplication : Application(), ReactApplication {

override val reactNativeHost: ReactNativeHost =
object : DefaultReactNativeHost(this) {
override fun getPackages(): List<ReactPackage> =
PackageList(this).packages.apply {
// Packages that cannot be autolinked yet can be added manually here, for example:
// add(MyReactNativePackage())
}

override fun getJSMainModuleName(): String = "index"

override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG

override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
}

override val reactHost: ReactHost
get() = getDefaultReactHost(applicationContext, reactNativeHost)

override fun onCreate() {
super.onCreate()
SoLoader.init(this, false)
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
load()
}
}
}
39 changes: 7 additions & 32 deletions examples/example-react-native-app/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

buildscript {
ext {
buildToolsVersion = "33.0.0"
buildToolsVersion = "34.0.0"
minSdkVersion = 23
compileSdkVersion = 33
targetSdkVersion = 33

// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
ndkVersion = "23.1.7779620"
compileSdkVersion = 34
targetSdkVersion = 34
ndkVersion = "26.1.10909125"
kotlinVersion = "1.9.22"
}
repositories {
google()
Expand All @@ -17,32 +16,8 @@ buildscript {
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
}
}
// classpath("de.undercouch:gradle-download-task:5.4.0")
// // NOTE: Do not place your application dependencies here; they belong
// // in the individual module build.gradle files
// }
// }

// allprojects {
// repositories {
// maven {
// // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
// url("$rootDir/../node_modules/react-native/android")
// }
// maven {
// // Android JSC is installed from npm
// url("$rootDir/../node_modules/jsc-android/dist")
// }
// mavenCentral {
// // We don't want to fetch react-native from Maven Central as there are
// // older versions over there.
// content {
// excludeGroup "com.facebook.react"
// }
// }
// google()
// maven { url 'https://www.jitpack.io' }
// }
// }
apply plugin: "com.facebook.react.rootproject"
2 changes: 1 addition & 1 deletion examples/example-react-native-app/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
presets: [
[
'module:metro-react-native-babel-preset',
'module:@react-native/babel-preset',
{
unstable_transformProfile: 'hermes-stable',
},
Expand Down
2 changes: 1 addition & 1 deletion examples/example-react-native-app/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');

/**
* Metro configuration
* https://facebook.github.io/metro/docs/configuration
* https://reactnative.dev/docs/metro
*
* @type {import('metro-config').MetroConfig}
*/
Expand Down
2 changes: 1 addition & 1 deletion examples/example-react-native-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// prettier-ignore
{
"extends": "@tsconfig/react-native/tsconfig.json", /* Recommended React Native TSConfig base */
"extends": "@react-native/typescript-config/tsconfig.json", /* Recommended React Native TSConfig base */
"compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */

Expand Down
4 changes: 2 additions & 2 deletions examples/example-react-native-app/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2204,11 +2204,11 @@
"@solana-mobile/mobile-wallet-adapter-protocol-web3js@file:../../js/packages/mobile-wallet-adapter-protocol-web3js":
version "2.1.3"
dependencies:
"@solana-mobile/mobile-wallet-adapter-protocol" "^2.1.2"
"@solana-mobile/mobile-wallet-adapter-protocol" "^2.1.3"
bs58 "^5.0.0"
js-base64 "^3.7.5"

"@solana-mobile/mobile-wallet-adapter-protocol@^2.1.2", "@solana-mobile/mobile-wallet-adapter-protocol@file:../../js/packages/mobile-wallet-adapter-protocol":
"@solana-mobile/mobile-wallet-adapter-protocol@^2.1.3", "@solana-mobile/mobile-wallet-adapter-protocol@file:../../js/packages/mobile-wallet-adapter-protocol":
version "2.1.3"
dependencies:
"@solana/wallet-standard" "^1.1.2"
Expand Down