From 5af4b0c7a6d43d11a0e24a8238c597aebf7d533d Mon Sep 17 00:00:00 2001 From: Kacper Kafara Date: Wed, 27 Dec 2023 14:32:59 +0100 Subject: [PATCH] fix(iOS): not working hitslop for headerRight/Left views (#1995) ## Description Since #1825 header config is no longer first child of a screen & `hitTest:withEvent:` method assumed this invariant to be true. Fixed that by using appropriate screen method instead of blind assumption. Fixes #1981 ## Changes * Fixed `hitTest:withEvent:` method by using `findHeaderConfig` `RNSScreenView`'s method * Improved `findHeaderConfig` method itself ## Test code and steps to reproduce `Test1981` ## Checklist - [x] Included code example that can be used to test this change - [x] Ensured that CI passes --- FabricTestExample/App.js | 1 + FabricTestExample/src/Test1981.tsx | 103 +++++++++++++++++++++++++++++ TestsExample/App.js | 1 + TestsExample/src/Test1981.tsx | 103 +++++++++++++++++++++++++++++ ios/RNSScreen.mm | 8 ++- ios/RNSScreenStack.mm | 4 +- 6 files changed, 217 insertions(+), 3 deletions(-) create mode 100644 FabricTestExample/src/Test1981.tsx create mode 100644 TestsExample/src/Test1981.tsx diff --git a/FabricTestExample/App.js b/FabricTestExample/App.js index 4068ef4d05..189443a165 100644 --- a/FabricTestExample/App.js +++ b/FabricTestExample/App.js @@ -90,6 +90,7 @@ import Test1802 from './src/Test1802'; import Test1829 from './src/Test1829'; import Test1844 from './src/Test1844'; import Test1864 from './src/Test1864'; +import Test1981 from './src/Test1981'; enableFreeze(true); diff --git a/FabricTestExample/src/Test1981.tsx b/FabricTestExample/src/Test1981.tsx new file mode 100644 index 0000000000..511c2b6a8c --- /dev/null +++ b/FabricTestExample/src/Test1981.tsx @@ -0,0 +1,103 @@ +import React from 'react'; +import { NavigationContainer, NavigationContext, ParamListBase } from '@react-navigation/native'; +import { createNativeStackNavigator, NativeStackNavigationProp } from '@react-navigation/native-stack'; +import { View, StyleSheet, Button, Pressable, Text } from 'react-native'; + +type NavProp = { + navigation: NativeStackNavigationProp; +}; + +const Stack = createNativeStackNavigator(); + +function FirstScreen({ navigation }: NavProp) { + const navigateToSecond = () => { + navigation.navigate('Second'); + }; + return ( + +