-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RN: Migrate
ScrollView
to NativeComponentRegistry
Summary: Migrates `ScrollView` (and its related native components) to use `NativeComponentRegistry`. This will enable it to be configured using experiments to conditionally use the native `ViewConfig` or verify the static `ViewConfig`. This also cleans up a bunch of the modules and types related to defining the native `ScrollView` component. This also proposes adopting the same module naming protocol was has been adopted for TurboModules (i.e. `NativeScrollView` instead of `ScrollViewNativeComponent`). Changelog: [Internal] Reviewed By: JoshuaGross Differential Revision: D25098530 fbshipit-source-id: ff1394bfac023daf58e85d5f9068e4f8da3538be
- Loading branch information
1 parent
d4e29ec
commit 00e623d
Showing
10 changed files
with
174 additions
and
148 deletions.
There are no files selected for viewing
40 changes: 0 additions & 40 deletions
40
Libraries/Components/ScrollView/AndroidHorizontalScrollContentViewNativeComponent.js
This file was deleted.
Oops, something went wrong.
57 changes: 0 additions & 57 deletions
57
Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js
This file was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
Libraries/Components/ScrollView/NativeAndroidHorizontalScrollContentView.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* 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 strict-local | ||
* @format | ||
*/ | ||
|
||
'use strict'; | ||
|
||
import {type HostComponent} from '../../Renderer/shims/ReactNativeTypes'; | ||
import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry'; | ||
import {type ViewProps as Props} from '../View/ViewPropTypes'; | ||
|
||
const NativeAndroidHorizontalScrollContentView: HostComponent<Props> = NativeComponentRegistry.get<Props>( | ||
'AndroidHorizontalScrollContentView', | ||
() => ({ | ||
uiViewClassName: 'AndroidHorizontalScrollContentView', | ||
bubblingEventTypes: {}, | ||
directEventTypes: {}, | ||
validAttributes: {}, | ||
}), | ||
); | ||
|
||
export default NativeAndroidHorizontalScrollContentView; |
45 changes: 45 additions & 0 deletions
45
Libraries/Components/ScrollView/NativeAndroidHorizontalScrollView.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* 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 strict-local | ||
* @format | ||
*/ | ||
|
||
'use strict'; | ||
|
||
import {type ScrollViewNativeProps as Props} from './ScrollViewNativeComponentType'; | ||
import {type HostComponent} from '../../Renderer/shims/ReactNativeTypes'; | ||
import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry'; | ||
|
||
const NativeAndroidHorizontalScrollView: HostComponent<Props> = NativeComponentRegistry.get<Props>( | ||
'AndroidHorizontalScrollView', | ||
() => ({ | ||
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, | ||
contentOffset: true, | ||
}, | ||
}), | ||
); | ||
|
||
export default NativeAndroidHorizontalScrollView; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
/** | ||
* 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 strict-local | ||
* @format | ||
*/ | ||
|
||
'use strict'; | ||
|
||
import {type ScrollViewNativeProps as Props} from './ScrollViewNativeComponentType'; | ||
import {type HostComponent} from '../../Renderer/shims/ReactNativeTypes'; | ||
import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry'; | ||
|
||
const NativeScrollView: HostComponent<Props> = NativeComponentRegistry.get<Props>( | ||
'RCTScrollView', | ||
() => ({ | ||
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, | ||
inverted: 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, | ||
}, | ||
}), | ||
); | ||
|
||
export default NativeScrollView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 0 additions & 32 deletions
32
Libraries/Components/ScrollView/ScrollViewNativeComponent.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters