Skip to content

Commit

Permalink
Add accessibilityLabel support (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
YajurG authored Dec 12, 2023
1 parent 4917b06 commit 0e6a959
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions js/ProgressView.windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const styles = StyleSheet.create({

export default function ProgressViewWindows(props: WindowsNativeProps) {
const nativeProps = {
accessibilityLabel: props.accessibilityLabel,
testID: props.testID,
progressViewStyle: props.progressViewStyle,
progress: props.progress,
Expand Down
2 changes: 2 additions & 0 deletions js/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@ export type ProgressViewProps = ViewProps & {
* A stretchable image to display behind the progress bar.
*/
trackImage?: ImageSourcePropType,

accessibilityLabel?: String,
};
export class ProgressView extends React.Component<ProgressViewProps> {}
5 changes: 5 additions & 0 deletions windows/progress-view/ProgressViewView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ namespace winrt::progress_view::implementation {
else if (propertyName == "isIndeterminate") {
this->IsIndeterminate(propertyValue.AsBoolean());
}
else if (propertyName == "accessibilityLabel") {
if (!propertyValue.IsNull()) {
this->Name(to_hstring(propertyValue.AsString()));
}
}
else if (propertyName == "progressImage") {
if (!propertyValue.IsNull()) {
auto imgUriString = propertyValue.AsObject()["uri"].AsString();
Expand Down
1 change: 1 addition & 0 deletions windows/progress-view/ProgressViewViewManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ namespace winrt::progress_view::implementation {
// IViewManagerWithNativeProperties
IMapView<hstring, ViewManagerPropertyType> ProgressViewViewManager::NativeProps() noexcept {
auto nativeProps = winrt::single_threaded_map<hstring, ViewManagerPropertyType>();
nativeProps.Insert(L"accessibilityLabel", ViewManagerPropertyType::String);
nativeProps.Insert(L"progress", ViewManagerPropertyType::Number);
nativeProps.Insert(L"progressTintColor", ViewManagerPropertyType::Color);
nativeProps.Insert(L"trackTintColor", ViewManagerPropertyType::Color);
Expand Down

0 comments on commit 0e6a959

Please sign in to comment.