mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-01-12 22:51:09 +08:00
[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:
@@ -34,5 +34,9 @@ Object {
|
||||
"marginLeft": "10px",
|
||||
"marginRight": "10px",
|
||||
"marginTop": "50px",
|
||||
"overflowX": "hidden",
|
||||
"overflowY": "hidden",
|
||||
"overscrollBehaviorX": "contain",
|
||||
"overscrollBehaviorY": "contain",
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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'],
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user