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

build: Upgrade to React Native 0.73 #58475

Merged
merged 49 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
52a4f1b
build: Capture result of @rnx-kit/align-deps
dcalhoun Jan 30, 2024
7d68904
build: Revert incompatible @rnx-kit/align-deps changes
dcalhoun Jan 30, 2024
619ed35
build: Replace Metro packages with @react-native namespace equivalents
dcalhoun Jan 30, 2024
b7429a9
build: Capture package lock file changes
dcalhoun Jan 30, 2024
5c867d3
build: Recreate react-native patch file
dcalhoun Jan 31, 2024
b17be33
build: Correct lock file changes
dcalhoun Jan 31, 2024
3b8a46b
build: Replace overlooked deprecated Metro packages names
dcalhoun Jan 31, 2024
a15f5c0
build: Recreate react-devtools-core patch
dcalhoun Jan 31, 2024
df5ff72
build: Expand react-devtools-core patch to cover all window references
dcalhoun Jan 31, 2024
69835ba
build: Migrate to @react-native/metro-config
dcalhoun Jan 31, 2024
86db7ed
fix: Disable the optional Demo editor setup configuration
dcalhoun Jan 31, 2024
43260aa
Update Sass transformer to include workaround when being loaded from …
geriux Feb 8, 2024
02eea0a
Fix Reanimated test mock
geriux Feb 8, 2024
415a5bf
Add experimental debugger flag
geriux Feb 8, 2024
8dc511c
Update Reanimated
geriux Feb 8, 2024
ca80b14
build: Update Gemfile for React Native 0.73
dcalhoun Jan 31, 2024
5ab28a6
build: Bump minimum iOS version to 13.4
dcalhoun Jan 31, 2024
7d2a6da
build: Update Podfile for React Native 0.73
dcalhoun Jan 31, 2024
4ba59e0
build: Upgrade to react-native-reanimated 3.6.2
dcalhoun Jan 31, 2024
532436d
build: Update Info.plist NSAppTransportSecurity
dcalhoun Jan 31, 2024
719843c
Merge branch 'trunk' of github.com:WordPress/gutenberg into build/upg…
dcalhoun Feb 9, 2024
b5ef902
build: Align dependencies with react-native-libraries-publisher
dcalhoun Feb 12, 2024
aa4de3e
build: Capture latest Pod changes
dcalhoun Feb 12, 2024
9a48ef3
Remove @react-native/gradle-plugin since it's included in the React N…
geriux Feb 1, 2024
110d664
Migrate java files to kotlin
geriux Feb 1, 2024
b7bd112
Update build and gradle files
geriux Feb 1, 2024
6e40175
Remove Flipper java file
geriux Feb 1, 2024
16104a9
Update debug AndroidManifest
geriux Feb 1, 2024
9d578ca
Update react-native-config.js to include all packages that we are man…
geriux Feb 1, 2024
857f84b
Update package-lock.json
geriux Feb 12, 2024
9b5acd0
Updates react-native.config to remove disabling iOS auto-linking
geriux Feb 13, 2024
59ae088
Updates the comment explaning why auto-linking is disabled for Androi…
geriux Feb 13, 2024
08228eb
Merge branch 'trunk' of github.com:WordPress/gutenberg into build/upg…
dcalhoun Feb 15, 2024
63aa04a
build: Configure GitHub Action ruby version
dcalhoun Feb 15, 2024
e3286fc
test: Update Reanimated warning during tests
dcalhoun Feb 12, 2024
a19c645
test: Fix failing Gallery edit test
dcalhoun Feb 12, 2024
1cd5ce5
build: Upgrade to @testing-library/[email protected]
dcalhoun Feb 13, 2024
fafb678
test: Avoid duplicate call to mock internal `TextInputState` module
dcalhoun Feb 13, 2024
3b240f1
test: Update LinkUI snapshot
dcalhoun Feb 13, 2024
9cb5c6b
fix: Allow animation start during mount
dcalhoun Feb 14, 2024
f2bacea
test: Leverage fake timers for Draggable animation tests
dcalhoun Feb 14, 2024
9857dc3
test: Await missing block render from running timers
dcalhoun Feb 14, 2024
2b4970a
test: Update timer mocks for Reanimated 3.x
dcalhoun Feb 14, 2024
89de8ac
test: Refactor advanceAnimationByFrames utility
dcalhoun Feb 15, 2024
1ac08b2
test: Fix failing fake timer detection
dcalhoun Feb 15, 2024
4779755
Revert upgrading to AGP 8.1.0 until the main Android host app upgrade…
geriux Feb 16, 2024
d4dfaa8
ci: Restrict `ruby/setup-ruby` CI action to specific commit hash
dcalhoun Feb 16, 2024
2a09562
Merge branch 'trunk' into build/upgrade-to-react-native-0.73
geriux Mar 5, 2024
afb3d1d
Update Changelog
geriux Mar 5, 2024
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: 5 additions & 0 deletions .github/workflows/rnmobile-ios-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ jobs:
with:
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}

