react-native-windows-samples icon indicating copy to clipboard operation
react-native-windows-samples copied to clipboard

Possible bug in example code

Open pedro-w opened this issue 1 year ago • 2 comments

In this snippet https://github.com/microsoft/react-native-windows-samples/blob/fd8310144083733eec02d1dde18032aea02f6faa/docs/windowsbrush-and-theme.md?plain=1#L53-L59 is it correct to call addChangeListener in response to componentDidMount and componentWillUnmount?

pedro-w avatar Nov 28 '24 09:11 pedro-w

Yep, that's wrong. Should be a removeChangeListener. Whoops!

chrisglein avatar Dec 02 '24 18:12 chrisglein

I'm just learning so apologies, but in the 'not-Windows' React Native there is no removeChangeListener https://reactnative.dev/docs/appearance

and in the Windows codebase there is addListener and removeListeners with an 's'. https://github.com/microsoft/react-native-windows/blob/b051774f5429ed49df69e0b85ae16cfae8c18922/vnext/codegen/NativeAppearanceSpec.g.h#L17

Is that relevant?

pedro-w avatar Dec 02 '24 19:12 pedro-w