Skip to content

Commit 703ebfc

Browse files
committed
Merge branch 'main' of github.com:facebook/react-native into pods
2 parents 557c54d + 850349b commit 703ebfc

File tree

14 files changed

+114
-207
lines changed

14 files changed

+114
-207
lines changed

.circleci/configurations/commands.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,3 +506,53 @@ commands:
506506
when: << parameters.when >>
507507
path: << parameters.path >>
508508
destination: << parameters.destination >>
509+
510+
prepare_ios_tests:
511+
description: This command runs a set of commands to prepare iOS for running unit tests
512+
steps:
513+
- brew_install:
514+
package: xcbeautify
515+
- run:
516+
name: Run Ruby Tests
517+
command: |
518+
cd packages/react-native/scripts
519+
sh run_ruby_tests.sh
520+
- run:
521+
name: Boot iPhone Simulator
522+
command: source scripts/.tests.env && xcrun simctl boot "$IOS_DEVICE" || true
523+
524+
- run:
525+
name: Configure Environment Variables
526+
command: |
527+
echo 'export PATH=/usr/local/opt/node@18/bin:$PATH' >> $BASH_ENV
528+
source $BASH_ENV
529+
530+
- run:
531+
name: "Brew: Tap wix/brew"
532+
command: brew tap wix/brew
533+
- brew_install:
534+
package: applesimutils watchman
535+
- run:
536+
name: Configure Watchman
537+
command: echo "{}" > .watchmanconfig
538+
539+
run_ios_tests:
540+
description: This command run iOS tests and collects results
541+
steps:
542+
- run:
543+
name: "Run Tests: iOS Unit and Integration Tests"
544+
command: node ./scripts/circleci/run_with_retry.js 3 yarn test-ios
545+
- run:
546+
name: Zip Derived data folder
547+
when: always
548+
command: |
549+
echo "zipping tests results"
550+
cd /Users/distiller/Library/Developer/Xcode
551+
XCRESULT_PATH=$(find . -name '*.xcresult')
552+
tar -zcvf xcresults.tar.gz $XCRESULT_PATH
553+
- store_artifacts_if_needed:
554+
path: /Users/distiller/Library/Developer/Xcode/xcresults.tar.gz
555+
- report_bundle_size:
556+
platform: ios
557+
- store_test_results:
558+
path: ./reports/junit

.circleci/configurations/jobs.yml

Lines changed: 26 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -109,109 +109,6 @@ jobs:
109109
- store_test_results:
110110
path: ./reports/junit
111111

