Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ScrollView: handling
testID
correctly for horizontal scroll view (f…
…acebook#48254) Summary: Fixes facebook#46180 This PR fixes the `testID` not being set as a `resource-id` in the `HorizontalScrollView`. Currently the `resource-id` is being set correctly when we use a vertical scroll view (this is done [here](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java#L156) for reference) but we still miss setting this when we use a horizontal one as the managers for both components are different. ## Changelog: [ANDROID][FIXED] - Handling `testID` correctly for horizontal scroll view Pull Request resolved: facebook#48254 Test Plan: Render a simple `ScrollView` component with `horizontal` set as `true` and pass a `testID` property as shown: ```tsx function Playground() { return ( <ScrollView testID="customScrollViewTestId" horizontal> <View style={{ marginVertical: 400, backgroundColor: 'white', padding: 14, margin: 50, width: 200, height: 200, }} /> </ScrollView> ); } ``` Open Maestro Studio and search for **customScrollViewTestId** in the search bar. <details> <summary>Before the fix: The `testID` is not found. (See screenshot)</summary> ![image](https://github.com/user-attachments/assets/9f1c6438-e105-468e-8bf4-4e2238824f9f) </details> <details> <summary>See the same in Appium. (See screenshot)</summary> <img width="900" alt="image" src="https://github.com/user-attachments/assets/4f1a7858-4549-45b2-bb5f-d0b3485e5d69" /> </details> --- Apply this fix, and search again in Maestro Studio. <details> <summary>After the fix: The `testID` is now recognised and can be found in the search bar. (See screenshot)</summary> ![image](https://github.com/user-attachments/assets/371f6d1f-5a41-461b-b276-7c0e702ee1e2) </details> <details> <summary>See the same in Appium. (See screenshot)</summary> <img width="891" alt="image" src="https://github.com/user-attachments/assets/ef03310c-c1ab-4ef7-b2c5-60c3b8d84c10" /> </details> Reviewed By: tdn120, mdvacca Differential Revision: D67201619 Pulled By: javache fbshipit-source-id: 016faf724a482e0eca6dedfbf94dd9ea56255757
- Loading branch information