Fix accessibilityElement accessibility frame
Summary: Changelog: [internal] `accessibilityElement.accessibilityFrame` returns CGRect in screen's coordinate space. Screen coordinate space changes whenever user scrolls. Therefore they have to be computed whenever on demand rather than precomputed. Reviewed By: mdvacca Differential Revision: D27118793 fbshipit-source-id: c48a2b9fc3f25b6ae797104371a2627193f4f79a
This commit is contained in:
Родитель
dbf5fa2d1a
Коммит
729c6d2f41
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface RCTAccessibilityElement : UIAccessibilityElement
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#import "RCTAccessibilityElement.h"
|
||||
|
||||
@implementation RCTAccessibilityElement
|
||||
|
||||
- (CGRect)accessibilityFrame
|
||||
{
|
||||
UIView *container = (UIView *)self.accessibilityContainer;
|
||||
return UIAccessibilityConvertFrameToScreenCoordinates(container.bounds, container);
|
||||
}
|
||||
|
||||
@end
|
|
@ -13,6 +13,7 @@
|
|||
#import <react/renderer/textlayoutmanager/RCTTextLayoutManager.h>
|
||||
#import <react/renderer/textlayoutmanager/TextLayoutManager.h>
|
||||
|
||||
#import "RCTAccessibilityElement.h"
|
||||
#import "RCTConversions.h"
|
||||
#import "RCTFabricComponentsPlugins.h"
|
||||
#import "RCTLocalizationProvider.h"
|
||||
|
@ -61,7 +62,8 @@ using namespace facebook::react;
|
|||
accessibilityLabel = RCTNSStringFromString(_attributedString.getString());
|
||||
}
|
||||
// add first element has the text for the whole textview in order to read out the whole text
|
||||
UIAccessibilityElement *firstElement = [[UIAccessibilityElement alloc] initWithAccessibilityContainer:_view];
|
||||
UIAccessibilityElement *firstElement =
|
||||
[[RCTAccessibilityElement alloc] initWithAccessibilityContainer:_view.superview];
|
||||
firstElement.isAccessibilityElement = YES;
|
||||
firstElement.accessibilityTraits = UIAccessibilityTraitStaticText;
|
||||
firstElement.accessibilityLabel = accessibilityLabel;
|
||||
|
|
Загрузка…
Ссылка в новой задаче