New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-native-tvfocus

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-tvfocus

React Native tvOS and Android TV library to improve focus management with multiple screens.

latest
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

React Native TV Focus Manager

React Native tvOS and Android TV library to improve focus management with multiple screens.

Usage

Each screen should be wrapped in a FocusContext, which uses an active prop to set if any focusable items should be focusable.

All focusable items should be wrapped in a Focusable component. React Native's Pressable, TouchableHighlight, TouchableOpacity, TouchableNativeFeedback, TouchableWithoutFeedback and Button components can be replaced with components from this library.

import React = require('react');
import { View } from 'react-native';
import { FocusContext, Button } from 'react-native-tvfocus';
import { NavigationContainer, useIsFocused } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';

function HomeScreen() {
    const active = useIsFocused();

    return <FocusContext active={active}>
        <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
            <Text>Home Screen</Text>
            <Button onPress={() => {}}>Button</Button>
        </View>
    </FocusContext>;
}

const Stack = createStackNavigator();

export default function App() {
    return <NavigationContainer>
        <Stack.Navigator>
            <Stack.Screen name="Home" component={HomeScreen} />
        </Stack.Navigator>
    </NavigationContainer>;
}

Keywords

react-native

FAQs

Package last updated on 12 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts