bbc / lrud

Left, Right, Up, Down. A spatial navigation library for devices with input via directional controls.
Apache License 2.0
98 stars 21 forks source link

Best way to restore default active child when entering / leaving a parent? #59

Open jfrux opened 4 years ago

jfrux commented 4 years ago

When user navigates down to the player controls on TV I'm wanting it to always be on the play/pause button by default but it's currently just focusing the far left.

I'm not sure indexAlign is what I want for this situation but maybe it is?

I didn't understand the indexRange thing as it doesn't seem to make sense for me here since it's technically not a grid, I mean I can think of it like one... but not sure its very expressive.

UPDATE: Part of me wants like... a "willActive" or "beforeActive" to ensure the proper child is active but not sure if that makes sense.

UPDATE 2: If I use onActive of the parent to setActiveChild it doesn't seem to trigger the other events for other children that were previous active such as onLeave or onMove, etc. Maybe I'm missing the entire point of them or something.

jfrux commented 4 years ago

Figured out a solution for this but maybe still something to put in the back of our minds.

Thanks again for all you guys do! :)