Skip to content

Commit

Permalink
[prop-types] Add Missing Props in DeprecatedViewPropTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
yungsters committed Dec 3, 2022
1 parent c79af91 commit 5902411
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 11 deletions.
3 changes: 2 additions & 1 deletion deprecated-react-native-prop-types/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ ImagePropTypes`
- Removed deprecated props: `decomposedMatrix`, `rotation`, `scaleX`, `scaleY`, `transformMatrix`, `translateX`, `translateY`
- Improvements to `ViewPropTypes`
- Changed `hitSlop` to accept a number.
- Added `accessibilityLabelledBy`, `accessibilityLanguage`, `aria-busy`, `aria-checked`, `aria-disabled`, `aria-expanded`, `aria-hidden`, `aria-label`, `aria-labelledby`, `aria-live`, `aria-modal`, `aria-selected`, `aria-valuemax`, `aria-valuemin`, `aria-valuenow`, `aria-valuetext`, `id`, `role`, and `tabIndex.`
- Added `accessibilityLabelledBy`, `accessibilityLanguage`, `aria-busy`, `aria-checked`, `aria-disabled`, `aria-expanded`, `aria-hidden`, `aria-label`, `aria-labelledby`, `aria-live`, `aria-modal`, `aria-selected`, `aria-valuemax`, `aria-valuemin`, `aria-valuenow`, `aria-valuetext`, `focusable`, `id`, `nativeBackgroundAndroid`, `nativeForegroundAndroid`, `onAccessibilityEscape`, `onClick`, `role`, and `tabIndex.`
- Added mouse, pointer, focus, and touch event props.
- Added `borderCurve` and `pointerEvents` to `style`.
78 changes: 68 additions & 10 deletions deprecated-react-native-prop-types/DeprecatedViewPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,73 @@ const {
const DeprecatedViewStylePropTypes = require('./DeprecatedViewStylePropTypes');
const PropTypes = require('prop-types');

const MouseEventPropTypes = {
onMouseEnter: PropTypes.func,
onMouseLeave: PropTypes.func,
};

// Experimental/Work in Progress Pointer Event Callbacks (not yet ready for use)
const PointerEventPropTypes = {
onPointerEnter: PropTypes.func,
onPointerEnterCapture: PropTypes.func,
onPointerLeave: PropTypes.func,
onPointerLeaveCapture: PropTypes.func,
onPointerMove: PropTypes.func,
onPointerMoveCapture: PropTypes.func,
onPointerCancel: PropTypes.func,
onPointerCancelCapture: PropTypes.func,
onPointerDown: PropTypes.func,
onPointerDownCapture: PropTypes.func,
onPointerUp: PropTypes.func,
onPointerUpCapture: PropTypes.func,
onPointerOver: PropTypes.func,
onPointerOverCapture: PropTypes.func,
onPointerOut: PropTypes.func,
onPointerOutCapture: PropTypes.func,
};

const FocusEventPropTypes = {
onBlur: PropTypes.func,
onBlurCapture: PropTypes.func,
onFocus: PropTypes.func,
onFocusCapture: PropTypes.func,
};

const TouchEventPropTypes = {
onTouchCancel: PropTypes.func,
onTouchCancelCapture: PropTypes.func,
onTouchEnd: PropTypes.func,
onTouchEndCapture: PropTypes.func,
onTouchMove: PropTypes.func,
onTouchMoveCapture: PropTypes.func,
onTouchStart: PropTypes.func,
onTouchStartCapture: PropTypes.func,
};

const GestureResponderEventPropTypes = {
onMoveShouldSetResponder: PropTypes.func,
onMoveShouldSetResponderCapture: PropTypes.func,
onResponderEnd: PropTypes.func,
onResponderGrant: PropTypes.func,
onResponderMove: PropTypes.func,
onResponderReject: PropTypes.func,
onResponderRelease: PropTypes.func,
onResponderStart: PropTypes.func,
onResponderTerminate: PropTypes.func,
onResponderTerminationRequest: PropTypes.func,
onStartShouldSetResponder: PropTypes.func,
onStartShouldSetResponderCapture: PropTypes.func,
};

/**
* @see facebook/react-native/Libraries/Components/View/ViewPropTypes.js
*/
const DeprecatedViewPropTypes = {
...MouseEventPropTypes,
...PointerEventPropTypes,
...FocusEventPropTypes,
...TouchEventPropTypes,
...GestureResponderEventPropTypes,
'aria-busy': PropTypes.bool,
'aria-checked': PropTypes.oneOfType([
PropTypes.bool,
Expand Down Expand Up @@ -59,6 +122,7 @@ const DeprecatedViewPropTypes = {
accessibilityViewIsModal: PropTypes.bool,
accessible: PropTypes.bool,
collapsable: PropTypes.bool,
focusable: PropTypes.bool,
hitSlop: PropTypes.oneOfType([
DeprecatedEdgeInsetsPropType,
PropTypes.number,
Expand All @@ -69,22 +133,16 @@ const DeprecatedViewPropTypes = {
'no-hide-descendants',
'yes',
]),
nativeBackgroundAndroid: PropTypes.object,
nativeForegroundAndroid: PropTypes.object,
nativeID: PropTypes.string,
needsOffscreenAlphaCompositing: PropTypes.bool,
onAccessibilityAction: PropTypes.func,
onAccessibilityEscape: PropTypes.func,
onAccessibilityTap: PropTypes.func,
onClick: PropTypes.func,
onLayout: PropTypes.func,
onMagicTap: PropTypes.func,
onMoveShouldSetResponder: PropTypes.func,
onMoveShouldSetResponderCapture: PropTypes.func,
onResponderGrant: PropTypes.func,
onResponderMove: PropTypes.func,
onResponderReject: PropTypes.func,
onResponderRelease: PropTypes.func,
onResponderTerminate: PropTypes.func,
onResponderTerminationRequest: PropTypes.func,
onStartShouldSetResponder: PropTypes.func,
onStartShouldSetResponderCapture: PropTypes.func,
pointerEvents: PropTypes.oneOf(['auto', 'box-none', 'box-only', 'none']),
removeClippedSubviews: PropTypes.bool,
renderToHardwareTextureAndroid: PropTypes.bool,
Expand Down

0 comments on commit 5902411

Please sign in to comment.