Skip to content

Commit

Permalink
fix(EventListener): do not use defaultProps (microsoft#28725)
Browse files Browse the repository at this point in the history
* fix(EventListener): do not use `defaultProps`

* add changelog
  • Loading branch information
layershifter authored Aug 3, 2023
1 parent 44b1282 commit 595d43b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/fluentui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- `Input`: Remove wrong recommendation - usage of role="search" #28168 @kolaps33 ([#28168](https://github.com/microsoft/fluentui/pull/28168))

### Fixes
- Do not use `defaultProps` in `EventListener` to avoid deprecation warnings. @layershifter ([#28725](https://github.com/microsoft/fluentui/pull/28725))
- `Datepicker`: add onCalendarOpenStateChange prop. @jurokapsiar ([#28136](https://github.com/microsoft/fluentui/pull/28136))
- Outline color now respects OS force colors settings. @george-cz ([#28182](https://github.com/microsoft/fluentui/pull/28182))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { useEventListener } from './useEventListener';
import { EventListenerOptions, EventTypes } from './types';

export function EventListener<T extends EventTypes>(props: EventListenerOptions<T>) {
useEventListener(props);
export function EventListener<T extends EventTypes>({
listener,
type,
capture = false,
targetRef,
target,
}: EventListenerOptions<T>) {
useEventListener({ listener, type, capture, targetRef, target });

return null;
}

EventListener.defaultProps = {
capture: false,
};

0 comments on commit 595d43b

Please sign in to comment.