Page MenuHomePhabricator

[native] Fix `removeEventListener` deprecation warn
ClosedPublic

Authored by bartek on Oct 18 2022, 12:10 AM.
Tags
None
Referenced Files
F3254277: D5386.id17633.diff
Fri, Nov 15, 7:37 PM
F3251482: D5386.diff
Fri, Nov 15, 5:36 PM
Unknown Object (File)
Sat, Nov 2, 8:40 PM
Unknown Object (File)
Sat, Oct 19, 8:24 AM
Unknown Object (File)
Fri, Oct 18, 9:03 PM
Unknown Object (File)
Oct 6 2024, 9:03 PM
Unknown Object (File)
Oct 6 2024, 9:03 PM
Unknown Object (File)
Sep 10 2024, 1:56 PM
Subscribers

Details

Summary

In React Native 0.66, all removeEventListener() functions became deprecated in favor of subscription.remove() obtained by subscription = addEventListener().

Simulator Screen Shot - iPhone 14 Pro - 2022-10-17 at 08.25.56.png (2×1 px, 274 KB)

In our app lifecycle listener we have already been following the new pattern, by creating our own facade for the EventSubscription. It is now no longer needed, as we can return the React Native subscription object directly.

I'm going to need this interface in my height measurement stuff, so I'm fixing this ahead of time.

Test Plan
  • Ran the native app and confirmed this warn doesn't show up anymore
  • Confirmed with debugger that listener subscription is removed properly

Diff Detail

Repository
rCOMM Comm
Branch
@barthap/listener-warn
Lint
No Lint Coverage
Unit
No Test Coverage