Thursday, September 29, 2022

[FIXED] How to detect that a TVML lockup loses focus?

Issue

Is there a way to detect that a lockup loses focus when using TVML and TVMLKit JS on tvOS 12?

I know there's a highlight event when something receives focus using the following:

lockupElement.addEventListener("highlight", this.handleHighlight);

I want to handle when the lockup is no longer highlighted. The closest I've found to a solution is to add highlight-events to absolutely every other element and then reset any previously highlighted elements. This seems like a hack and it is also tedious and bug-prone adding it to every other element.

Anyone know of a better method?


Solution

If your lockup element is a custom element created through the extended interface creator you can override the didUpdateFocus(context, coordinator) function in your Swift class.

If it's just a default lockup I think you're out of luck.



Answered By - anders
Answer Checked By - Candace Johnson (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.