Skip to content

Commit

Permalink
fix: remove deprecated event listener method from appearance.js
Browse files Browse the repository at this point in the history
  • Loading branch information
matinzd committed Nov 3, 2021
1 parent b25d9e4 commit 51b7446
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions Libraries/Utilities/Appearance.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ type NativeAppearanceEventDefinitions = {
};

if (NativeAppearance) {
const nativeEventEmitter =
new NativeEventEmitter<NativeAppearanceEventDefinitions>(
// T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior
// If you want to use the native module on other platforms, please remove this condition and test its behavior
Platform.OS !== 'ios' ? null : NativeAppearance,
);
const nativeEventEmitter = new NativeEventEmitter<NativeAppearanceEventDefinitions>(
// T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior
// If you want to use the native module on other platforms, please remove this condition and test its behavior
Platform.OS !== 'ios' ? null : NativeAppearance,
);
nativeEventEmitter.addListener(
'appearanceChanged',
(newAppearance: AppearancePreferences) => {
Expand Down Expand Up @@ -91,12 +90,4 @@ module.exports = {
addChangeListener(listener: AppearanceListener): EventSubscription {
return eventEmitter.addListener('change', listener);
},

/**
* @deprecated Use `remove` on the EventSubscription from `addEventListener`.
*/
removeChangeListener(listener: AppearanceListener): void {
// NOTE: This will report a deprecation notice via `console.error`.
eventEmitter.removeListener('change', listener);
},
};

0 comments on commit 51b7446

Please sign in to comment.