In React Native, a phenomenon has been observed where the UI tree becomes excessively deep, making it impossible to create tests for some apps affected by this issue. Specifically, elements located at a depth of 50 or more in the UI tree cannot be retrieved as UI elements by MagicPod, due to limitations in the XCTest library and Appium.
Also, in React Native versions 0.71.0 - 0.71.11, deep trees may be generated on Android, and MagicPod may fail to retrieve the elements. (Related React Native issue for Android)
As a workaround for the above phenomenon, the following methods can be used in the app to prevent the generation of a deep UI tree:
- Implement in a way that reduces nesting, thereby preventing the generation of a deep UI tree.
- Generate the app with the new architecture of React Native enabled. (However, this is currently not recommended as the stable version has not been released yet, and the release schedule is uncertain.)
- For Android, use a React Native version other than 0.71.0 - 0.71.11.