Skip to content

Commit

Permalink
Elements no longer focusable on tvOS (#26775)
Browse files Browse the repository at this point in the history
Summary:
This PR fixes broken focus on tvOS due to `isTVSelectable` and `tvParallaxProperties` not being available in validAttributes definition object of ReactNativeViewViewConfig

## Changelog

[ios] [Fixed] - elements no longer focusable on tvOS
Pull Request resolved: #26775

Test Plan:
```
import React from 'react';
import {
    StyleSheet,
    View,
    Text,
    TouchableOpacity
} from 'react-native';

const parallax = {
    enabled: true,
    shiftDistanceY: 2,
    shiftDistanceX: 2,
    tiltAngle: 0.05,
    pressMagnification: 1,
    magnification: 1.1,
};

const Button: () => React$Node = () => (
    <TouchableOpacity style={styles.buttonx} tvParallaxProperties={parallax}>
        <Text>
Touchable Button
        </Text>
    </TouchableOpacity>
);

const App: () => React$Node = () => (
    <View style={styles.wrapper}>
        <Button />
        <Button />
        <Button />
        <Button />
        <Button />
        <Button />
        <Button />
    </View>
);

const styles = StyleSheet.create({
    buttonx: {
        backgroundColor: 'red',
        height: 100,
        width: 500
    },
    wrapper: {
        justifyContent: 'center',
        flex: 1,
        alignItems: 'center'
    }
});

export default App;
```

![Oct-08-2019 12-11-19](https://user-images.githubusercontent.com/4638697/66459930-3d7aa880-ea76-11e9-9b94-686094dc8667.gif)

Differential Revision: D17845058

Pulled By: TheSavior

fbshipit-source-id: b6c71d370efd6cf7763ab3a98bbfe1630f789821
  • Loading branch information
pavjacko authored and facebook-github-bot committed Oct 10, 2019
1 parent 38e36b7 commit b61583a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Libraries/Components/View/ReactNativeViewViewConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ const ReactNativeViewConfig = {
height: true,
hitSlop: {diff: (require('../../Utilities/differ/insetsDiffer'): any)},
importantForAccessibility: true,
isTVSelectable: true,
justifyContent: true,
left: true,
margin: true,
Expand Down Expand Up @@ -334,6 +335,7 @@ const ReactNativeViewConfig = {
transform: {diff: require('../../Utilities/differ/matricesDiffer')},
translateX: true,
translateY: true,
tvParallaxProperties: true,
width: true,
zIndex: true,
},
Expand Down

0 comments on commit b61583a

Please sign in to comment.