From 17553dce844121baab35d253cbb3fbb78f67b1be Mon Sep 17 00:00:00 2001 From: Etienne Lemay Date: Sat, 6 Jan 2024 15:30:26 -0500 Subject: [PATCH] Use `addEventListener` instead of `addListener` See https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList#instance_methods --- packages/emoji-mart/src/components/Picker/Picker.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/emoji-mart/src/components/Picker/Picker.tsx b/packages/emoji-mart/src/components/Picker/Picker.tsx index e35717f3..24cad2e6 100644 --- a/packages/emoji-mart/src/components/Picker/Picker.tsx +++ b/packages/emoji-mart/src/components/Picker/Picker.tsx @@ -127,7 +127,7 @@ export default class Picker extends Component { unregister() { document.removeEventListener('click', this.handleClickOutside) - this.darkMedia?.removeListener(this.darkMediaCallback) + this.darkMedia?.removeEventListener('change', this.darkMediaCallback) this.unobserve() } @@ -207,7 +207,7 @@ export default class Picker extends Component { this.darkMedia = matchMedia('(prefers-color-scheme: dark)') if (this.darkMedia.media.match(/^not/)) return 'light' - this.darkMedia.addListener(this.darkMediaCallback) + this.darkMedia.addEventListener('change', this.darkMediaCallback) } return this.darkMedia.matches ? 'dark' : 'light'