Skip to content

Commit

Permalink
Upgraded to React Native 0.76.1
Browse files Browse the repository at this point in the history
  • Loading branch information
roncodes committed Nov 11, 2024
1 parent 358883e commit 01d09aa
Show file tree
Hide file tree
Showing 29 changed files with 2,396 additions and 34,609 deletions.
14 changes: 13 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ DerivedData
*.hmap
*.ipa
*.xcuserstate
**/.xcode.env.local

# Android/IntelliJ
#
Expand All @@ -46,6 +47,17 @@ buck-out/
*.keystore
!debug.keystore

# testing
/coverage

# Yarn
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
Expand All @@ -61,7 +73,7 @@ buck-out/
*.jsbundle

# CocoaPods
/ios/Pods/
**/Pods/

# react-native-config codegen
ios/tmp.xcconfig
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "automatic"
}
3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

# yarnPath: .yarn/releases/yarn-3.6.4.cjs
6 changes: 3 additions & 3 deletions App.js → App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const linking = {
},
};

const App: () => Node = () => {
function App (): React.JSX.Element {
LogBox.ignoreLogs(['RCTUIManager.measureLayoutRelativeToParent']);

return (
Expand All @@ -44,11 +44,11 @@ const App: () => Node = () => {
</View>
}>
<Stack.Navigator>
<Stack.Screen name="CoreStack" component={CoreStack} options={{ headerShown: false, animationEnabled: false, gestureEnabled: false }} />
<Stack.Screen name='CoreStack' component={CoreStack} options={{ headerShown: false, animationEnabled: false, gestureEnabled: false }} />
</Stack.Navigator>
</NavigationContainer>
</SafeAreaProvider>
);
};
}

export default App;
7 changes: 5 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
source 'https://rubygems.org'

# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby '>= 2.6.10'
ruby ">= 2.6.10"

gem 'cocoapods', '>= 1.11.2'
# 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'
4 changes: 3 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ PLATFORMS
ruby

DEPENDENCIES
cocoapods (>= 1.11.2)
activesupport (>= 6.1.7.5, != 7.1.0)
cocoapods (>= 1.13, != 1.15.1, != 1.15.0)
xcodeproj (< 1.26.0)

RUBY VERSION
ruby 2.6.10p210
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ Run the commands below; first clone the project, use npm or yarn to install the
git clone [email protected]:fleetbase/storefront-app.git
cd storefront-app
yarn
npx pod-install
bundle install
cd ios
bundle exec pod install
touch .env
```

Expand Down
19 changes: 7 additions & 12 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ react {
//
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
// hermesFlags = ["-O", "-output-source-map"]

/* Autolinking */
autolinkLibrariesWithApp()
}

project.ext.react = [
Expand Down Expand Up @@ -92,7 +95,9 @@ def isNewArchitectureEnabled() {
android {
ndkVersion rootProject.ext.ndkVersion

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

namespace "com.storefrontapp"

defaultConfig {
Expand Down Expand Up @@ -149,21 +154,11 @@ dependencies {
implementation project(':react-native-config')
implementation "androidx.core:core-splashscreen:1.0.0-alpha02"

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

debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}
if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")
} else {
implementation jscFlavor
}
}

apply plugin: 'com.google.gms.google-services'
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle") ; applyNativeModulesAppBuildGradle(project)
apply plugin: 'com.google.gms.google-services'
8 changes: 2 additions & 6 deletions android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />

<application
android:usesCleartextTraffic="true"
tools:targetApi="28"
tools:ignore="GoogleAppIndexingWarning"
android:appComponentFactory="whateverString"
tools:replace="android:appComponentFactory">
<activity
android:name="com.facebook.react.devsupport.DevSettingsActivity"
android:exported="false" />
tools:replace="android:appComponentFactory"
tools:ignore="GoogleAppIndexingWarning" />
</application>
</manifest>
17 changes: 12 additions & 5 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,18 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage" />

<application android:name=".MainApplication" android:label="@string/app_name"
android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@style/AppTheme" android:networkSecurityConfig="@xml/network_security_config"
android:dataExtractionRules="@xml/data_extraction_rules" android:fullBackupContent="true"
tools:targetApi="s">
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:theme="@style/AppTheme"
android:networkSecurityConfig="@xml/network_security_config"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="true"
tools:targetApi="s"
android:supportsRtl="true"
>
<!-- Change the value to true to enable pop-up for in foreground on receiving remote
notifications (for prevent duplicating while showing local notifications set this to false) -->
<meta-data android:name="com.dieam.reactnativepushnotification.notification_foreground"
Expand Down
29 changes: 0 additions & 29 deletions android/app/src/main/java/com/storefrontapp/MainActivity.java

This file was deleted.

29 changes: 29 additions & 0 deletions android/app/src/main/java/com/storefrontapp/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.storefrontapp

import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate
import android.os.Bundle
import com.zoontek.rnbootsplash.RNBootSplash

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 = "StorefrontApp"

/**
* 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)

override fun onCreate(savedInstanceState: Bundle?) {
RNBootSplash.init(this, R.style.BootTheme) // ⬅️ initialize the splash screen
super.onCreate(savedInstanceState) // super.onCreate(null) with react-native-screens
}
}
93 changes: 0 additions & 93 deletions android/app/src/main/java/com/storefrontapp/MainApplication.java

This file was deleted.

44 changes: 44 additions & 0 deletions android/app/src/main/java/com/storefrontapp/MainApplication.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.storefrontapp

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.react.soloader.OpenSourceMergedSoMapping
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, OpenSourceMergedSoMapping)
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
load()
}
}
}
Loading

0 comments on commit 01d09aa

Please sign in to comment.