Closed
Description
Describe the Feature
Currently different types of queries can return either host or composite elements:
Queries returning host components (
typeof node.type === 'string'
):
testId
: host, matched by normalisedtestID
proprole
: host, matched byaccessibilityRole
prophintText
: host, matched byaccessibilityHint
proplabelText
: host, matched byaccessibilityLabel
propa11yState
: host, matched byaccessibilityState
propa11yValue
: host, matched byaccessibilityValue
propQueries returning composite components:
text
: compositeText
from RN, matched by normalised and flattenedchildren
propdisplayValue
: compositeTextInput
from RN, matched by normalisedvalue
ordefaultValue
propplaceholderText
: compositeTextInput
from RN, matched by normalisedplaceholder
propQueries returning either host or composite components:
UNSAFE_byType
: either host or composite, matched byelement.type
which can be eitherstring
or component typeUNSAFE_byProps
: either host or composite, matched byelement.props
overlap
The goal of this feature request is to make text
, displayValue
& placeholderText
return host components. This is probably a breaking change for our users so it should warrant a major release.
Possible Implementations
Use component-tree.ts
functions from #1128 to get single host child of found composite Text
and TextInput
components from React Native.