mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix accessibilityRole prop parsing
Summary: During the refactor in D36889794 (https://github.com/facebook/react-native/commit/782e004e4943194c40f2fb15527fe99a61f69b88) and later D37050215 (https://github.com/facebook/react-native/commit/47280de85e62f33f0b97bc1ed7c83bc6ca0dc7d4) this block of code was erroneously deleted; add it back, because if the props iterator setter is disabled, nothing sets this property anymore. Changelog: [Internal] Reviewed By: ryancat, nscoding Differential Revision: D37539700 fbshipit-source-id: 0850180721e0549fed6089cb278402c56eb9d627
This commit is contained in:
1 parent
4f93f63f54
commit
b30ad9a77d
1 file changed
+24
-1
@@ -166,7 +166,30 @@ AccessibilityProps::AccessibilityProps(
|
||||
rawProps,
|
||||
"testID",
|
||||
sourceProps.testId,
|
||||
"")) {}
|
||||
"")) {
|
||||
// It is a (severe!) perf deoptimization to request props out-of-order.
|
||||
// Thus, since we need to request the same prop twice here
|
||||
// (accessibilityRole) we "must" do them subsequently here to prevent
|
||||
// a regression. It is reasonable to ask if the `at` function can be improved;
|
||||
// it probably can, but this is a fairly rare edge-case that (1) is easy-ish
|
||||
// to work around here, and (2) would require very careful work to address
|
||||
// this case and not regress the more common cases.
|
||||
if (!enablePropIteratorSetter) {
|
||||
const auto *rawPropValue =
|
||||
rawProps.at("accessibilityRole", nullptr, nullptr);
|
||||
AccessibilityTraits traits;
|
||||
std::string roleString;
|
||||
if (rawPropValue == nullptr || !rawPropValue->hasValue()) {
|
||||
traits = AccessibilityTraits::None;
|
||||
roleString = "";
|
||||
} else {
|
||||
fromRawValue(context, *rawPropValue, traits);
|
||||
fromRawValue(context, *rawPropValue, roleString);
|
||||
}
|
||||
accessibilityTraits = traits;
|
||||
accessibilityRole = roleString;
|
||||
}
|
||||
}
|
||||
|
||||
void AccessibilityProps::setProp(
|
||||
const PropsParserContext &context,
|
||||
|
||||
Reference in new issue
Block a user