Page MenuHomePhabricator

[native] Move onTipContainerLayout
ClosedPublic

Authored by inka on Aug 5 2024, 6:05 AM.
Tags
None
Referenced Files
F3193578: D12980.id43344.diff
Fri, Nov 8, 11:06 PM
Unknown Object (File)
Fri, Nov 8, 12:24 PM
Unknown Object (File)
Wed, Nov 6, 11:17 PM
Unknown Object (File)
Sun, Nov 3, 10:10 PM
Unknown Object (File)
Sun, Nov 3, 10:10 PM
Unknown Object (File)
Sun, Nov 3, 9:54 PM
Unknown Object (File)
Fri, Oct 18, 9:47 PM
Unknown Object (File)
Fri, Oct 18, 9:38 PM
Subscribers

Details

Summary

issue: ENG-8914
Refactoring from class to function

Test Plan

Tested by creating a nux tooltip and displaying it - still works

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

inka requested review of this revision.Aug 5 2024, 8:21 AM
native/tooltip/nux-tips-overlay.react.js
300 ↗(On Diff #43115)

It's a bit hacky to use a useMemo for this. I think the usual "best practice" is that an instance variable from a class component becomes a useRef in a function component. This is functionally the same in our configuration of React, but it might become more important in "concurrent mode", if we ever enable that (might be related to React Native "new architecture")

tomek added inline comments.
native/tooltip/nux-tips-overlay.react.js
300 ↗(On Diff #43115)

Another reason for using ref here is that we usually assume that values returned by memos are immutable. The value that we have here can mutate without its reference being changed, which is confusing.

319 ↗(On Diff #43115)

We should make the dependencies more specific.

This revision is now accepted and ready to land.Aug 6 2024, 2:25 AM
This revision was automatically updated to reflect the committed changes.