forked from microsoft/fluentui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(EventListener): do not use
defaultProps
(microsoft#28725)
* fix(EventListener): do not use `defaultProps` * add changelog
- Loading branch information
1 parent
44b1282
commit 595d43b
Showing
2 changed files
with
9 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 8 additions & 6 deletions
14
packages/fluentui/react-component-event-listener/src/EventListener.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}; |