Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation based on focus #8

Open
raphamorim opened this issue Jul 10, 2018 · 3 comments
Open

Navigation based on focus #8

raphamorim opened this issue Jul 10, 2018 · 3 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@raphamorim
Copy link
Owner

Following similar patterns of https://medium.com/netflix-techblog/pass-the-remote-user-input-on-tv-devices-923f6920c9a8 and https://github.com/react-tv/react-tv-navigation

draft api:

import { Text, withFocusable, withNavigation } from 'react-ape'

const Item = ({focused, setFocus, focusPath}) => {
  focused = (focused) ? 'focused' : 'unfocused'
  return (
    <Text onClick={() => { setFocus() }} >
      It's {focused} Item
    </Text>
  )
}
@raphamorim raphamorim added this to the 0.1.0 milestone Jul 10, 2018
@raphamorim
Copy link
Owner Author

cc @fabiomcosta

@fabiomcosta
Copy link
Contributor

fabiomcosta commented Jul 13, 2018

My suggestion:

import { Text, withFocus } from 'react-ape';

const Item = ({focusPath}) => {
  const style = focused ? { outline: '1px solid blue' } : {};
  return (
    <Text style={style}>
      Its {focused} Item
    </Text>
  )
}

export default withFocus(Item);
import { FocusableItem } from './FocusableItem'

class Navigation extends React.Component {
  render() {
    return (
      <FocusableItem focused={ true }>
        Tshow
      </FocusableItem>
    );
  }
}

@raphamorim
Copy link
Owner Author

Resolution in #12

@raphamorim raphamorim reopened this Jun 9, 2022
@raphamorim raphamorim self-assigned this Jun 9, 2022
@raphamorim raphamorim added the enhancement New feature or request label Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Status: In Progress
Development

No branches or pull requests

2 participants