react-native-testing-library
                                
                                 react-native-testing-library copied to clipboard
                                
                                    react-native-testing-library copied to clipboard
                            
                            
                            
                        Design an API for providing custom ByText implementation
Describe the Feature
Right now, we rely on grabbing Text from react-native in *ByText queries. We should make it possible for users to replace it with Text from other libraries, like react-native-windows or react-xp. Or make it possible to extend *ByText queries to have a custom implementation.
Possible Implementations
TBD
What about implementing something similar to the findAll method described here. It was part of the deprecated native-testing-library and was intended to be used as an escape hatch for selecting elements using a custom callback. It seems pretty hacky but it could be of use in these (and future) cases, as RN is supported in more and more environments.
I'm not a fan of findAll as I have a hunch that users will abuse it when not necessary, as they tend to do. That's why we're limiting the APIs in the first place. I'm open to discussion though, it's only my personal opinion :)
TBH I can see how it may do more harm than good. Maybe a stricter API like an extra parameter (e.g. TargetElementType) in *ByText methods would be a safer, more streamlined alternative. Or even a new set of methods e.g *ByCustomText. Just sharing some thoughts as well :)
@thymikee is this feature request still relevant? Seems like if implemented we would be moving outside of React Native domain and more towards something like React Anything/Test Renderer Testing Library. In such case maybe we should consider extracting common Test Render part and build React Native behaviours on top of it.
This is something I had in mind very early in the design process. Thought it may become useful, but so far it didn't prove really necessary. I'm ok to close this ticket and wait for some real use case that users bump into.