diff --git a/docs/windowsbrush-and-theme.md b/docs/windowsbrush-and-theme.md index a78c6e1d0..1408ef410 100644 --- a/docs/windowsbrush-and-theme.md +++ b/docs/windowsbrush-and-theme.md @@ -55,11 +55,11 @@ class MyAppClass extends Component { }; componentDidMount() { - Appearance.addChangeListener(this.onAppThemeChanged); + this._subscription = Appearance.addChangeListener(this.onAppThemeChanged); }; componentWillUnmount() { - Appearance.addChangeListener(this.onAppThemeChanged); + this._subscription?.remove(); }; onAppThemeChanged = (theme) => {