mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add handwritten view config for RCTScrollView
Summary: Adding a handwritten view config for RCTScrollView, to be used in DEV only (for now). Changelog: [Internal] Reviewed By: rickhanlonii Differential Revision: D18263203 fbshipit-source-id: 975499f030c7caed9851bcde0be42c5058911ad5
This commit is contained in:
committed by
Facebook Github Bot
parent
6598292ede
commit
da39b07298
@@ -42,6 +42,8 @@ import type {State as ScrollResponderState} from '../ScrollResponder';
|
||||
import type {ViewProps} from '../View/ViewPropTypes';
|
||||
import type {Props as ScrollViewStickyHeaderProps} from './ScrollViewStickyHeader';
|
||||
|
||||
import ScrollViewNativeComponent from './ScrollViewNativeComponent';
|
||||
|
||||
let AndroidScrollView;
|
||||
let AndroidHorizontalScrollContentView;
|
||||
let AndroidHorizontalScrollView;
|
||||
@@ -49,7 +51,7 @@ let RCTScrollView;
|
||||
let RCTScrollContentView;
|
||||
|
||||
if (Platform.OS === 'android') {
|
||||
AndroidScrollView = requireNativeComponent('RCTScrollView');
|
||||
AndroidScrollView = ScrollViewNativeComponent;
|
||||
AndroidHorizontalScrollView = requireNativeComponent(
|
||||
'AndroidHorizontalScrollView',
|
||||
);
|
||||
@@ -57,7 +59,7 @@ if (Platform.OS === 'android') {
|
||||
'AndroidHorizontalScrollContentView',
|
||||
);
|
||||
} else if (Platform.OS === 'ios') {
|
||||
RCTScrollView = requireNativeComponent('RCTScrollView');
|
||||
RCTScrollView = ScrollViewNativeComponent;
|
||||
RCTScrollContentView = requireNativeComponent('RCTScrollContentView');
|
||||
} else {
|
||||
RCTScrollView = requireNativeComponent('RCTScrollView');
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* 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 ScrollViewViewConfig from './ScrollViewViewConfig';
|
||||
|
||||
import type {
|
||||
ScrollViewNativeProps,
|
||||
ScrollViewNativeComponentType,
|
||||
} from './ScrollViewNativeComponentType';
|
||||
|
||||
let ScrollViewNativeComponent;
|
||||
if (global.RN$Bridgeless) {
|
||||
registerGeneratedViewConfig('RCTScrollView', ScrollViewViewConfig);
|
||||
ScrollViewNativeComponent = 'RCTScrollView';
|
||||
} else {
|
||||
ScrollViewNativeComponent = requireNativeComponent<ScrollViewNativeProps>(
|
||||
'RCTScrollView',
|
||||
);
|
||||
}
|
||||
|
||||
export default ((ScrollViewNativeComponent: any): ScrollViewNativeComponentType);
|
||||
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* 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';
|
||||
|
||||
import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
|
||||
import type {ViewProps} from '../View/ViewPropTypes';
|
||||
import type {
|
||||
ViewStyleProp,
|
||||
DangerouslyImpreciseStyle,
|
||||
} from '../../StyleSheet/StyleSheet';
|
||||
import type {ColorValue} from '../../StyleSheet/StyleSheetTypes';
|
||||
import type {EdgeInsetsProp} from '../../StyleSheet/EdgeInsetsPropType';
|
||||
import type {ScrollEvent} from '../../Types/CoreEventTypes';
|
||||
import type {PointProp} from '../../StyleSheet/PointPropType';
|
||||
|
||||
export type ScrollViewNativeProps = $ReadOnly<{
|
||||
...ViewProps,
|
||||
|
||||
alwaysBounceHorizontal?: ?boolean,
|
||||
alwaysBounceVertical?: ?boolean,
|
||||
automaticallyAdjustContentInsets?: ?boolean,
|
||||
bounces?: ?boolean,
|
||||
bouncesZoom?: ?boolean,
|
||||
canCancelContentTouches?: ?boolean,
|
||||
centerContent?: ?boolean,
|
||||
contentInset?: ?EdgeInsetsProp,
|
||||
contentInsetAdjustmentBehavior?: ?(
|
||||
| 'automatic'
|
||||
| 'scrollableAxes'
|
||||
| 'never'
|
||||
| 'always'
|
||||
),
|
||||
contentOffset?: ?PointProp,
|
||||
decelerationRate?: ?('fast' | 'normal' | number),
|
||||
directionalLockEnabled?: ?boolean,
|
||||
disableIntervalMomentum?: ?boolean,
|
||||
endFillColor?: ?ColorValue,
|
||||
fadingEdgeLength?: ?number,
|
||||
indicatorStyle?: ?('default' | 'black' | 'white'),
|
||||
keyboardDismissMode?: ?('none' | 'on-drag' | 'interactive'),
|
||||
maintainVisibleContentPosition?: ?$ReadOnly<{|
|
||||
minIndexForVisible: number,
|
||||
autoscrollToTopThreshold?: ?number,
|
||||
|}>,
|
||||
maximumZoomScale?: ?number,
|
||||
minimumZoomScale?: ?number,
|
||||
nestedScrollEnabled?: ?boolean,
|
||||
onMomentumScrollBegin?: ?(event: ScrollEvent) => void,
|
||||
onMomentumScrollEnd?: ?(event: ScrollEvent) => void,
|
||||
onScroll?: ?(event: ScrollEvent) => void,
|
||||
onScrollBeginDrag?: ?(event: ScrollEvent) => void,
|
||||
onScrollEndDrag?: ?(event: ScrollEvent) => void,
|
||||
onScrollToTop?: (event: ScrollEvent) => void,
|
||||
overScrollMode?: ?('auto' | 'always' | 'never'),
|
||||
pagingEnabled?: ?boolean,
|
||||
persistentScrollbar?: ?boolean,
|
||||
pinchGestureEnabled?: ?boolean,
|
||||
scrollEnabled?: ?boolean,
|
||||
scrollEventThrottle?: ?number,
|
||||
scrollIndicatorInsets?: ?EdgeInsetsProp,
|
||||
scrollPerfTag?: ?string,
|
||||
scrollToOverflowEnabled?: ?boolean,
|
||||
scrollsToTop?: ?boolean,
|
||||
sendMomentumEvents?: ?boolean,
|
||||
showsHorizontalScrollIndicator?: ?boolean,
|
||||
showsVerticalScrollIndicator?: ?boolean,
|
||||
snapToAlignment?: ?('start' | 'center' | 'end'),
|
||||
snapToEnd?: ?boolean,
|
||||
snapToInterval?: ?number,
|
||||
snapToOffsets?: ?$ReadOnlyArray<number>,
|
||||
snapToStart?: ?boolean,
|
||||
zoomScale?: ?number,
|
||||
|
||||
DEPRECATED_sendUpdatedChildFrames?: ?boolean,
|
||||
|
||||
// Overrides
|
||||
style?: {...ViewStyleProp} | DangerouslyImpreciseStyle,
|
||||
onResponderGrant?: ?(e: any) => void | boolean,
|
||||
}>;
|
||||
|
||||
export type ScrollViewNativeComponentType = HostComponent<ScrollViewNativeProps>;
|
||||
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
* 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';
|
||||
|
||||
import {} from '../../Utilities/differ/pointsDiffer';
|
||||
|
||||
import type {GeneratedViewConfig} from '../../Utilities/registerGeneratedViewConfig';
|
||||
|
||||
const ScrollViewViewConfig = {
|
||||
uiViewClassName: 'RCTScrollView',
|
||||
bubblingEventTypes: {},
|
||||
directEventTypes: {
|
||||
topScrollToTop: {
|
||||
registrationName: 'onScrollToTop',
|
||||
},
|
||||
},
|
||||
validAttributes: {
|
||||
alwaysBounceHorizontal: true,
|
||||
alwaysBounceVertical: true,
|
||||
automaticallyAdjustContentInsets: true,
|
||||
bounces: true,
|
||||
bouncesZoom: true,
|
||||
canCancelContentTouches: true,
|
||||
centerContent: true,
|
||||
contentInset: {diff: require('../../Utilities/differ/pointsDiffer')},
|
||||
contentOffset: {diff: require('../../Utilities/differ/pointsDiffer')},
|
||||
contentInsetAdjustmentBehavior: true,
|
||||
decelerationRate: true,
|
||||
directionalLockEnabled: true,
|
||||
disableIntervalMomentum: true,
|
||||
endFillColor: {process: require('../../StyleSheet/processColor')},
|
||||
fadingEdgeLength: true,
|
||||
indicatorStyle: true,
|
||||
keyboardDismissMode: true,
|
||||
maintainVisibleContentPosition: true,
|
||||
maximumZoomScale: true,
|
||||
minimumZoomScale: true,
|
||||
nestedScrollEnabled: true,
|
||||
onMomentumScrollBegin: true,
|
||||
onMomentumScrollEnd: true,
|
||||
onScroll: true,
|
||||
onScrollBeginDrag: true,
|
||||
onScrollEndDrag: true,
|
||||
onScrollToTop: true,
|
||||
overScrollMode: true,
|
||||
pagingEnabled: true,
|
||||
persistentScrollbar: true,
|
||||
pinchGestureEnabled: true,
|
||||
scrollEnabled: true,
|
||||
scrollEventThrottle: true,
|
||||
scrollIndicatorInsets: {
|
||||
diff: require('../../Utilities/differ/pointsDiffer'),
|
||||
},
|
||||
scrollPerfTag: true,
|
||||
scrollToOverflowEnabled: true,
|
||||
scrollsToTop: true,
|
||||
sendMomentumEvents: true,
|
||||
showsHorizontalScrollIndicator: true,
|
||||
showsVerticalScrollIndicator: true,
|
||||
snapToAlignment: true,
|
||||
snapToEnd: true,
|
||||
snapToInterval: true,
|
||||
snapToOffsets: true,
|
||||
snapToStart: true,
|
||||
zoomScale: true,
|
||||
|
||||
DEPRECATED_sendUpdatedChildFrames: true,
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = (ScrollViewViewConfig: GeneratedViewConfig);
|
||||
@@ -14,7 +14,7 @@ const ReactNativeViewConfigRegistry = require('../Renderer/shims/ReactNativeView
|
||||
const ReactNativeViewViewConfig = require('../Components/View/ReactNativeViewViewConfig');
|
||||
import verifyComponentAttributeEquivalence from './verifyComponentAttributeEquivalence';
|
||||
|
||||
type GeneratedViewConfig = {
|
||||
export type GeneratedViewConfig = {
|
||||
uiViewClassName: string,
|
||||
bubblingEventTypes?: $ReadOnly<{
|
||||
[eventName: string]: $ReadOnly<{|
|
||||
|
||||
Reference in New Issue
Block a user