Skip to content

Commit 0cbdfa7

Browse files
committed
Upgrade react-native from 77.0 to 79.1
- Package and file updates - Perform changes recommended by the Upgrade Helper - https://react-native-community.github.io/upgrade-helper/?from=0.77.0&to=0.79.1&package=app.getorganize.organize&name=Organize - Ignore binary changes to gradle-wrapper.jar - Update @rnx-kit/align-deps and rnx-kit-overrides - Manually update react-native patch that couldn't be applied due to merge conflicts, since my PR was included in 79.1. Now only the transform fix remains - facebook/react-native@e3d607f - 1f6b314 - iOS - Running `cd ios && pod install` is now deprecated. `npm run ios` should run it under-the-hood if needed - Update react-native-safe-area-context from 5.1.0 to 5.4.0 to fix a build error - Update react-native-reanimated from 3.16.7 to 3.17.4 to fix a build error - `npm run ios:device:release` works again! - Thanks to a fix in react-native-community/cli@17 - It had been broken since the RN upgrade from 0.73.6 to 0.75.3 - Android - Upgraded Android Studio from Ladybug to Meerkat to meet the new Android Gradle Plugin 8.8.2 version requirement - Updated react-native-pager-view from 6.7.0 to 6.7.1 to fix a build issue - Added a dependency on react-native-edge-to-edge to fix an issue where the nav bar header was twice as tall as it should be on s10 physical device - react-native-community/discussions-and-proposals#827 - https://github.com/zoontek/react-native-edge-to-edge - Update Android AppTheme to be Theme.EdgeToEdge - Replaced RN StatusBar with edge-to-edge SystemBars - Testing - Manual smoke test succeeded on i13m, s10, SE simulator, and Android small phone emulator - Fixed a few ref type issues by adding null or undefined as explicit initial values and types - Inspired by software-mansion/react-native-reanimated@ca7d531 - Fixed two linting deprecation issues by completely removing react-test-renderer and replacing functionality with @testing-library/react-native - https://react.dev/warnings/react-test-renderer - https://callstack.github.io/react-native-testing-library/docs/advanced/understanding-act#solution-with-real-timers - `npm t` succeeded
1 parent 2d8d08b commit 0cbdfa7

24 files changed

+10327
-11950
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ local.properties
3333
.cxx/
3434
*.keystore
3535
!debug.keystore
36+
.kotlin/
3637

3738
# node.js
3839
#

Gemfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@ gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
88
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
99
gem 'xcodeproj', '< 1.26.0'
1010
gem 'concurrent-ruby', '< 1.3.4'
11+
12+
# Ruby 3.4.0 has removed some libraries from the standard library.
13+
gem 'bigdecimal'
14+
gem 'logger'
15+
gem 'benchmark'
16+
gem 'mutex_m'

Gemfile.lock

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ GEM
1818
json (>= 1.5.1)
1919
atomos (0.1.3)
2020
base64 (0.2.0)
21+
benchmark (0.4.0)
22+
bigdecimal (3.1.9)
2123
claide (1.1.0)
2224
cocoapods (1.15.2)
2325
addressable (~> 2.8)
@@ -69,8 +71,10 @@ GEM
6971
i18n (1.14.7)
7072
concurrent-ruby (~> 1.0)
7173
json (2.7.6)
74+
logger (1.7.0)
7275
minitest (5.25.4)
7376
molinillo (0.8.0)
77+
mutex_m (0.3.0)
7478
nanaimo (0.3.0)
7579
nap (1.1.0)
7680
netrc (0.11.0)
@@ -96,8 +100,12 @@ PLATFORMS
96100

97101
DEPENDENCIES
98102
activesupport (>= 6.1.7.5, != 7.1.0)
103+
benchmark
104+
bigdecimal
99105
cocoapods (>= 1.13, != 1.15.1, != 1.15.0)
100106
concurrent-ruby (< 1.3.4)
107+
logger
108+
mutex_m
101109
xcodeproj (< 1.26.0)
102110

103111
RUBY VERSION

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ npm test
6565
To run just one part of these checks, use `npm run <command>` with one of the scripts in [`package.json`](/package.json).
6666

