Skip to content

Commit

Permalink
RN: Update ViewConfig for ScrollView
Browse files Browse the repository at this point in the history
Summary:
Updates `ReactScrollViewManager` and the `ViewConfig` for `ScrollView` so that they are equivalent.

- `inverted` was missing.
- `contentOffset` was missing differ on Android. (However, there does not seem to be any perceivable behavior difference besides the native `ViewConfig` being different.)

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D25084470

fbshipit-source-id: 8bea3b7a692c1038819a4147b174583a4faa71e9
  • Loading branch information
yungsters authored and facebook-github-bot committed Nov 19, 2020
1 parent de92e74 commit f6b8736
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
15 changes: 11 additions & 4 deletions Libraries/Components/ScrollView/ScrollViewViewConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

'use strict';

import type {PartialViewConfig} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
import type {PartialViewConfig} from '../../Renderer/shims/ReactNativeTypes';

const ScrollViewViewConfig = {
uiViewClassName: 'RCTScrollView',
Expand All @@ -28,15 +28,22 @@ const ScrollViewViewConfig = {
bouncesZoom: true,
canCancelContentTouches: true,
centerContent: true,
contentInset: {diff: require('../../Utilities/differ/pointsDiffer')},
contentOffset: {diff: require('../../Utilities/differ/pointsDiffer')},
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')},
endFillColor: {
process: require('../../StyleSheet/processColor'),
},
fadingEdgeLength: true,
indicatorStyle: true,
inverted: true,
keyboardDismissMode: true,
maintainVisibleContentPosition: true,
maximumZoomScale: true,
Expand Down
3 changes: 2 additions & 1 deletion Libraries/ReactNative/getNativeComponentAttributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ function getDifferForType(
case 'UIEdgeInsets':
return insetsDiffer;
// Android Types
// (not yet implemented)
case 'Point':
return pointsDiffer;
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public void setFadingEdgeLength(ReactScrollView view, int value) {
}
}

@ReactProp(name = "contentOffset")
@ReactProp(name = "contentOffset", customType = "Point")
public void setContentOffset(ReactScrollView view, ReadableMap value) {
if (value != null) {
double x = value.hasKey("x") ? value.getDouble("x") : 0;
Expand Down

0 comments on commit f6b8736

Please sign in to comment.