- uses: ruby/setup-ruby@22fdc77bf4148f810455b226c90fb81b5cbc00a7
with:
# `.ruby-version` file location
working-directory: packages/react-native-editor/ios

- name: Switch Xcode version to ${{ matrix.xcode }}
run: sudo xcode-select --switch /Applications/Xcode_${{ matrix.xcode }}.app

Expand Down
8,236 changes: 4,618 additions & 3,618 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@
"@octokit/webhooks-types": "5.6.0",
"@playwright/test": "1.39.0",
"@pmmmwh/react-refresh-webpack-plugin": "0.5.11",
"@react-native/babel-preset": "0.73.10",
"@react-native/metro-babel-transformer": "0.73.10",
"@react-native/metro-config": "0.73.4",
"@storybook/addon-a11y": "7.6.15",
"@storybook/addon-actions": "7.6.15",
"@storybook/addon-controls": "7.6.15",
Expand All @@ -125,7 +128,7 @@
"@storybook/theming": "7.6.15",
"@testing-library/jest-dom": "5.16.5",
"@testing-library/react": "14.0.0",
"@testing-library/react-native": "12.1.2",
"@testing-library/react-native": "12.4.3",
"@testing-library/user-event": "14.4.3",
"@types/eslint": "7.28.0",
"@types/estree": "0.0.50",
Expand Down Expand Up @@ -216,8 +219,6 @@
"lerna": "7.1.4",
"lint-staged": "10.0.1",
"make-dir": "3.0.0",
"metro-react-native-babel-preset": "0.73.10",
"metro-react-native-babel-transformer": "0.73.10",
"mkdirp": "3.0.1",
"mock-match-media": "0.4.2",
"moment-timezone-data-webpack-plugin": "1.5.1",
Expand All @@ -232,7 +233,7 @@
"progress": "2.0.3",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.71.15",
"react-native": "0.73.3",
"react-native-url-polyfill": "1.1.2",
"react-refresh": "0.14.0",
"react-test-renderer": "18.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ describe( 'BlockDraggable', () => {
// activate the gesture. Since this not available in tests, the library
// displays a warning message.
expect( console ).toHaveWarnedWith(
'[Reanimated] You can not use setGestureState in non-worklet function.'
'[Reanimated] setGestureState() cannot be used with Jest.'
);
expect( getEditorHtml() ).toMatchSnapshot(
'Paragraph block moved from first to second position'
Expand Down Expand Up @@ -410,7 +410,7 @@ describe( 'BlockDraggable', () => {
// activate the gesture. Since this not available in tests, the library
// displays a warning message.
expect( console ).toHaveWarnedWith(
'[Reanimated] You can not use setGestureState in non-worklet function.'
'[Reanimated] setGestureState() cannot be used with Jest.'
);
expect( getEditorHtml() ).toMatchSnapshot(
'Spacer block moved from third to first position'
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/gallery/test/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe( 'Gallery block', () => {
expect( getBlock( screen, 'Gallery' ) ).toBeVisible();
expect( getEditorHtml() ).toMatchSnapshot();

getBlockSpy.mockReset();
getBlockSpy.mockRestore();
} );

it( 'selects a gallery item', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* External dependencies
*/
import {
act,
fireEvent,
getBlock,
initializeEditor,
Expand Down Expand Up @@ -117,7 +118,7 @@ describe( 'Unsupported block', () => {
screen.getByTestId( 'bottom-sheet' ),
MODAL_DISMISS_EVENT
);
jest.runOnlyPendingTimers();
act( () => jest.runOnlyPendingTimers() );
} );
expect( requestUnsupportedBlockFallback ).toHaveBeenCalled();
} );
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/draggable/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const Draggable = ( {
useAnimatedReaction(
() => isDragging.value,
( result, previous ) => {
if ( result === previous || previous === null ) {
if ( result === previous ) {
geriux marked this conversation as resolved.
Show resolved Hide resolved
return;
}

Expand All @@ -75,7 +75,7 @@ const Draggable = ( {
id: draggingId.value,
} );
}
} else if ( onDragEnd ) {
} else if ( previous !== null && onDragEnd ) {
onDragEnd( {
x: lastPosition.x.value,
y: lastPosition.y.value,
Expand Down
6 changes: 5 additions & 1 deletion packages/components/src/draggable/test/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ const TouchEventType = {
// For testing, we mock the "requestAnimationFrame" so it calls the callback passed instantly.
let requestAnimationFrameCopy;
beforeEach( () => {
jest.useFakeTimers();
requestAnimationFrameCopy = global.requestAnimationFrame;
global.requestAnimationFrame = ( callback ) => callback();
} );
afterEach( () => {
jest.useRealTimers();
global.requestAnimationFrame = requestAnimationFrameCopy;
} );

Expand All @@ -58,6 +60,7 @@ describe( 'Draggable', () => {
{ oldState: State.BEGAN, state: State.ACTIVE },
{ state: State.ACTIVE },
] );
jest.runOnlyPendingTimers();

expect( onLongPress ).toHaveBeenCalledTimes( 1 );
expect( onLongPress ).toHaveBeenCalledWith( triggerId );
Expand Down Expand Up @@ -93,6 +96,7 @@ describe( 'Draggable', () => {
{ oldState: State.BEGAN, state: State.ACTIVE },
{ state: State.ACTIVE },
] );
jest.runOnlyPendingTimers();
fireGestureHandler( draggable, [
// TOUCHES_DOWN event is only received on ACTIVE state, so we have to fire it manually.
{ oldState: State.BEGAN, state: State.ACTIVE },
Expand All @@ -112,7 +116,7 @@ describe( 'Draggable', () => {
] );
// TODO(jest-console): Fix the warning and remove the expect below.
expect( console ).toHaveWarnedWith(
'[Reanimated] You can not use setGestureState in non-worklet function.'
'[Reanimated] setGestureState() cannot be used with Jest.'
);

expect( onDragStart ).toHaveBeenCalledTimes( 1 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@
* External dependencies
*/
import { Text } from 'react-native';
import {
render,
fireEvent,
withReanimatedTimer,
advanceAnimationByTime,
} from 'test/helpers';
import { act, render, fireEvent, withReanimatedTimer } from 'test/helpers';
import { useNavigation } from '@react-navigation/native';

/**
Expand Down Expand Up @@ -63,7 +58,7 @@ it( 'animates height transitioning from non-full-screen to non-full-screen', asy
screen.getByTestId( 'navigation-screen-test-screen-1' ),
screen1Layout
);
advanceAnimationByTime( 1 );
act( () => jest.advanceTimersByTime( 1 ) );
expect( navigationContainer ).toHaveAnimatedStyle( screen1Layout );

// Navigate to screen 2
Expand All @@ -75,7 +70,7 @@ it( 'animates height transitioning from non-full-screen to non-full-screen', asy
);
// The animation takes 300 ms, so we wait that time plus 1 ms
// to the completion.
advanceAnimationByTime( 301 );
act( () => jest.advanceTimersByTime( 301 ) );
expect( navigationContainer ).toHaveAnimatedStyle( screen2Layout );
} ) );

Expand Down Expand Up @@ -105,14 +100,14 @@ it( 'animates height transitioning from non-full-screen to full-screen', async (
screen.getByTestId( 'navigation-screen-test-screen-1' ),
screen1Layout
);
advanceAnimationByTime( 1 );
act( () => jest.advanceTimersByTime( 1 ) );
expect( navigationContainer ).toHaveAnimatedStyle( screen1Layout );

// Navigate to screen 2
fireEvent.press( screen.getByText( /test-screen-1/ ) );
// The animation takes 300 ms, so we wait that time plus 1 ms
// to the completion.
advanceAnimationByTime( 301 );
act( () => jest.advanceTimersByTime( 301 ) );
expect( navigationContainer ).toHaveAnimatedStyle( {
height: WINDOW_HEIGHT,
} );
Expand Down Expand Up @@ -144,14 +139,14 @@ it( 'animates height transitioning from full-screen to non-full-screen', async (
screen.getByTestId( 'navigation-screen-test-screen-1' ),
screen1Layout
);
advanceAnimationByTime( 1 );
act( () => jest.advanceTimersByTime( 1 ) );
expect( navigationContainer ).toHaveAnimatedStyle( screen1Layout );

// Navigate to screen 2
fireEvent.press( screen.getByText( /test-screen-1/ ) );
// The animation takes 300 ms, so we wait that time plus 1 ms
// to the completion.
advanceAnimationByTime( 301 );
act( () => jest.advanceTimersByTime( 301 ) );
expect( navigationContainer ).toHaveAnimatedStyle( {
height: WINDOW_HEIGHT,
} );
Expand All @@ -160,7 +155,7 @@ it( 'animates height transitioning from full-screen to non-full-screen', async (
fireEvent.press( await screen.findByText( /test-screen-2/ ) );
// The animation takes 300 ms, so we wait that time plus 1 ms
// to the completion.
advanceAnimationByTime( 301 );
act( () => jest.advanceTimersByTime( 301 ) );
expect( navigationContainer ).toHaveAnimatedStyle( screen1Layout );
} ) );

Expand All @@ -187,15 +182,15 @@ it( 'does not animate height transitioning from full-screen to full-screen', asy

// First height value should be set without animation, but we need
// to wait for a frame to let animated styles be updated.
advanceAnimationByTime( 1 );
act( () => jest.advanceTimersByTime( 1 ) );
expect( navigationContainer ).toHaveAnimatedStyle( {
height: WINDOW_HEIGHT,
} );

// Navigate to screen 2
fireEvent.press( screen.getByText( /test-screen-1/ ) );
// We wait some milliseconds to check if height has changed.
advanceAnimationByTime( 10 );
act( () => jest.advanceTimersByTime( 10 ) );
expect( navigationContainer ).toHaveAnimatedStyle( {
height: WINDOW_HEIGHT,
} );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ exports[`LinksUI LinksUI renders 1`] = `
>
<View
collapsable={false}
forwardedRef={[Function]}
pointerEvents="box-none"
style={
{
Expand Down Expand Up @@ -178,7 +177,6 @@ exports[`LinksUI LinksUI renders 1`] = `
>
<View
collapsable={false}
forwardedRef={[Function]}
handlerTag={1}
handlerType="PanGestureHandler"
needsOffscreenAlphaCompositing={true}
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native-aztec/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

sourceSets {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-aztec/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pluginManagement {
gradle.ext.kotlinVersion = '1.6.10'
gradle.ext.kotlinVersion = '1.8.0'
gradle.ext.agpVersion = '8.1.0'
gradle.ext.automatticPublishToS3Version = '0.8.0'

Expand Down
22 changes: 9 additions & 13 deletions packages/react-native-aztec/src/test/AztecInputState.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,16 @@ import {
} from '../AztecInputState';

// Recreate internal state of TextInput
jest.mock( 'react-native/Libraries/Components/TextInput/TextInputState', () => {
let currentInput = null;
return {
focusTextInput: jest.fn( ( value ) => {
currentInput = value;
} ),
blurTextInput: jest.fn( ( value ) => {
if ( currentInput === value ) {
currentInput = null;
}
} ),
currentlyFocusedInput: jest.fn( () => currentInput ),
};
let currentInput = null;
TextInputState.focusTextInput = jest.fn( ( value ) => {
currentInput = value;
} );
TextInputState.blurTextInput = jest.fn( ( value ) => {
if ( currentInput === value ) {
currentInput = null;
}
} );
TextInputState.currentlyFocusedInput = jest.fn( () => currentInput );

const ref = { current: null };
const anotherRef = { current: null };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

sourceSets {
Expand Down Expand Up @@ -93,7 +93,7 @@ dependencies {

// Published by `wordpress-mobile/react-native-libraries-publisher`
// See the documentation for this value in `build.gradle.kts` of `wordpress-mobile/react-native-libraries-publisher`
def reactNativeLibrariesPublisherVersion = "v4"
def reactNativeLibrariesPublisherVersion = "v5"
def reactNativeLibrariesGroupId = "org.wordpress.react-native-libraries.$reactNativeLibrariesPublisherVersion"
implementation "$reactNativeLibrariesGroupId:react-native-get-random-values:${extractPackageVersion(packageJson, 'react-native-get-random-values', 'dependencies')}"
implementation "$reactNativeLibrariesGroupId:react-native-safe-area-context:${extractPackageVersion(packageJson, 'react-native-safe-area-context', 'dependencies')}"
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-bridge/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pluginManagement {
gradle.ext.kotlinVersion = '1.6.10'
gradle.ext.kotlinVersion = '1.8.0'
gradle.ext.agpVersion = '8.1.0'
gradle.ext.automatticPublishToS3Version = '0.8.0'

Expand Down
1 change: 1 addition & 0 deletions packages/react-native-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ For each user feature we should also add a importance categorization label to i
## Unreleased
- [*] Improve consistency of the block outline indicating the currently selected block [#59415]
- [*] Gallery block items with in-progress, paused, or failed media uploads correctly display an highlight outline when selected [#59423]
- [**] [internal] Upgrade React Native to version 0.73.3 [#58475]

## 1.114.0
- [*] Prevent crash when autoscrolling to blocks [#59110]
Expand Down
Loading
Loading