-
-
Notifications
You must be signed in to change notification settings - Fork 546
Comparing changes
Open a pull request
base repository: software-mansion/react-native-screens
base: 4.5.0
head repository: software-mansion/react-native-screens
compare: 4.6.0
- 20 commits
- 78 files changed
- 4 contributors
Commits on Jan 14, 2025
-
chore: bump deps in lib & examples (part 1 of fixing CI) (#2618)
## Description Motivation: working on #2466 right now & need these changes + this is also required to fix the failing CI ## Changes Bumped versions of reanimated, gesture handler and safe-area-context in both lib and the examples ## Test code and steps to reproduce :fingers_crossed: CI? Okay, seems that Android part of the CI is fixed. iOS has some other, yet undetermined problems. I do not see a regression on iOS part, however. ## Checklist - [x] (kinda ☝🏻) Ensured that CI passes
Configuration menu - View commit details
-
Copy full SHA for 3555d23 - Browse repository at this point
Copy the full SHA 3555d23View commit details
Commits on Jan 16, 2025
-
chore(CI): fix part 2 - set xcode-version to 16.1 (#2620)
## Description Apparently there are some issues with newer xcode versions on GitHub CI Following [gesture-handler lead](software-mansion/react-native-gesture-handler#3319) here. ## Changes Set `xcode-version` to `16.1` temporarily in our CI workflow definitions. ## Test code and steps to reproduce hopefully iOS-related workflows pass ## Checklist - [ ] Ensured that CI passes
Configuration menu - View commit details
-
Copy full SHA for 9ed3987 - Browse repository at this point
Copy the full SHA 9ed3987View commit details -
fix: clicking on Pressable located in screen header (#2466)
## Description This PR fixes clicking on Pressables that are added to the native header. Previously, Yoga had incorrect information about the location of the content in the header. The first step was to remove `top: "-100%"` style from the `ScreenStackHeaderConfig` which made Yoga think, that the content is pushed up by the size of its parent (Screen size). The second step involved updating `layoutMetrics` of the `RNSScreenStackHeaderConfigShadowNode`. The entire app content is pushed down by the size of the header, so it also has an impact on the header config in Yoga metrics. To mitigate this, the origin of `RNSScreenStackHeaderConfigShadowNode` is decreased by the size of the header which will zero out eventually leaving the header content in the desired position. On iOS this position is actually moved by the top inset size, so we also have to take it into account when setting header config layout metrics. Fixes #2219 ## Changes Updated `ScreenShadowNode` to decrease `origin.y` of the `HeaderConfigShadowNode` by the size of the header. Added `paddingTop` to `HeaderConfigState` and set it as origin offset on iOS. <!-- Please describe things you've changed here, make a **high level** overview, if change is simple you can omit this section. For example: - Updated `about.md` docs --> <!-- --> ## Screenshots / GIFs ### Before | iOS | Android | |--------------|--------------| | <video src="https://github.com/user-attachments/assets/aa054d20-58e5-4153-924b-a1b74879ae6b"> | <video src="https://github.com/user-attachments/assets/dd9d2732-10c5-40ca-b384-1570c08410cf"> | ### After | iOs | Android | |--------------|--------------| | <video src="https://github.com/user-attachments/assets/6953c9e5-b418-41b1-8b99-27f70c5df688"> | <video src="https://github.com/user-attachments/assets/f5762f46-36b2-423a-93da-9f61032b54bf"> | ## Test code and steps to reproduce Tested on this example: <details> <summary>code</summary> ```ts import { NavigationContainer } from "@react-navigation/native"; import { createNativeStackNavigator, NativeStackNavigationProp } from "@react-navigation/native-stack"; import React, { ForwardedRef, forwardRef } from "react"; import { findNodeHandle, Pressable, PressableProps, StyleSheet, Text, View, } from "react-native"; type StackParamList = { Home: undefined, } type RouteProps = { navigation: NativeStackNavigationProp<StackParamList>; } type PressableState = 'pressed-in' | 'pressed' | 'pressed-out' const Stack = createNativeStackNavigator<StackParamList>(); const PressableWithFeedback = forwardRef((props: PressableProps, ref: ForwardedRef<View>): React.JSX.Element => { const [pressedState, setPressedState] = React.useState<PressableState>('pressed-out'); const onPressInCallback = React.useCallback((e) => { console.log('Pressable onPressIn', { locationX: e.nativeEvent.locationX, locationY: e.nativeEvent.locationY, pageX: e.nativeEvent.pageX, pageY: e.nativeEvent.pageY, }); setPressedState('pressed-in'); props.onPressIn?.(); }, []); const onPressCallback = React.useCallback(() => { console.log('Pressable onPress'); setPressedState('pressed'); }, []); const onPressOutCallback = React.useCallback(() => { console.log('Pressable onPressOut'); setPressedState('pressed-out'); }, []); const onResponderMoveCallback = React.useCallback(() => { console.log('Pressable onResponderMove'); }, []); const contentsStyle = pressedState === 'pressed-out' ? styles.pressablePressedOut : (pressedState === 'pressed' ? styles.pressablePressed : styles.pressablePressedIn); return ( <View ref={ref} style={[contentsStyle, { width: "100%"}]}> <Pressable onPressIn={onPressInCallback} onPress={onPressCallback} onPressOut={onPressOutCallback} onResponderMove={onResponderMoveCallback} > {props.children} </Pressable> </View> ); }) function HeaderTitle(): React.JSX.Element { return ( <PressableWithFeedback onPressIn={() => { console.log('Pressable onPressIn') }} onPress={() => console.log('Pressable onPress')} onPressOut={() => console.log('Pressable onPressOut')} onResponderMove={() => console.log('Pressable onResponderMove')} ref={ref => { console.log(findNodeHandle(ref)); ref?.measure((x, y, width, height, pageX, pageY) => { console.log('header component measure', { x, y, width, height, pageX, pageY }); }) }} > <View style={{ height: 40, justifyContent: 'center', alignItems: 'center' }}> <Text style={{ alignItems: 'center' }}>Regular Pressable</Text> </View> </PressableWithFeedback> ) } function Home(_: RouteProps): React.JSX.Element { return ( <View style={{ flex: 1, backgroundColor: 'rgba(0, 0, 0, .8)' }} > <View style={{ flex: 1, alignItems: 'center', marginTop: 48 }}> <PressableWithFeedback onPressIn={() => console.log('Pressable onPressIn')} onPress={() => console.log('Pressable onPress')} onPressOut={() => console.log('Pressable onPressOut')} > <View style={{ height: 40, width: 200, justifyContent: 'center', alignItems: 'center' }}> <Text style={{ alignItems: 'center' }}>Regular Pressable</Text> </View> </PressableWithFeedback> </View> </View> ); } function App(): React.JSX.Element { return ( <NavigationContainer> <Stack.Navigator> <Stack.Screen name="Home" component={Home} options={{ headerTitle: HeaderTitle, }} /> </Stack.Navigator> </NavigationContainer> ); } const styles = StyleSheet.create({ pressablePressedIn: { backgroundColor: 'lightsalmon', }, pressablePressed: { backgroundColor: 'crimson', }, pressablePressedOut: { backgroundColor: 'lightseagreen', } }); export default App; ``` </details> <!-- Please include code that can be used to test this change and short description how this example should work. This snippet should be as minimal as possible and ready to be pasted into editor (don't exclude exports or remove "not important" parts of reproduction example) --> --------- Co-authored-by: Kacper Kafara <kacperkafara@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for e741b8e - Browse repository at this point
Copy the full SHA e741b8eView commit details -
chore(examples): remove dependency on
react-native-vector-icons
(#2621Configuration menu - View commit details
-
Copy full SHA for 7dc6916 - Browse repository at this point
Copy the full SHA 7dc6916View commit details -
refactor(Android): rename
FabricEnabledHeaderSubviewGroup
-> `Fabri……cEnabledHeaderSubviewViewGroup` + fix arch-consistency check (#2622) - **Add FabricEnabledHeaderSubviewViewGroup to arch-check balcklist** - **Fix naming** ## Description <!-- Description and motivation for this PR. Include Fixes #<number> if this is fixing some issue. Fixes # . --> ## Changes <!-- Please describe things you've changed here, make a **high level** overview, if change is simple you can omit this section. For example: - Updated `about.md` docs --> <!-- ## Screenshots / GIFs Here you can add screenshots / GIFs documenting your change. You can add before / after section if you're changing some behavior. ### Before ### After --> ## Test code and steps to reproduce <!-- Please include code that can be used to test this change and short description how this example should work. This snippet should be as minimal as possible and ready to be pasted into editor (don't exclude exports or remove "not important" parts of reproduction example) --> ## Checklist - [ ] Included code example that can be used to test this change - [ ] Updated TS types - [ ] Updated documentation: <!-- For adding new props to native-stack --> - [ ] https://github.com/software-mansion/react-native-screens/blob/main/guides/GUIDE_FOR_LIBRARY_AUTHORS.md - [ ] https://github.com/software-mansion/react-native-screens/blob/main/native-stack/README.md - [ ] https://github.com/software-mansion/react-native-screens/blob/main/src/types.tsx - [ ] https://github.com/software-mansion/react-native-screens/blob/main/src/native-stack/types.tsx - [ ] Ensured that CI passes
Configuration menu - View commit details
-
Copy full SHA for c07e9b6 - Browse repository at this point
Copy the full SHA c07e9b6View commit details -
fix(iOS): make
RCTMountingTransactionObserving
implementation new-a…Configuration menu - View commit details
-
Copy full SHA for 07fc4a0 - Browse repository at this point
Copy the full SHA 07fc4a0View commit details -
fix: remove workaround for removing clipped subviews (#2596)
## Description This PR removes the workaround introduced in series of PRs (listed chronologically here): 1. #2307 2. #2383 3. #2495 4. #2531 For detailed description of error mechanism and broader discussion please refer to: 1. [my comment on #2495](#2495 (comment)), 2. [my fix to RN core](facebook/react-native#47634) tldr: When popping screen on Fabric we marked the views as "transitioning" and this led to view being effectively miscounted during removal by view groups that supported react-native's subview clipping mechanism. The issue has been present most likely in every version of the library when running on Android & Fabric, but it arose few months ago due to broader adoption of the new architecture. facebook/react-native#47634 is supposed to fix the underlying issue in `react-native's` core. ## Changes Removed the workaround code from `Screen` implementation on Android. The * facebook/react-native#47634 has been released with 0.77.0-rc.3 and followup small fixup: * facebook/react-native#48329 has been released with 0.77.0-rc.4. Therefore, with landing this PR we should limit our support on Fabric to 0.77.0. ## Test code and steps to reproduce `Test2282` - note that there are few testing variants available there, you just need to comment (out) some parts of the code. ## Checklist - [x] Included code example that can be used to test this change - [ ] Ensured that CI passes
Configuration menu - View commit details
-
Copy full SHA for 2aa278c - Browse repository at this point
Copy the full SHA 2aa278cView commit details -
## Description Release 4.6.0-beta.0 ## Checklist - [ ] Ensured that CI passes
Configuration menu - View commit details
-
Copy full SHA for 5408827 - Browse repository at this point
Copy the full SHA 5408827View commit details
Commits on Jan 17, 2025
-
chore: bump RN to 0.77.0-rc.7 in examples and lib (#2630)
## Description Bumping rn to 0.77.0-rc.7 in examples and library dev dependencies. ## Checklist - [ ] Ensured that CI passes
Configuration menu - View commit details
-
Copy full SHA for 7ebf02f - Browse repository at this point
Copy the full SHA 7ebf02fView commit details
Commits on Jan 20, 2025
-
feat(Android): deprecate series of status/navigation bar related props (
#2638) ## Description ### Important context * [Android SDK 35 behaviour changes](https://developer.android.com/about/versions/15/behavior-changes-15#ux) * [status bar color API deprecation note](https://developer.android.com/reference/android/view/Window#setStatusBarColor(int)) * [navigation bar color API deprecation note](https://developer.android.com/reference/android/view/Window#setNavigationBarColor(int)) * [edge-to-edge on Android](https://developer.android.com/develop/ui/views/layout/edge-to-edge) For all apps targeting Android SDK 35 the edge-to-edge mode is enabled by default (it is effectively enforced, opting out takes some effort) and everything indicates that it will be enforced in future SDKs. For SDKs below 35 the status / navigation bar APIs affected by this PR are deprecated or deprecated & disabled (see above links ☝🏻 ). Currently minimal target sdk level for google app store is 34 ([source](https://median.co/blog/google-plays-target-api-level-requirement-for-android-apps)). We can't really foresee when SDK level 35 will be required, however it can be clearly seen that edge-to-edge will be the promoted and supported way of designing UI on Android. We want to get rid of these props for one more reason. These are Android-specific props and translucency is implemented by (not) consuming appropriate window insets, which leads to conflicts with other libs *and we can't set right defaults*, since it is not really possible to detect whether the app is in edge to edge or not leading to some buggy behaviour (initial content jump etc.). ## Changes - **Deprecate navigationBarColor** - **Deprecate navigationBarTranslucent** - **Deprecate statusBarColor** - **Deprecate statusBarTranslucent** - **Deprecate topInsetEnabled** ## Test code and steps to reproduce No runtime changes. ## Checklist - [ ] Ensured that CI passes
Configuration menu - View commit details
-
Copy full SHA for b69ea04 - Browse repository at this point
Copy the full SHA b69ea04View commit details
Commits on Jan 21, 2025
-
refactor(iOS): update view controller once per transaction when addin…
…g header subviews (#2623) ## Description In #2466 I've introduced `RCTMountingTransactionObserving` for `RNSScreenStackHeaderConfig` component. Now we can use this to reduce amount of calls to `updateViewControllerIfNeeded` (causing layout passes) when adding subviews. I'm not changing the `unmount` path of the code as we have some more additional logic there which requires some more careful consideration. This also aligns us with Paper implementation. Note that it has been only implemented this way, because at the implementation time there was no way to run this code on transaction completion. ## Changes `- [RNSScreenStackHeaderConfig updateViewControllerIfNeeded]` is now called only once per transaction when adding subviews to header config. ## Test code and steps to reproduce Test432, TestHeaderTitle, Test2552 - see that there are no regressions. > [!note] During testing I've found that there is a bug with subview layout when modifying subviews after first render. This is not a regression however. Notice the wrong position of header right on video below 👇🏻 (Test432) https://github.com/user-attachments/assets/7f8653e8-a7d9-4fb8-a875-182e7deb0495 ## Checklist - [x] Included code example that can be used to test this change - [x] Ensured that CI passes
Configuration menu - View commit details
-
Copy full SHA for 3c589b1 - Browse repository at this point
Copy the full SHA 3c589b1View commit details -
chore(types): update information on nested stack rendering support (#…
Configuration menu - View commit details
-
Copy full SHA for 4bfc959 - Browse repository at this point
Copy the full SHA 4bfc959View commit details
Commits on Jan 23, 2025
-
fix(iOS,Fabric): fix invalid position of FullWindowOverlay in certain…
… scenarios (#2641) ## Description Fixes #2631 I've given extensive description of both the issue ~and potential solution~ in #2631 issue discussion * #2631 In particular important parts are: * #2631 (comment) * #2631 (comment) I settled down on zeroing origin of the `FullWindowOverlay` frame in HostTree & setting `ShadowNodeTraits::RootNodeKind` for the custom shadow node of `FullWindowOverlay` component in the ShadowTree. This is much cleaner than managing the state & content offset manually. ## Changes `FullWindowOverlay` has now custom component descriptor, shadow node & shadow node state (its empty). The shadow node has `ShadowNodeTraits::RootNodeKind` set allowing it to be the reference point when computing position of any descendant view in shadow tree - this is fine, because we always expect `FullWindowOverlay` to have origin at `(0, 0)` in window coordinate space. In the HostTree we now ensure that `FWO` origin is at `(0, 0)` by overriding frame received during mounting stage. ## Test code and steps to reproduce Test2631 should now work not as in recording from issue description but correctly. ## Checklist - [x] Included code example that can be used to test this change - [x] Ensured that CI passes
Configuration menu - View commit details
-
Copy full SHA for 0f411ac - Browse repository at this point
Copy the full SHA 0f411acView commit details -
chore: fix code editing (add dev dependency on eslint-plugin-ft-flow (#…
…2644) ## Description Had issues editing top level project files as eslint language server would report missing dependency. Installing it. ## Changes Added dev depenency on `eslint-plugin-ft-flow` for the library. ## Test code and steps to reproduce N/A ## Checklist - [x] Ensured that CI passes (lint fails recently)
Configuration menu - View commit details
-
Copy full SHA for ea56038 - Browse repository at this point
Copy the full SHA ea56038View commit details -
chore(CI): fix linting (#2645)
## Description Lint started failing recently for no apparent reason with errors: ``` Run yarn format RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stdout maxBuffer length exceeded at new NodeError (node:internal/errors:405:5) at Socket.onChildStdout (node:child_process:490:14) at Socket.emit (node:events:517:28) at addChunk (node:internal/streams/readable:368:12) at readableAddChunk (node:internal/streams/readable:337:11) at Readable.push (node:internal/streams/readable:278:10) at Pipe.onStreamRead (node:internal/stream_base_commons:190:23) { code: 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER', cmd: './android/gradlew -p android spotlessApply' } ``` and ``` Not a number: 33x: java.lang.NumberFormatException: Not a number: 33x at com.sun.xml.bind.DatatypeConverterImpl._parseInt(DatatypeConverterImpl.java:95) at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$18.parse(RuntimeBuiltinLeafInfoImpl.java:712) at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$18.parse(RuntimeBuiltinLeafInfoImpl.java:710) at com.sun.xml.bind.v2.runtime.unmarshaller.TextLoader.text(TextLoader.java:39) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.text(UnmarshallingContext.java:560) at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.processText(SAXConnector.java:183) ... (much longer stacktrace) ``` Edit: Idk why the issue started happening, but bumping gradle wrapper version & gradle build tools version resolved the issue. I've used [versions used in reanimated](software-mansion/react-native-reanimated#6629), at the time their last supported version of `react-native` was 0.74 (the same as it is for us now). ## Test code and steps to reproduce Lint on CI should not longer fail. ## Checklist - [x] Ensured that CI passes
Configuration menu - View commit details
-
Copy full SHA for 9d9e797 - Browse repository at this point
Copy the full SHA 9d9e797View commit details -
fix(Android): Restore focus on page transitions (#2640)
## Description After #1894 was merged, a refactoring of the native source happened, and the call to `lastFocusedChild.requestFocus()` that happened on the overridden `onStart()` method in `ScreenStackFragment` got lost along the way, making focus disappear when popping a screen from the stack. Fixes #1706 ## Changes - Updated `ScreenStackFragment.kt`, resurrecting the old `onStart()` override (`lastFocusedChild` is only set on Android TV, so this change only affects that platform)
Configuration menu - View commit details
-
Copy full SHA for c0b5586 - Browse repository at this point
Copy the full SHA c0b5586View commit details
Commits on Jan 24, 2025
-
fix(Android): fix draw ordering in transparent modal & stack nested i…
…n tabs interaction (#2647) ## Description Fixes #2167 The exact error mechanism is **really** convoluted. The gist of it however, and the issue cause lies in the fact that our drawing / container updating logic worked under implicit (and unspoken of) assumption that draw reordering would not be applied for the transaction attaching very first screen in the stack. Everything worked correctly until #2019 caused `needsDrawReordeing` to return `true` **always when `Build.VERSION.SDK_INT > 33`** - and that means pretty much **always** in new apps. Previously it returned `false`, in particular for the very first screen on stack because no one really sets `stackAnimation` for the very first screen, since [it will have no animation anyway](https://github.com/software-mansion/react-native-screens/blob/c0b5586b7e645ed1d22143b5f84e0dd65dcd06be/android/src/main/java/com/swmansion/rnscreens/ScreenStack.kt#L137) (and we might enforce this somewhere in JS code also, I'm not sure now). This PR restores returning `false` there for first screen on the stack & for any screen that uses `animation: 'none'`. ### Summary of the error mechanism Consider following case: ```tsx function App() { return ( <Tabs> <Screen A> <Stack> <Screen SA /> <Screen TM /> </Stack> </Screen A> <Screen B /> </Tabs> ); } ``` Initially `Screen SA` is rendered. Basically when [`isDetachingCurrentScreen`] was set for the very first screen (directly because return value of `needsDrawReordeing`) and then we navigated to other tab `Screen B` - we cause whole stack `Stack` to be dropped & detached from window. Native callback `onDetachedFromWindow` gets called in `ScreenContainer`, we detach every fragment and subview (to prevent whole different class of bugs) causing `removeView` callbacks in `ScreenStack`, leading to `reverseLastTwoChildren` flag being set to `true`. When we then change tab back to `Screen SA` in `Stack` the drawing works as normal, because we have only one child. On navigation to `Screen TM` (transparent modal) value of the `reverseLastTwoChildren` flag causes the views to being drawn in wrong order - transparent modal first and `Screen SA` second. In case of not `transparent` presentation there is no issue, because `Screen SA` would get [detached](https://github.com/software-mansion/react-native-screens/blob/c0b5586b7e645ed1d22143b5f84e0dd65dcd06be/android/src/main/java/com/swmansion/rnscreens/ScreenStack.kt#L113-L115). ## Changes Added param to `needsDrawReordeing` method informing of actual stack animation in use (in case of first screen we always set it to `none`). When there is no animation for the disappearing screen - there is no need to change the draw ordering. Added appropriate code comment for the future. ## Test code and steps to reproduce `Test2167` ## Checklist - [x] Included code example that can be used to test this change - [x] Ensured that CI passes
Configuration menu - View commit details
-
Copy full SHA for ec7afd0 - Browse repository at this point
Copy the full SHA ec7afd0View commit details -
Configuration menu - View commit details
-
Copy full SHA for a8f1be3 - Browse repository at this point
Copy the full SHA a8f1be3View commit details
Commits on Jan 29, 2025
-
chore: bump react-navigation submodule version (#2658)
## Description Bumping to current main: bddcc44ab0e0ad5630f7ee0feb69496412a00217  ## Test code and steps to reproduce Examples should work as usual. ## Checklist - [x] Ensured that CI passes
Configuration menu - View commit details
-
Copy full SHA for 8982286 - Browse repository at this point
Copy the full SHA 8982286View commit details
Commits on Jan 31, 2025
-
Configuration menu - View commit details
-
Copy full SHA for a8ae962 - Browse repository at this point
Copy the full SHA a8ae962View commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff 4.5.0...4.6.0