From f4fa539b8c736fb58e0356cd3e243ad35323f8af Mon Sep 17 00:00:00 2001 From: Rick Hanlon Date: Thu, 20 Jun 2019 12:30:57 -0700 Subject: [PATCH] Add android view props Summary: Adds the view config props from android Reviewed By: sahrens, shergin Differential Revision: D15925354 fbshipit-source-id: 600dfbd9f77bde3323673c047c4461714d88d9d8 --- .../View/ReactNativeViewViewConfig.js | 4 + .../View/ReactNativeViewViewConfigAndroid.js | 73 +++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 Libraries/Components/View/ReactNativeViewViewConfigAndroid.js diff --git a/Libraries/Components/View/ReactNativeViewViewConfig.js b/Libraries/Components/View/ReactNativeViewViewConfig.js index 2dd83dead04..62b480c7f2d 100644 --- a/Libraries/Components/View/ReactNativeViewViewConfig.js +++ b/Libraries/Components/View/ReactNativeViewViewConfig.js @@ -9,6 +9,7 @@ */ 'use strict'; +import ReactNativeViewViewConfigAndroid from './ReactNativeViewViewConfigAndroid'; const ReactNativeViewConfig = { uiViewClassName: 'RCTView', @@ -17,6 +18,7 @@ const ReactNativeViewConfig = { Commands: {}, Constants: {}, bubblingEventTypes: { + ...ReactNativeViewViewConfigAndroid.bubblingEventTypes, topBlur: { phasedRegistrationNames: { bubbled: 'onBlur', @@ -85,6 +87,7 @@ const ReactNativeViewConfig = { }, }, directEventTypes: { + ...ReactNativeViewViewConfigAndroid.directEventTypes, topAccessibilityAction: { registrationName: 'onAccessibilityAction', }, @@ -110,6 +113,7 @@ const ReactNativeViewConfig = { }, }, validAttributes: { + ...ReactNativeViewViewConfigAndroid.validAttributes, accessibilityActions: true, accessibilityElementsHidden: true, accessibilityHint: true, diff --git a/Libraries/Components/View/ReactNativeViewViewConfigAndroid.js b/Libraries/Components/View/ReactNativeViewViewConfigAndroid.js new file mode 100644 index 00000000000..9396eb842c5 --- /dev/null +++ b/Libraries/Components/View/ReactNativeViewViewConfigAndroid.js @@ -0,0 +1,73 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow + * @format + */ + +'use strict'; + +const ReactNativeViewViewConfigAndroid = { + uiViewClassName: 'RCTView', + bubblingEventTypes: { + topSelect: { + phasedRegistrationNames: { + bubbled: 'onSelect', + captured: 'onSelectCapture', + }, + }, + }, + directEventTypes: { + topClick: { + registrationName: 'onClick', + }, + topContentSizeChange: { + registrationName: 'onContentSizeChange', + }, + topLoadingError: { + registrationName: 'onLoadingError', + }, + topLoadingFinish: { + registrationName: 'onLoadingFinish', + }, + topLoadingStart: { + registrationName: 'onLoadingStart', + }, + topMessage: { + registrationName: 'onMessage', + }, + topMomentumScrollBegin: { + registrationName: 'onMomentumScrollBegin', + }, + topMomentumScrollEnd: { + registrationName: 'onMomentumScrollEnd', + }, + topScroll: { + registrationName: 'onScroll', + }, + topScrollBeginDrag: { + registrationName: 'onScrollBeginDrag', + }, + topScrollEndDrag: { + registrationName: 'onScrollEndDrag', + }, + topSelectionChange: { + registrationName: 'onSelectionChange', + }, + }, + validAttributes: { + hasTVPreferredFocus: true, + nativeBackgroundAndroid: true, + nativeForegroundAndroid: true, + nextFocusDown: true, + nextFocusForward: true, + nextFocusLeft: true, + nextFocusRight: true, + nextFocusUp: true, + }, +}; + +module.exports = ReactNativeViewViewConfigAndroid;