Add view config for AndroidHorizontalScrollView

Summary:
Adding a handwritten view config for AndroidHorizontalScrollView, the native component that's used with `<ScrollView horizontal={true} />` on Android. Native props are the same as `RCTScrollView`, so I'm reusing the type for that.

Changelog: [Internal]

Reviewed By: rickhanlonii

Differential Revision: D18284517

fbshipit-source-id: 7c81f72440b93d611f9574ad2c01a96530d07bf7
This commit is contained in:
Emily Janzer 2019-11-05 19:07:06 -08:00 коммит произвёл Facebook Github Bot
Родитель 1f2dc8997f
Коммит b7fac14b64
2 изменённых файлов: 58 добавлений и 3 удалений

Просмотреть файл

@ -0,0 +1,56 @@
/**
* 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.
*
* @format
* @flow
*/
'use strict';
const registerGeneratedViewConfig = require('../../Utilities/registerGeneratedViewConfig');
const requireNativeComponent = require('../../ReactNative/requireNativeComponent');
import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
import type {ScrollViewNativeProps} from './ScrollViewNativeComponentType';
const AndroidHorizontalScrollViewViewConfig = {
uiViewClassName: 'AndroidHorizontalScrollView',
bubblingEventTypes: {},
directEventTypes: {},
validAttributes: {
decelerationRate: true,
disableIntervalMomentum: true,
endFillColor: {process: require('../../StyleSheet/processColor')},
fadingEdgeLength: true,
nestedScrollEnabled: true,
overScrollMode: true,
pagingEnabled: true,
persistentScrollbar: true,
scrollEnabled: true,
scrollPerfTag: true,
sendMomentumEvents: true,
showsHorizontalScrollIndicator: true,
snapToEnd: true,
snapToInterval: true,
snapToStart: true,
snapToOffsets: true,
},
};
let AndroidHorizontalScrollViewNativeComponent;
if (global.RN$Bridgeless) {
registerGeneratedViewConfig(
'AndroidHorizontalScrollView',
AndroidHorizontalScrollViewViewConfig,
);
AndroidHorizontalScrollViewNativeComponent = 'AndroidHorizontalScrollView';
} else {
AndroidHorizontalScrollViewNativeComponent = requireNativeComponent<ScrollViewNativeProps>(
'AndroidHorizontalScrollView',
);
}
export default ((AndroidHorizontalScrollViewNativeComponent: any): HostComponent<ScrollViewNativeProps>);

Просмотреть файл

@ -44,6 +44,7 @@ import type {Props as ScrollViewStickyHeaderProps} from './ScrollViewStickyHeade
import ScrollViewNativeComponent from './ScrollViewNativeComponent';
import ScrollContentViewNativeComponent from './ScrollContentViewNativeComponent';
import AndroidHorizontalScrollViewNativeComponent from './AndroidHorizontalScrollViewNativeComponent';
let AndroidScrollView;
let AndroidHorizontalScrollContentView;
@ -53,9 +54,7 @@ let RCTScrollContentView;
if (Platform.OS === 'android') {
AndroidScrollView = ScrollViewNativeComponent;
AndroidHorizontalScrollView = requireNativeComponent(
'AndroidHorizontalScrollView',
);
AndroidHorizontalScrollView = AndroidHorizontalScrollViewNativeComponent;
AndroidHorizontalScrollContentView = requireNativeComponent(
'AndroidHorizontalScrollContentView',
);