Skip to content

Commit 614f538

Browse files
HariniMalothu17Harini Malothu
andauthored
Fix doc with right unmounting call (#1151)
## Description Prevented a bug in documentation where during unmounting the listeners were not being cleared. ### Why What is the motivation for this change? Add a few sentences describing the context and overall goals of the pull request's commits. Resolves #997 ## Screenshots Add any relevant screen captures here from before or after your changes. ###### Microsoft Reviewers: [Open in CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/microsoft/react-native-windows-samples/pull/1151) Co-authored-by: Harini Malothu <hmalothu@microsoft.com>
1 parent 8738ee9 commit 614f538

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/windowsbrush-and-theme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ class MyAppClass extends Component {
5555
};
5656

5757
componentDidMount() {
58-
Appearance.addChangeListener(this.onAppThemeChanged);
58+
this._subscription = Appearance.addChangeListener(this.onAppThemeChanged);
5959
};
6060

6161
componentWillUnmount() {
62-
Appearance.addChangeListener(this.onAppThemeChanged);
62+
this._subscription?.remove();
6363
};
6464

6565
onAppThemeChanged = (theme) => {

0 commit comments

Comments
 (0)