NoriginMedia / Norigin-Spatial-Navigation

React Hooks based Spatial Navigation (Key & Remote Control Navigation) / Web Browsers, Smart TVs and Connected TVs
MIT License
306 stars 91 forks source link

[Feature] webOS Magic Remote support #17

Closed WEDOBROADCAST closed 2 years ago

WEDOBROADCAST commented 2 years ago

Currently it can run in webOS but only support remote navigational keypad. It will be great if it can support LG magic remote pointer as well.

Thanks

predikament commented 2 years ago

@WEDOBROADCAST: Hello!

We support applications across a wide range of WebOS devices using this library and have seen no need to add anything special to enable interfacing using the LG Magic Remote.

Making this work is as simple as making your element steal the focus when the mouse hovers over it (f.ex. using onMouseEnter):

import React from 'react';
import {useFocusable} from '@noriginmedia/norigin-spatial-navigation';

export default ThisIsFocusableWithTheWebOSMagicRemote = ({onPress}) => {
  const {ref, focused, focusSelf} = useFocusable({
    onEnterPress: onPress
  });

  return (
    <div class={`${focused ? 'focused' : ''}`} onMouseEnter={focusSelf} />
  );
};

As such I do not see the need for this issue and will close it accordingly. Best of luck and happy coding!

saurav-bhagat commented 1 month ago

Hi @WEDOBROADCAST Did this work?

@predikament In my application, I have given these events:

onMouseOver={() => console.log('>>>> MouseOver 3')}
onMouseEnter={() => console.log('>>>>> Mouse Enter3')}
onMouseDownCapture={() => console.log('>>>>> Mouse Down3')}

Tried this in div as well as button element, but not getting these logs in the console when I take the magic remote cursor to these element. Am I missing something?

predikament commented 1 month ago

@saurav-bhagat: Hello!

I am not sure how your code is relevant to the library, as you are binding directly to the callback handlers in your div element?

But yes, for handling focus of elements (divs) this library works on WebOS and is used in production in lots of applications, on many model years of WebOS devices and other Smart TV platforms.

This is a pretty old thread - If you have any new questions or issues it might be better to open a new one.

Best of luck to you.

saurav-bhagat commented 1 month ago

Sure, thanks.