Skip to content

Commit 3c6a9af

Browse files
authored
Merge branch 'main' into @matipl01/web-jsdom-for-web-jest-tests
2 parents 43aaf84 + 3149e11 commit 3c6a9af

File tree

158 files changed

+8413
-912
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+8413
-912
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
/packages/eslint-plugin-reanimated/types/**/* linguist-generated=true
66
/packages/react-native-worklets/plugin/index.js linguist-generated=true
77
/packages/react-native-worklets/plugin/index.d.ts linguist-generated=true
8+
**/Podfile.lock linguist-generated=true
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt b/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt
2+
index 890e61c007d5b3e0a9a69d37ef10e8aa3ce5c6b6..91acd7b2930fedb4eca2461ba99287721ca1f38f 100644
3+
--- a/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt
4+
+++ b/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt
5+
@@ -80,7 +80,9 @@ class ReactPlugin : Plugin<Project> {
6+
configureRepositories(project)
7+
}
8+
9+
- configureReactNativeNdk(project, extension)
10+
+ if (!project.gradle.startParameter.taskNames.any { it.contains("clean") }) {
11+
+ configureReactNativeNdk(project, extension)
12+
+ }
13+
configureBuildConfigFieldsForApp(project, extension)
14+
configureDevServerLocation(project)
15+
configureBackwardCompatibilityReactMap(project)
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
diff --git a/ios/RNSScreen.h b/ios/RNSScreen.h
2+
index 6b0c87abb74c9c70d39813b71b989a889c92408f..c0bbf0d08adc91333f6fcab82daf4eb6be8a9954 100644
3+
--- a/ios/RNSScreen.h
4+
+++ b/ios/RNSScreen.h
5+
@@ -53,7 +53,7 @@ namespace react = facebook::react;
6+
- (void)notifyFinishTransitioning;
7+
- (RNSScreenView *)screenView;
8+
#ifdef RCT_NEW_ARCH_ENABLED
9+
-- (void)setViewToSnapshot;
10+
+- (void)setViewToSnapshotAfterUpdates:(BOOL)afterUpdates;
11+
- (CGFloat)calculateHeaderHeightIsModal:(BOOL)isModal;
12+
#endif
13+
14+
@@ -130,6 +130,7 @@ namespace react = facebook::react;
15+
@property (nonatomic, readonly) BOOL hasHeaderConfig;
16+
@property (nonatomic, readonly, getter=isMarkedForUnmountInCurrentTransaction)
17+
BOOL markedForUnmountInCurrentTransaction;
18+
+@property (nonatomic) BOOL snapshotAfterUpdates;
19+
#else
20+
@property (nonatomic, copy) RCTDirectEventBlock onAppear;
21+
@property (nonatomic, copy) RCTDirectEventBlock onDisappear;
22+
diff --git a/ios/RNSScreen.mm b/ios/RNSScreen.mm
23+
index 65c18f1ddccc64b3169e050e577eab77fd8c183b..e8779d92d400e614e850ccc0627510a8b85cb5dc 100644
24+
--- a/ios/RNSScreen.mm
25+
+++ b/ios/RNSScreen.mm
26+
@@ -2139,12 +2139,12 @@ Class<RCTComponentViewProtocol> RNSScreenCls(void)
27+
#ifdef RCT_NEW_ARCH_ENABLED
28+
#pragma mark - Fabric specific
29+
30+
-- (void)setViewToSnapshot
31+
+- (void)setViewToSnapshotAfterUpdates:(BOOL)afterUpdates
32+
{
33+
UIView *superView = self.view.superview;
34+
// if we dismissed the view natively, it will already be detached from view hierarchy
35+
if (self.view.window != nil) {
36+
- UIView *snapshot = [self.view snapshotViewAfterScreenUpdates:NO];
37+
+ UIView *snapshot = [self.view snapshotViewAfterScreenUpdates:afterUpdates];
38+
snapshot.frame = self.view.frame;
39+
[self.view removeFromSuperview];
40+
self.view = snapshot;
41+
diff --git a/ios/RNSScreenStack.mm b/ios/RNSScreenStack.mm
42+
index 51f021831aed26a4eed3c85014020423b7b3108b..db0e68204ad8579822fabc5969c594e44c67c4ed 100644
43+
--- a/ios/RNSScreenStack.mm
44+
+++ b/ios/RNSScreenStack.mm
45+
@@ -1393,7 +1393,8 @@ RNS_IGNORE_SUPER_CALL_END
46+
- (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
47+
{
48+
RNSScreenView *screenChildComponent = (RNSScreenView *)childComponentView;
49+
- [screenChildComponent.controller setViewToSnapshot];
50+
+ BOOL afterUpdates = screenChildComponent.snapshotAfterUpdates;
51+
+ [screenChildComponent.controller setViewToSnapshotAfterUpdates:afterUpdates];
52+
53+
RCTAssert(
54+
screenChildComponent.reactSuperview == self,

apps/common-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"react-native-pager-view": "7.0.0",
4141
"react-native-reanimated": "workspace:*",
4242
"react-native-safe-area-context": "5.6.1",
43-
"react-native-screens": "4.16.0",
43+
"react-native-screens": "4.19.0-nightly-20251125-46052f31e",
4444
"react-native-svg": "15.14.0",
4545
"react-native-worklets": "workspace:*",
4646
"react-strict-dom": "0.0.54"

apps/common-app/src/apps/reanimated/App.tsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ function findExamples(search: string) {
4646
function HomeScreen({ navigation }: HomeScreenProps) {
4747
const [search, setSearch] = React.useState('');
4848
const [wasClicked, setWasClicked] = React.useState<string[]>([]);
49+
const platform =
50+
Platform.OS == 'ios' || Platform.OS == 'android' ? Platform.OS : undefined;
4951

5052
React.useLayoutEffect(() => {
5153
navigation.setOptions({
@@ -78,6 +80,9 @@ function HomeScreen({ navigation }: HomeScreenProps) {
7880
setTimeout(() => setWasClicked([...wasClicked, name]), 500);
7981
}
8082
}}
83+
shouldWork={
84+
platform ? EXAMPLES[name].shouldWork?.[platform] : undefined
85+
}
8186
disabled={EXAMPLES[name].disabledPlatforms?.includes(Platform.OS)}
8287
wasClicked={wasClicked.includes(name)}
8388
/>
@@ -95,9 +100,17 @@ interface ItemProps {
95100
disabled?: boolean;
96101
onPress: () => void;
97102
wasClicked?: boolean;
103+
shouldWork?: boolean;
98104
}
99105

100-
function Item({ icon, title, onPress, disabled, wasClicked }: ItemProps) {
106+
function Item({
107+
icon,
108+
title,
109+
onPress,
110+
disabled,
111+
wasClicked,
112+
shouldWork,
113+
}: ItemProps) {
101114
const Button = IS_MACOS ? Pressable : RectButton;
102115
return (
103116
<Button
@@ -110,6 +123,9 @@ function Item({ icon, title, onPress, disabled, wasClicked }: ItemProps) {
110123
enabled={!disabled}>
111124
{icon && <Text style={styles.title}>{icon + ' '}</Text>}
112125
<Text style={styles.title}>{title}</Text>
126+
{shouldWork !== undefined && (
127+
<Text style={styles.shouldWorkEmoji}>{shouldWork ? '✅' : '❌'}</Text>
128+
)}
113129
</Button>
114130
);
115131
}
@@ -190,6 +206,12 @@ const styles = StyleSheet.create({
190206
fontSize: 16,
191207
color: 'black',
192208
},
209+
shouldWorkEmoji: {
210+
fontSize: 20,
211+
color: 'black',
212+
alignSelf: 'flex-end',
213+
marginLeft: 'auto',
214+
},
193215
visitedItem: {
194216
backgroundColor: '#e6f0f7',
195217
},

apps/common-app/src/apps/reanimated/examples/AboutExample.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,16 @@ export default function AboutExample() {
136136
? 'Enabled'
137137
: 'Disabled'}
138138
</Text>
139+
<Text style={styles.text}>
140+
<Text style={styles.bold}>
141+
FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS:
142+
</Text>{' '}
143+
{getStaticFeatureFlagReanimated(
144+
'FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS'
145+
)
146+
? 'Enabled'
147+
: 'Disabled'}
148+
</Text>
139149
<Text style={styles.text}>
140150
<Text style={styles.bold}>IOS_DYNAMIC_FRAMERATE_ENABLED:</Text>{' '}
141151
{getStaticFeatureFlagWorklets('IOS_DYNAMIC_FRAMERATE_ENABLED')

apps/common-app/src/apps/reanimated/examples/ScreenStackHeaderConfigBackgroundColorExample.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import React from 'react';
2-
import { StyleSheet, View } from 'react-native';
1+
import React, { useCallback } from 'react';
2+
import { Button, StyleSheet, Text, View } from 'react-native';
33
import type {
44
GestureUpdateEvent,
55
PanGestureChangeEventPayload,
@@ -66,12 +66,20 @@ export default function ScreenStackHeaderConfigBackgroundColorExample() {
6666
};
6767
}, [offset]);
6868

69+
const [counter, setCounter] = React.useState(0);
70+
71+
const handleIncrement = useCallback(() => {
72+
setCounter((prev) => prev + 1);
73+
}, []);
74+
6975
return (
7076
<GestureHandlerRootView style={styles.root}>
7177
<ScreenStack style={styles.container}>
7278
<Screen>
7379
<AnimatedScreenStackHeaderConfig animatedProps={animatedProps} />
7480
<View style={styles.container}>
81+
<Text>Counter: {counter}</Text>
82+
<Button title="Increase counter" onPress={handleIncrement} />
7583
<GestureDetector gesture={gesture}>
7684
<Animated.View style={[styles.ball, animatedStyles]} />
7785
</GestureDetector>
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
import type { ParamListBase } from '@react-navigation/native';
2+
import type { NativeStackScreenProps } from '@react-navigation/native-stack';
3+
import { createNativeStackNavigator } from '@react-navigation/native-stack';
4+
import * as React from 'react';
5+
import { Button, StyleSheet, View } from 'react-native';
6+
import Animated, { SharedTransition } from 'react-native-reanimated';
7+
import photo from './assets/image.jpg';
8+
9+
const Stack = createNativeStackNavigator();
10+
11+
const transition = undefined;
12+
13+
// SharedTransition.duration(1000).defaultTransitionType(
14+
// SharedTransitionType.ANIMATION
15+
// );
16+
17+
function Screen1({ navigation }: NativeStackScreenProps<ParamListBase>) {
18+
return (
19+
<View style={styles.flexOne}>
20+
<Button
21+
onPress={() => navigation.navigate('Screen2')}
22+
title="go to screen2"
23+
/>
24+
25+
<Animated.View
26+
style={styles.greenBoxScreenOne}
27+
sharedTransitionTag="tag"
28+
sharedTransitionStyle={transition}>
29+
<Animated.Image
30+
style={styles.imageOne}
31+
sharedTransitionTag="image"
32+
sharedTransitionStyle={transition}
33+
source={photo}
34+
/>
35+
</Animated.View>
36+
</View>
37+
);
38+
}
39+
40+
function Screen2({ navigation }: NativeStackScreenProps<ParamListBase>) {
41+
return (
42+
<View style={styles.flexOne}>
43+
<Button title="go back" onPress={() => navigation.popTo('Screen1')} />
44+
<Animated.View
45+
style={styles.greenBoxScreenTwo}
46+
sharedTransitionTag="tag"
47+
sharedTransitionStyle={transition}>
48+
<Animated.Image
49+
style={styles.imageTwo}
50+
sharedTransitionTag="image"
51+
sharedTransitionStyle={transition}
52+
source={photo}
53+
/>
54+
</Animated.View>
55+
</View>
56+
);
57+
}
58+
59+
export default function CustomTransitionExample() {
60+
return (
61+
<Stack.Navigator>
62+
<Stack.Screen
63+
name="Screen1"
64+
component={Screen1}
65+
options={{ headerShown: false }}
66+
/>
67+
<Stack.Screen
68+
name="Screen2"
69+
component={Screen2}
70+
options={{ headerShown: false }}
71+
/>
72+
</Stack.Navigator>
73+
);
74+
}
75+
76+
const styles = StyleSheet.create({
77+
flexOne: { flex: 1, justifyContent: 'flex-end', alignItems: 'center' },
78+
greenBoxScreenOne: {
79+
width: 300,
80+
height: 150,
81+
borderTopLeftRadius: 25,
82+
borderTopRightRadius: 25,
83+
backgroundColor: 'pink',
84+
},
85+
greenBoxScreenTwo: {
86+
width: 350,
87+
height: 500,
88+
marginBottom: 100,
89+
borderRadius: 50,
90+
backgroundColor: 'pink',
91+
},
92+
imageOne: {
93+
margin: 10,
94+
width: 280,
95+
height: 140,
96+
borderTopLeftRadius: 15,
97+
borderTopRightRadius: 15,
98+
},
99+
imageTwo: {
100+
margin: 10,
101+
width: 330,
102+
height: 200,
103+
borderRadius: 40,
104+
},
105+
});

0 commit comments

Comments
 (0)