6767
### Unit testing
68-
[Jest](https://jestjs.io/) is used as the unit testing framework. [`react-test-renderer`](https://legacy.reactjs.org/docs/test-renderer.html) is used for unit testing components.
68+
[Jest](https://jestjs.io/) is used as the unit testing framework. [`@testing-library/react-native`](https://callstack.github.io/react-native-testing-library/) is used for unit testing components.
6969

7070
You can run a subset of the unit tests with `npx jest path/to/directory/or/file`. For example:
7171
```sh

__tests__/App.test.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import React from 'react';
2-
import ReactTestRenderer from 'react-test-renderer';
2+
import { render, screen, waitFor } from '@testing-library/react-native';
33
import App from '../app/App';
44

55
test('renders correctly', async () => {
6-
await ReactTestRenderer.act(() => {
7-
ReactTestRenderer.create(<App />);
8-
});
6+
render(<App />);
7+
await waitFor(() => screen);
98
});

android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ def enableProguardInReleaseBuilds = false
6161
* The preferred build flavor of JavaScriptCore (JSC)
6262
*
6363
* For example, to use the international variant, you can use:
64-
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
64+
* `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+`
6565
*
6666
* The international variant includes ICU i18n library and necessary data
6767
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
6868
* give correct results when using with locales other than en-US. Note that
6969
* this variant is about 6MiB larger per architecture than default.
7070
*/
71-
def jscFlavor = 'org.webkit:android-jsc:+'
71+
def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
7272

7373
android {
7474
ndkVersion rootProject.ext.ndkVersion

android/app/src/main/res/values/styles.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<resources>
22

33
<!-- Base application theme. -->
4-
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
4+
<style name="AppTheme" parent="Theme.EdgeToEdge">
55
<!-- Customize your theme here. -->
66
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
77
<item name="android:windowBackground">@drawable/window_background</item>

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ buildscript {
33
buildToolsVersion = "35.0.0"
44
minSdkVersion = 24
55
compileSdkVersion = 35
6-
targetSdkVersion = 34
6+
targetSdkVersion = 35
77
ndkVersion = "27.1.12297006"
88
kotlinVersion = "2.0.21"
99
}

android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

android/gradlew

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ done
8686
# shellcheck disable=SC2034
8787
APP_BASE_NAME=${0##*/}
8888
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89-
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
90-
' "$PWD" ) || exit
89+
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
9190

9291
# Use the maximum available, or set MAX_FD != -1 to use that value.
9392
MAX_FD=maximum
@@ -206,7 +205,7 @@ fi
206205
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
207206

208207
# Collect all arguments for the java command:
209-
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
208+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
210209
# and any embedded shellness will be escaped.
211210
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
212211
# treated as '${Hostname}' itself on the command line.

app/components/controls/handlers/OrgGraphClickHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ type ClickHandlerProps = {
5555

5656
export default function useOrgGraphClickHandler(
5757
isGraphAvailable: boolean,
58-
visNetwork: RefObject<VisNetworkRef>,
58+
visNetwork: RefObject<VisNetworkRef | null>,
5959
hasMultipleNodes: boolean,
6060
setSelectedUserId: Dispatch<SetStateAction<string | undefined>>,
6161
) {

app/components/controls/lists/CommentList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function useInsertedComments(
9191
}
9292

9393
function useScrollToOffsetOnNewTopLevelComment(
94-
listRef: RefObject<FlatList<Comment>>,
94+
listRef: RefObject<FlatList<Comment> | null>,
9595
maybeInsertedCommentIds?: InsertedComment[],
9696
) {
9797
const [offset, setOffset] = useState(0);

app/components/views/OrgGraphProgressBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import ProgressBar from './ProgressBar';
44

55
export default function useOrgGraphProgressBar(
66
isGraphAvailable: boolean,
7-
visNetwork: RefObject<VisNetworkRef>,
7+
visNetwork: RefObject<VisNetworkRef | null>,
88
) {
99
const [progress, setProgress] = useState(0);
1010

app/components/views/StatusBar.tsx

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,11 @@
11
import React, { PropsWithChildren } from 'react';
2-
import { ColorValue, StatusBar as RNStatusBar } from 'react-native';
3-
import useTheme from '../../Theme';
4-
5-
type Props = {
6-
backgroundColor?: ColorValue;
7-
};
8-
9-
export default function StatusBar({
10-
backgroundColor: maybeBackgroundColor, children,
11-
}: PropsWithChildren<Props>) {
12-
const { colors, isDarkMode } = useTheme();
13-
14-
// backgroundColor only affects Android
15-
const backgroundColor = maybeBackgroundColor ?? colors.fill;
16-
17-
const barStyle = isDarkMode ? 'light-content' : 'dark-content';
2+
import { SystemBars } from 'react-native-edge-to-edge';
183

4+
export default function StatusBar({ children }: PropsWithChildren<{}>) {
195
return (
206
<>
21-
<RNStatusBar backgroundColor={backgroundColor} barStyle={barStyle} />
7+
{/* eslint-disable-next-line react/style-prop-object */}
8+
<SystemBars />
229
{children}
2310
</>
2411
);

app/model/PreviousValue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useEffect, useRef } from 'react';
22

33
// https://stackoverflow.com/a/57706747/2421313
44
export default function usePreviousValue<T>(value: T): T | undefined {
5-
const ref = useRef<T>();
5+
const ref = useRef<T>(undefined);
66
useEffect(() => {
77
ref.current = value;
88
});

app/model/ReplaceableFile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default function useReplaceableFile({
1313
}: Props) {
1414
const [fileName, setFileName] = useState<string>();
1515
const [ready, setReady] = useState(false);
16-
const replacementFileNameRef = useRef<string>();
16+
const replacementFileNameRef = useRef<string>(undefined);
1717

1818
const parentFolder = `${Dirs.DocumentDir}/${parentFolderName}`;
1919
const fullPath = (name: string) => `${parentFolder}/${name}`;

app/navigation/WelcomeStack.tsx

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
VerificationScreen,
66
} from '../screens';
77
import type { WelcomeStackParamList } from './types';
8-
import { SafeAreaPadding, StatusBar } from '../components';
8+
import { SafeAreaPadding } from '../components';
99
import useDefaultStackNavigatorOptions from './DefaultStackNavigatorOptions';
1010
import useTheme from '../Theme';
1111
import { useCurrentUser } from '../model';
@@ -26,34 +26,32 @@ export default function WelcomeStack() {
2626
const initialRouteName = inVerification ? 'Verification' : 'Welcome';
2727

2828
return (
29-
<StatusBar backgroundColor={colors.background}>
30-
<SafeAreaPadding>
31-
<Stack.Navigator
32-
initialRouteName={initialRouteName}
33-
screenOptions={screenOptions}
34-
>
35-
<Stack.Screen
36-
name="Welcome"
37-
component={WelcomeScreen}
38-
options={{ animation: 'none' }}
39-
/>
40-
<Stack.Screen
41-
name="NewOrg"
42-
component={NewOrgScreen}
43-
getId={({ params }) => String(params.step)}
44-
options={{ navigationBarColor: colors.fill }}
45-
/>
46-
<Stack.Screen name="OrgReview" component={OrgReview} />
47-
<Stack.Screen
48-
name="JoinOrg"
49-
component={JoinOrgScreen}
50-
/>
51-
<Stack.Screen
52-
name="Verification"
53-
component={VerificationScreen}
54-
/>
55-
</Stack.Navigator>
56-
</SafeAreaPadding>
57-
</StatusBar>
29+
<SafeAreaPadding>
30+
<Stack.Navigator
31+
initialRouteName={initialRouteName}
32+
screenOptions={screenOptions}
33+
>
34+
<Stack.Screen
35+
name="Welcome"
36+
component={WelcomeScreen}
37+
options={{ animation: 'none' }}
38+
/>
39+
<Stack.Screen
40+
name="NewOrg"
41+
component={NewOrgScreen}
42+
getId={({ params }) => String(params.step)}
43+
options={{ navigationBarColor: colors.fill }}
44+
/>
45+
<Stack.Screen name="OrgReview" component={OrgReview} />
46+
<Stack.Screen
47+
name="JoinOrg"
48+
component={JoinOrgScreen}
49+
/>
50+
<Stack.Screen
51+
name="Verification"
52+
component={VerificationScreen}
53+
/>
54+
</Stack.Navigator>
55+
</SafeAreaPadding>
5856
);
5957
}

ios/AppDelegate.swift

Lines changed: 42 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,55 @@ import React_RCTAppDelegate
44
import ReactAppDependencyProvider
55

66
@main
7-
class AppDelegate: RCTAppDelegate {
8-
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
9-
self.moduleName = "Organize"
10-
self.dependencyProvider = RCTAppDependencyProvider()
11-
12-
// You can add your custom initial props in the dictionary below.
13-
// They will be passed down to the ViewController used by React Native.
14-
self.initialProps = [:]
7+
class AppDelegate: UIResponder, UIApplicationDelegate {
8+
var window: UIWindow?
9+
10+
var reactNativeDelegate: ReactNativeDelegate?
11+
var reactNativeFactory: RCTReactNativeFactory?
12+
13+
func application(
14+
_ application: UIApplication,
15+
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
16+
) -> Bool {
17+
let delegate = ReactNativeDelegate()
18+
let factory = RCTReactNativeFactory(delegate: delegate)
19+
delegate.dependencyProvider = RCTAppDependencyProvider()
20+
21+
reactNativeDelegate = delegate
22+
reactNativeFactory = factory
23+
24+
window = UIWindow(frame: UIScreen.main.bounds)
25+
26+
factory.startReactNative(
27+
withModuleName: "Organize",
28+
in: window,
29+
launchOptions: launchOptions
30+
)
1531

1632
let primaryColor = UIColor(named: "Primary")
1733
UIView.appearance(whenContainedInInstancesOf: [UIAlertController.self]).tintColor = primaryColor
1834
UIBarButtonItem.appearance().tintColor = primaryColor
35+
36+
return true
37+
}
1938

20-
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
39+
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
40+
return RCTLinkingManager.application(app, open: url, options: options)
2141
}
2242

43+
func application(
44+
_ application: UIApplication,
45+
continue userActivity: NSUserActivity,
46+
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
47+
return RCTLinkingManager.application(
48+
application,
49+
continue: userActivity,
50+
restorationHandler: restorationHandler
51+
)
52+
}
53+
}
54+
55+
class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {
2356
override func sourceURL(for bridge: RCTBridge) -> URL? {
2457
self.bundleURL()
2558
}
@@ -31,12 +64,4 @@ class AppDelegate: RCTAppDelegate {
3164
Bundle.main.url(forResource: "main", withExtension: "jsbundle")
3265
#endif
3366
}
34-
35-
override func application(_ application: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
36-
return RCTLinkingManager.application(application, open: url, options: options)
37-
}
38-
39-
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
40-
return RCTLinkingManager.application(application, continue: userActivity, restorationHandler: restorationHandler)
41-
}
4267
}

0 commit comments

Comments
 (0)