112-
# -------------------------
113-
# JOBS: iOS Unit Tests
114-
# -------------------------
115-
test_ios:
116-
executor: reactnativeios
117-
parameters:
118-
run_unit_tests:
119-
description: Specifies whether unit tests should run.
120-
type: boolean
121-
default: false
122-
jsengine:
123-
default: "Hermes"
124-
description: Which JavaScript engine to use. Must be one of "Hermes", "JSC".
125-
type: enum
126-
enum: ["Hermes", "JSC"]
127-
ruby_version:
128-
default: "2.6.10"
129-
description: The version of ruby that must be used
130-
type: string
131-
environment:
132-
- REPORTS_DIR: "./reports/junit"
133-
steps:
134-
- checkout_code_with_cache
135-
- setup_ruby:
136-
ruby_version: << parameters.ruby_version >>
137-
- brew_install:
138-
package: xcbeautify
139-
- run:
140-
name: Run Ruby Tests
141-
command: |
142-
cd packages/react-native/scripts
143-
sh run_ruby_tests.sh
144-
- run_yarn
145-
- *attach_hermes_workspace
146-
- run: |
147-
cd packages/rn-tester
148-
bundle check || bundle install
149-
- run:
150-
name: Boot iPhone Simulator
151-
command: source scripts/.tests.env && xcrun simctl boot "$IOS_DEVICE" || true
152-
153-
- run:
154-
name: Configure Environment Variables
155-
command: |
156-
echo 'export PATH=/usr/local/opt/node@18/bin:$PATH' >> $BASH_ENV
157-
source $BASH_ENV
158-
159-
- run:
160-
name: "Brew: Tap wix/brew"
161-
command: brew tap wix/brew
162-
- brew_install:
163-
package: applesimutils watchman
164-
165-
- run:
166-
name: Configure Watchman
167-
command: echo "{}" > .watchmanconfig
168-
169-
- run:
170-
name: Setup the CocoaPods environment
171-
command: |
172-
bundle exec pod setup
173-
174-
- with_hermes_tarball_cache_span:
175-
set_tarball_path: True
176-
steps:
177-
- with_rntester_pods_cache_span:
178-
steps:
179-
- run:
180-
name: Generate RNTesterPods Workspace
181-
command: |
182-
if [[ << parameters.jsengine >> == "JSC" ]]; then
183-
export USE_HERMES=0
184-
fi
185-
186-
cd packages/rn-tester
187-
bundle install
188-
bundle exec pod install --verbose
189-
190-
# -------------------------
191-
# Runs iOS unit tests
192-
- when:
193-
condition: << parameters.run_unit_tests >>
194-
steps:
195-
- run:
196-
name: "Run Tests: iOS Unit and Integration Tests"
197-
command: node ./scripts/circleci/run_with_retry.js 3 yarn test-ios
198-
- run:
199-
name: Zip Derived data folder
200-
when: always
201-
command: |
202-
echo "zipping tests results"
203-
cd /Users/distiller/Library/Developer/Xcode
204-
XCRESULT_PATH=$(find . -name '*.xcresult')
205-
tar -zcvf xcresults.tar.gz $XCRESULT_PATH
206-
- store_artifacts_if_needed:
207-
path: /Users/distiller/Library/Developer/Xcode/xcresults.tar.gz
208-
# -------------------------
209-
# Collect Results
210-
- report_bundle_size:
211-
platform: ios
212-
- store_test_results:
213-
path: ./reports/junit
214-
215112
# -------------------------
216113
# JOBS: iOS E2E Tests
217114
# -------------------------
@@ -627,6 +524,10 @@ jobs:
627524
default: "2.6.10"
628525
description: The version of ruby that must be used
629526
type: string
527+
run_unit_tests:
528+
description: whether unit tests should run or not.
529+
default: false
530+
type: boolean
630531
steps:
631532
- checkout_code_with_cache
632533
- run_yarn
@@ -641,6 +542,10 @@ jobs:
641542
command: sudo rm -rf /Library/Developer/CoreSimulator/Profiles/Runtimes/
642543
- setup_ruby:
643544
ruby_version: << parameters.ruby_version >>
545+
- when:
546+
condition: << parameters.run_unit_tests >>
547+
steps:
548+
- prepare_ios_tests
644549
- with_hermes_tarball_cache_span:
645550
set_tarball_path: True
646551
steps:
@@ -666,13 +571,24 @@ jobs:
666571
667572
bundle install
668573
bundle exec pod install
669-
- run:
670-
name: Build RNTester
671-
command: |
672-
xcodebuild build \
673-
-workspace packages/rn-tester/RNTesterPods.xcworkspace \
674-
-scheme RNTester \
675-
-sdk iphonesimulator
574+
- when:
575+
condition:
576+
# The run_ios_test will also build RNTester so we don't nee to build it
577+
# here if we run tests
578+
equal: [ false, << parameters.run_unit_tests >> ]
579+
580+
steps:
581+
- run:
582+
name: Build RNTester
583+
command: |
584+
xcodebuild build \
585+
-workspace packages/rn-tester/RNTesterPods.xcworkspace \
586+
-scheme RNTester \
587+
-sdk iphonesimulator
588+
- when:
589+
condition: << parameters.run_unit_tests >>
590+
steps:
591+
- run_ios_tests
676592

677593
# -------------------------
678594
# JOBS: Windows

.circleci/configurations/test_workflows/testAll.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,11 @@
169169
- architecture: "OldArch"
170170
jsengine: "JSC"
171171
use_frameworks: "StaticLibraries"
172-
- test_ios:
173-
name: "Test iOS with Ruby 3.2.0"
174-
run_unit_tests: true
175-
requires:
176-
- build_hermes_macos
177-
ruby_version: "3.2.0"
178-
- test_ios:
172+
- test_ios_rntester:
179173
run_unit_tests: true
174+
architecture: "OldArch"
175+
use_frameworks: "StaticLibraries"
176+
ruby_version: "2.6.10"
180177
requires:
181178
- build_hermes_macos
182179
matrix:

.circleci/configurations/test_workflows/testIOS.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,11 @@
160160
- architecture: "OldArch"
161161
jsengine: "JSC"
162162
use_frameworks: "StaticLibraries"
163-
- test_ios:
164-
name: "Test iOS with Ruby 3.2.0"
165-
run_unit_tests: true
166-
requires:
167-
- build_hermes_macos
168-
ruby_version: "3.2.0"
169-
- test_ios:
163+
- test_ios_rntester:
170164
run_unit_tests: true
165+
architecture: "OldArch"
166+
use_frameworks: "StaticLibraries"
167+
ruby_version: "2.6.10"
171168
requires:
172169
- build_hermes_macos
173170
matrix:

.circleci/configurations/top_level.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ references:
8383
# Hermes iOS
8484
hermesc_apple_cache_key: &hermesc_apple_cache_key v2-hermesc-apple-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
8585
hermes_apple_slices_cache_key: &hermes_apple_slices_cache_key v2-hermes-apple-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}-{{ checksum "packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh" }}
86-
hermes_tarball_debug_cache_key: &hermes_tarball_debug_cache_key v4-hermes-tarball-debug-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
87-
hermes_tarball_release_cache_key: &hermes_tarball_release_cache_key v3-hermes-tarball-release-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
86+
hermes_tarball_debug_cache_key: &hermes_tarball_debug_cache_key v4-hermes-tarball-debug-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}-{{ checksum "packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh" }}
87+
hermes_tarball_release_cache_key: &hermes_tarball_release_cache_key v3-hermes-tarball-release-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}-{{ checksum "packages/react-native/sdks/hermes-engine/utils/build-apple-framework.sh" }}
8888
hermes_macosx_bin_release_cache_key: &hermes_macosx_bin_release_cache_key v1-hermes-release-macosx-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
8989
hermes_macosx_bin_debug_cache_key: &hermes_macosx_bin_debug_cache_key v1-hermes-debug-macosx-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}
9090
hermes_dsym_debug_cache_key: &hermes_dsym_debug_cache_key v1-hermes-debug-dsym-{{ checksum "/tmp/hermes/hermesversion" }}-{{ checksum "/tmp/react-native-version" }}

