Skip to content

Commit 0e6a959

Browse files
authored
Add accessibilityLabel support (#144)
1 parent 4917b06 commit 0e6a959

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

js/ProgressView.windows.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const styles = StyleSheet.create({
2020

2121
export default function ProgressViewWindows(props: WindowsNativeProps) {
2222
const nativeProps = {
23+
accessibilityLabel: props.accessibilityLabel,
2324
testID: props.testID,
2425
progressViewStyle: props.progressViewStyle,
2526
progress: props.progress,

js/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,7 @@ export type ProgressViewProps = ViewProps & {
3131
* A stretchable image to display behind the progress bar.
3232
*/
3333
trackImage?: ImageSourcePropType,
34+
35+
accessibilityLabel?: String,
3436
};
3537
export class ProgressView extends React.Component<ProgressViewProps> {}

windows/progress-view/ProgressViewView.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ namespace winrt::progress_view::implementation {
5151
else if (propertyName == "isIndeterminate") {
5252
this->IsIndeterminate(propertyValue.AsBoolean());
5353
}
54+
else if (propertyName == "accessibilityLabel") {
55+
if (!propertyValue.IsNull()) {
56+
this->Name(to_hstring(propertyValue.AsString()));
57+
}
58+
}
5459
else if (propertyName == "progressImage") {
5560
if (!propertyValue.IsNull()) {
5661
auto imgUriString = propertyValue.AsObject()["uri"].AsString();

windows/progress-view/ProgressViewViewManager.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ namespace winrt::progress_view::implementation {
3737
// IViewManagerWithNativeProperties
3838
IMapView<hstring, ViewManagerPropertyType> ProgressViewViewManager::NativeProps() noexcept {
3939
auto nativeProps = winrt::single_threaded_map<hstring, ViewManagerPropertyType>();
40+
nativeProps.Insert(L"accessibilityLabel", ViewManagerPropertyType::String);
4041
nativeProps.Insert(L"progress", ViewManagerPropertyType::Number);
4142
nativeProps.Insert(L"progressTintColor", ViewManagerPropertyType::Color);
4243
nativeProps.Insert(L"trackTintColor", ViewManagerPropertyType::Color);

0 commit comments

Comments
 (0)