[add] StyleSheet support for 'overscrollBehavior'

An experimental CSS property to control the behavior when the scroll
position of a scroll container reaches the edge of the scrollport. This
allows web apps to get closer to native scrolling behaviour and
performance.

https://wicg.github.io/overscroll-behavior/
https://developers.google.com/web/updates/2017/11/overscroll-behavior

Fix #765
This commit is contained in:
Nicolas Gallagher
2018-01-11 12:41:34 -08:00
parent 067e3f346f
commit 19cf0711bc
5 changed files with 28 additions and 1 deletions

View File

@@ -34,5 +34,9 @@ Object {
"marginLeft": "10px",
"marginRight": "10px",
"marginTop": "50px",
"overflowX": "hidden",
"overflowY": "hidden",
"overscrollBehaviorX": "contain",
"overscrollBehaviorY": "contain",
}
`;

View File

@@ -143,7 +143,9 @@ describe('apis/StyleSheet/createReactDOMStyle', () => {
borderWidth: 0,
marginTop: 50,
marginVertical: 25,
margin: 10
margin: 10,
overflow: 'hidden',
overscrollBehavior: 'contain'
};
expect(createReactDOMStyle(style)).toMatchSnapshot();

View File

@@ -35,6 +35,7 @@ const styleShortFormProperties = {
marginHorizontal: ['marginRight', 'marginLeft'],
marginVertical: ['marginTop', 'marginBottom'],
overflow: ['overflowX', 'overflowY'],
overscrollBehavior: ['overscrollBehaviorX', 'overscrollBehaviorY'],
padding: ['paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft'],
paddingHorizontal: ['paddingRight', 'paddingLeft'],
paddingVertical: ['paddingTop', 'paddingBottom'],

View File

@@ -17,6 +17,8 @@ import ShadowPropTypes from '../../modules/ShadowPropTypes';
import TransformPropTypes from '../../modules/TransformPropTypes';
import { number, oneOf, oneOfType, string } from 'prop-types';
const overscrollBehaviorType = oneOf(['auto', 'contain', 'none']);
const ViewStylePropTypes = {
...AnimationPropTypes,
...BorderPropTypes,
@@ -46,6 +48,9 @@ const ViewStylePropTypes = {
filter: string,
outline: string,
outlineColor: ColorPropType,
overscrollBehavior: overscrollBehaviorType,
overscrollBehaviorX: overscrollBehaviorType,
overscrollBehaviorY: overscrollBehaviorType,
perspective: oneOfType([number, string]),
perspectiveOrigin: string,
touchAction: string,

View File

@@ -688,6 +688,21 @@ const stylePropTypes = [
name: 'overflowY',
typeInfo: 'string'
},
{
label: 'web',
name: 'overscrollBehavior',
typeInfo: '"auto" | "contain" | "none"'
},
{
label: 'web',
name: 'overscrollBehaviorX',
typeInfo: '"auto" | "contain" | "none"'
},
{
label: 'web',
name: 'overscrollBehaviorY',
typeInfo: '"auto" | "contain" | "none"'
},
{
name: 'padding',
typeInfo: 'number | string'