Skip to content

Commit 0228eca

Browse files
authored
feat(windows): accessibilityLabel support (#805)
* added accessibilityLabel support for windows * reverted unwanted changes * resolve linting error * fixing linting
1 parent 4770080 commit 0228eca

File tree

5 files changed

+9
-0
lines changed

5 files changed

+9
-0
lines changed

src/datetimepicker.windows.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export default function RNDateTimePickerQWE(
3939
sharedPropsValidation({value: props?.value});
4040

4141
const localProps = {
42+
accessibilityLabel: props.accessibilityLabel,
4243
dayOfWeekFormat: props.dayOfWeekFormat,
4344
dateFormat: props.dateFormat,
4445
firstDayOfWeek: props.firstDayOfWeek,

src/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ export type WindowsNativeProps = Readonly<
211211
timeZoneOffsetInSeconds?: number;
212212
is24Hour?: boolean;
213213
minuteInterval?: number;
214+
accessibilityLabel?: string;
214215
}
215216
>;
216217

src/types.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,4 +254,5 @@ export type WindowsNativeProps = $ReadOnly<{|
254254
timeZoneOffsetInSeconds?: number,
255255
is24Hour?: boolean,
256256
minuteInterval?: number,
257+
accessibilityLabel?: string,
257258
|}>;

windows/DateTimePickerWindows/DateTimePickerView.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ namespace winrt::DateTimePicker::implementation {
110110
m_timeZoneOffsetInSeconds = propertyValue.AsInt64();
111111
}
112112
}
113+
else if (propertyName == "accessibilityLabel") {
114+
if (!propertyValue.IsNull()) {
115+
this->Name(to_hstring(propertyValue.AsString()));
116+
}
117+
}
113118
}
114119

115120
if (updateMaxDate) {

windows/DateTimePickerWindows/DateTimePickerViewManager.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ namespace winrt::DateTimePicker::implementation {
3939
IMapView<hstring, ViewManagerPropertyType> DateTimePickerViewManager::NativeProps() noexcept {
4040
auto nativeProps = winrt::single_threaded_map<hstring, ViewManagerPropertyType>();
4141

42+
nativeProps.Insert(L"accessibilityLabel", ViewManagerPropertyType::String);
4243
nativeProps.Insert(L"dayOfWeekFormat", ViewManagerPropertyType::String);
4344
nativeProps.Insert(L"dateFormat", ViewManagerPropertyType::String);
4445
nativeProps.Insert(L"firstDayOfWeek", ViewManagerPropertyType::Number);

0 commit comments

Comments
 (0)