Skip to content

Commit

Permalink
feat(windows): accessibilityLabel support (#805)
Browse files Browse the repository at this point in the history
* added accessibilityLabel support for windows

* reverted unwanted changes

* resolve linting error

* fixing linting
  • Loading branch information
YajurG authored Sep 18, 2023
1 parent 4770080 commit 0228eca
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/datetimepicker.windows.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export default function RNDateTimePickerQWE(
sharedPropsValidation({value: props?.value});

const localProps = {
accessibilityLabel: props.accessibilityLabel,
dayOfWeekFormat: props.dayOfWeekFormat,
dateFormat: props.dateFormat,
firstDayOfWeek: props.firstDayOfWeek,
Expand Down
1 change: 1 addition & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ export type WindowsNativeProps = Readonly<
timeZoneOffsetInSeconds?: number;
is24Hour?: boolean;
minuteInterval?: number;
accessibilityLabel?: string;
}
>;

Expand Down
1 change: 1 addition & 0 deletions src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,4 +254,5 @@ export type WindowsNativeProps = $ReadOnly<{|
timeZoneOffsetInSeconds?: number,
is24Hour?: boolean,
minuteInterval?: number,
accessibilityLabel?: string,
|}>;
5 changes: 5 additions & 0 deletions windows/DateTimePickerWindows/DateTimePickerView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ namespace winrt::DateTimePicker::implementation {
m_timeZoneOffsetInSeconds = propertyValue.AsInt64();
}
}
else if (propertyName == "accessibilityLabel") {
if (!propertyValue.IsNull()) {
this->Name(to_hstring(propertyValue.AsString()));
}
}
}

if (updateMaxDate) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ namespace winrt::DateTimePicker::implementation {
IMapView<hstring, ViewManagerPropertyType> DateTimePickerViewManager::NativeProps() noexcept {
auto nativeProps = winrt::single_threaded_map<hstring, ViewManagerPropertyType>();

nativeProps.Insert(L"accessibilityLabel", ViewManagerPropertyType::String);
nativeProps.Insert(L"dayOfWeekFormat", ViewManagerPropertyType::String);
nativeProps.Insert(L"dateFormat", ViewManagerPropertyType::String);
nativeProps.Insert(L"firstDayOfWeek", ViewManagerPropertyType::Number);
Expand Down

0 comments on commit 0228eca

Please sign in to comment.