setDefaultOptions backButton testID and accessibilityLabel do not work as expected
🐛 Bug Report
Passing a testID or accessibilityLabel through defaultOptions does not work as expected. This duplicates https://github.com/wix/react-native-navigation/issues/6669, but hopefully provides more info. If you want, I can look into submitting a PR.
To Reproduce
Navigation.setDefaultOptions({
backButton: {
icon: require('../assets/images/arrowBack.png'),
testID: 'customTestID',
accessibilityLabel: 'customA11yLabel',
},
});
Expected behavior
The custom testID and/or accessibilityLabel show up in Appium. According to the docs, accessibilityLabel is only supported on Android, but testID should work on both platforms.
Actual Behavior
- On iOS, the accessibilityLabel and testID will both be the title of the previous screen (unless there is no title, then it is
'Back'). - On Android, the accessibilityLabel and testID are set to
'Navigate Up'. This makes it very difficult to use it in e2e tests.

A custom testID on a button in topBar.leftButtons or topBar.rightButtons however does show up in Appium.
Your Environment
- React Native Navigation version: 7.11.3
- React Native version: 0.63.4
- Platform(s) (iOS, Android, or both?): Both
- Device info (Simulator/Device? OS version? Debug/Release?): Pixel 3a (Android 11) / iPhone 12 Mini sim (iOS 14.4)
Issue with accessibilityLabel fixed on Android and
- Released 7.22.0
- Diff 7.21.0...7.22.0
Issue with testID on Android fixed in https://github.com/wix/react-native-navigation/pull/7298 (PR in review)
Nice! This is fixed on Android now. On iOS we still cannot configure the a11yLabel or testID. They will always be set to the title of the previous screen (unless there is no title, then it is 'Back').
On iOS we still cannot configure the a11yLabel or testID. They will always be set to the title of the previous screen (unless there is no title, then it is 'Back').
Is there any update on this issue? We are still experiencing this on iOS.