packages/react-native/Libraries/Utilities/useColorScheme.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ import type {ColorSchemeName} from './NativeAppearance';
1515
import Appearance from './Appearance';
1616
import {useSyncExternalStore} from 'react';
1717

18+
const subscribe = (onStoreChange: () => void) => {
19+
const appearanceSubscription = Appearance.addChangeListener(onStoreChange);
20+
return () => appearanceSubscription.remove();
21+
};
22+
1823
export default function useColorScheme(): ?ColorSchemeName {
19-
return useSyncExternalStore(
20-
callback => {
21-
const appearanceSubscription = Appearance.addChangeListener(callback);
22-
return () => appearanceSubscription.remove();
23-
},
24-
() => Appearance.getColorScheme(),
25-
);
24+
return useSyncExternalStore(subscribe, Appearance.getColorScheme);
2625
}

packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,11 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
371371
self.accessibilityIdentifier = RCTNSStringFromString(newViewProps.testId);
372372
}
373373

374+
// `zIndex`
375+
if (oldViewProps.zIndex != newViewProps.zIndex) {
376+
self.layer.zPosition = newViewProps.zIndex.value_or(0);
377+
}
378+
374379
_needsInvalidateLayer = _needsInvalidateLayer || needsInvalidateLayer;
375380

376381
_props = std::static_pointer_cast<const ViewProps>(props);

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ protected T prepareToRecycleView(@NonNull ThemedReactContext reactContext, T vie
7979
// setScaleX
8080
// setScaleY
8181
// setCameraDistance
82-
setTransform(view, null);
82+
setTransformProperty(view, null, null);
8383

84-
// RenderNode params not covered by setTransform above
84+
// RenderNode params not covered by setTransformProperty above
8585
view.resetPivot();
8686
view.setTop(0);
8787
view.setBottom(0);
@@ -94,6 +94,7 @@ protected T prepareToRecycleView(@NonNull ThemedReactContext reactContext, T vie
9494
view.setTag(R.id.transform_origin, null);
9595
view.setTag(R.id.invalidate_transform, null);
9696
view.removeOnLayoutChangeListener(this);
97+
9798
// setShadowColor
9899
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
99100
view.setOutlineAmbientShadowColor(Color.BLACK);

packages/react-native/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropForShadowNodeSpecTest.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class ReactPropForShadowNodeSpecTest {
2626
fun testMethodWithWrongNumberOfParams() {
2727
BaseViewManager(
2828
object : ReactShadowNodeImpl() {
29+
@Suppress("UNUSED_PARAMETER")
2930
@ReactProp(name = "prop")
3031
fun setterWithIncorrectNumberOfArgs(value: Boolean, anotherValue: Int) {}
3132
}
@@ -47,7 +48,9 @@ class ReactPropForShadowNodeSpecTest {
4748
fun testUnsupportedValueType() {
4849
BaseViewManager(
4950
object : ReactShadowNodeImpl() {
50-
@ReactProp(name = "prop") fun setterWithMap(value: Map<*, *>) {}
51+
@Suppress("UNUSED_PARAMETER")
52+
@ReactProp(name = "prop")
53+
fun setterWithMap(value: Map<*, *>) {}
5154
}
5255
.javaClass)
5356
.nativeProps
@@ -57,6 +60,7 @@ class ReactPropForShadowNodeSpecTest {
5760
fun testGroupInvalidNumberOfParams() {
5861
BaseViewManager(
5962
object : ReactShadowNodeImpl() {
63+
@Suppress("UNUSED_PARAMETER")
6064
@ReactPropGroup(names = ["prop1", "prop2"])
6165
fun setterWithTooManyParams(index: Int, value: Float, boolean: Boolean) {}
6266
}
@@ -68,6 +72,7 @@ class ReactPropForShadowNodeSpecTest {
6872
fun testGroupTooFewParams() {
6973
BaseViewManager(
7074
object : ReactShadowNodeImpl() {
75+
@Suppress("UNUSED_PARAMETER")
7176
@ReactPropGroup(names = ["props1", "prop2"])
7277
fun setterWithTooFewParams(index: Int) {}
7378
}
@@ -79,6 +84,7 @@ class ReactPropForShadowNodeSpecTest {
7984
fun testGroupNoIndexParam() {
8085
BaseViewManager(
8186
object : ReactShadowNodeImpl() {
87+
@Suppress("UNUSED_PARAMETER")
8288
@ReactPropGroup(names = ["prop1", "prop2"])
8389
fun setterWithNoIndexParam(value: Float, boolean: Boolean) {}
8490
}

0 commit comments

Comments
 (0)