AccessibilityFocus.android.js 920 Bytes
Newer Older
Antonio Pugliese's avatar
Antonio Pugliese committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
/* This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. */

import React from 'react';
import {requireNativeComponent, ViewPropTypes} from 'react-native';

const iface = {
  name: 'AccessibilityFocus',
  propTypes: {
    ...ViewPropTypes, // include the default view properties
  },
};

const emptyFn = (_) => _;

const RNAccessibilityFocus = requireNativeComponent(
  'AccessibilityFocus',
  iface,
);

export default class AndroidAccessibleImage extends React.Component {
  render() {
    return (
      <RNAccessibilityFocus
        style={{...this.props.style}}
        onAccessibilityFocusStart={
          this.props.onFocusStart ? this.props.onFocusStart : emptyFn
        }
        onAccessibilityFocusEnd={
          this.props.onFocusEnd ? this.props.onFocusEnd : emptyFn
        }
      >
        {this.props.children}
      </RNAccessibilityFocus>
    );
  }
}