RN: Export Accessibility Prop Types

Summary: Exports Flow types for the props related to accessibility.

Reviewed By: fkgozali

Differential Revision: D4498562

fbshipit-source-id: 2fb6e78d4ceaf9f26b6ea88d515b7b28f570de52
This commit is contained in:
Tim Yung 2017-02-02 23:27:24 -08:00 committed by Facebook Github Bot
parent b053fd5bdd
commit 778cf289a8
2 changed files with 72 additions and 29 deletions

View File

@ -23,6 +23,11 @@ const ViewStylePropTypes = require('ViewStylePropTypes');
const invariant = require('fbjs/lib/invariant');
const {
AccessibilityComponentTypes,
AccessibilityTraits,
} = require('ViewAccessibility');
var TVViewPropTypes = {};
if (Platform.isTVOS) {
TVViewPropTypes = require('TVViewPropTypes');
@ -34,39 +39,12 @@ const PropTypes = React.PropTypes;
const stylePropType = StyleSheetPropType(ViewStylePropTypes);
const AccessibilityTraits = [
'none',
'button',
'link',
'header',
'search',
'image',
'selected',
'plays',
'key',
'text',
'summary',
'disabled',
'frequentUpdates',
'startsMedia',
'adjustable',
'allowsDirectInteraction',
'pageTurn',
];
const AccessibilityComponentType = [
'none',
'button',
'radiobutton_checked',
'radiobutton_unchecked',
];
const forceTouchAvailable = (NativeModules.IOSConstants &&
NativeModules.IOSConstants.forceTouchAvailable) || false;
const statics = {
AccessibilityTraits,
AccessibilityComponentType,
AccessibilityComponentType: AccessibilityComponentTypes,
/**
* Is 3D Touch / Force Touch available (i.e. will touch events include `force`)
* @platform ios
@ -169,7 +147,7 @@ const View = React.createClass({
*
* @platform android
*/
accessibilityComponentType: PropTypes.oneOf(AccessibilityComponentType),
accessibilityComponentType: PropTypes.oneOf(AccessibilityComponentTypes),
/**
* Indicates to accessibility services whether the user should be notified

View File

@ -0,0 +1,65 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ViewAccessibility
* @flow
*/
'use strict';
export type AccessibilityTrait =
'none' |
'button' |
'link' |
'header' |
'search' |
'image' |
'selected' |
'plays' |
'key' |
'text' |
'summary' |
'disabled' |
'frequentUpdates' |
'startsMedia' |
'adjustable' |
'allowsDirectInteraction' |
'pageTurn';
export type AccessibilityComponentType =
'none' |
'button' |
'radiobutton_checked' |
'radiobutton_unchecked';
module.exports = {
AccessibilityTraits: [
'none',
'button',
'link',
'header',
'search',
'image',
'selected',
'plays',
'key',
'text',
'summary',
'disabled',
'frequentUpdates',
'startsMedia',
'adjustable',
'allowsDirectInteraction',
'pageTurn',
],
AccessibilityComponentTypes: [
'none',
'button',
'radiobutton_checked',
'radiobutton_unchecked',
],
};