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

Apple TV: Enter key is not responding after updating to expo 52 #177

Open
idreesAJ opened this issue Jan 13, 2025 · 0 comments
Open

Apple TV: Enter key is not responding after updating to expo 52 #177

idreesAJ opened this issue Jan 13, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@idreesAJ
Copy link

Describe the bug
I am using SpatialNavigationFocusableView and onSelect is not responding for Apple TV after updating to Expo 52. It still works fine for Android TV.
The strange thing is it does not emit anything for enter, also verified in handleKeyDown in RemoteControlManager

To Reproduce

<SpatialNavigationRoot
      isActive={true}
      onDirectionHandledWithoutMovement={onDirectionHandledWithoutMovement}
    >
      <View style={styles.container}>
        <View style={styles.buttonContainer}>
          <SpatialNavigationNode>
            {pressableButton('Disagree')}
          </SpatialNavigationNode>
          <SpatialNavigationNode>
            {pressableButton('Agree')}
          </SpatialNavigationNode>
        </View>
      </View>
    </SpatialNavigationRoot>


const pressableButton = (buttonName: consentTypes) => {
    const button = 
    <SpatialNavigationFocusableView
      onSelect={() => {
        console.log('Enter key recognized for:', buttonName);
        handleConsentChoice(buttonName);
      }}
      onFocus={() => {
        console.log('Focused on:', buttonName);
        
      }}
      onLongSelect={() => {
        console.log('Long press recognized for:', buttonName);
      }}
    >
      {({ isFocused }) => (
        <View
          style={[styles.button, isFocused && styles.focusedButton]}
        >
          <Text style={[styles.buttonText, isFocused && styles.focusedButtonText]}>{buttonName}</Text>
        </View>
      )}
    </SpatialNavigationFocusableView>;

    return buttonName === 'Agree' ? <DefaultFocus>{button}</DefaultFocus> : button;
  };

Expected behavior
Clicking enter on remote it should come in onSelect

Version and OS

  • react-tv-space-navigation: 5.10
  • react-native": "npm:react-native-tvos@~0.76.3-0
  • expo: 52.0.16
  • OS [e.g. Apple TV]

Additional context
Add any other context about the problem here.

@idreesAJ idreesAJ added the bug Something isn't working label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant