-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix TouchableWithoutFeedback's Lack of View #23871
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code analysis results:
eslint
found some issues. Runyarn lint --fix
to automatically fix problems.flow
found some issues.
nativeID={this.props.nativeID} | ||
testID={this.props.testID} | ||
onLayout={this.props.onLayout} | ||
hitSlop={this.props.hitStop} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot get this.props.hitStop
because property hitStop
is missing in propTypes of React component [1].
onResponderMove={this.touchableHandleResponderMove} | ||
onResponderRelease={this.touchableHandleResponderRelease} | ||
onResponderTerminate={this.touchableHandleResponderTerminate}> | ||
{this.props.children} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot get this.props.children
because property children
is missing in propTypes of React component [1].
{this.props.children} | ||
{Touchable.renderDebugView({ | ||
color: 'red', | ||
hitSlop: this.props.hitSlop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot call Touchable.renderDebugView
with object literal bound to the first parameter because inexact undefined [1] is incompatible with exact EdgeInsetsProp
[2] in property hitSlop
.
{this.props.children} | ||
{Touchable.renderDebugView({ | ||
color: 'red', | ||
hitSlop: this.props.hitSlop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot call Touchable.renderDebugView
with object literal bound to the first parameter because inexact object type [1] is incompatible with exact EdgeInsetsProp
[2] in property hitSlop
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code analysis results:
flow
found some issues.
nativeID={this.props.nativeID} | ||
testID={this.props.testID} | ||
onLayout={this.props.onLayout} | ||
hitSlop={this.props.hitSlop} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot create View
element because inexact object type [1] is incompatible with exact EdgeInsetsProp
[2] in property hitSlop
.
onResponderMove={this.touchableHandleResponderMove} | ||
onResponderRelease={this.touchableHandleResponderRelease} | ||
onResponderTerminate={this.touchableHandleResponderTerminate}> | ||
{this.props.children} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot get this.props.children
because property children
is missing in propTypes of React component [1].
onResponderRelease={this.touchableHandleResponderRelease} | ||
onResponderTerminate={this.touchableHandleResponderTerminate}> | ||
{this.props.children} | ||
{Touchable.renderDebugView({color: 'red', hitSlop: this.props.hitSlop})} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot call Touchable.renderDebugView
with object literal bound to the first parameter because inexact undefined [1] is incompatible with exact EdgeInsetsProp
[2] in property hitSlop
.
onResponderRelease={this.touchableHandleResponderRelease} | ||
onResponderTerminate={this.touchableHandleResponderTerminate}> | ||
{this.props.children} | ||
{Touchable.renderDebugView({color: 'red', hitSlop: this.props.hitSlop})} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot call Touchable.renderDebugView
with object literal bound to the first parameter because inexact object type [1] is incompatible with exact EdgeInsetsProp
[2] in property hitSlop
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code analysis results:
eslint
found some issues. Runyarn lint --fix
to automatically fix problems.flow
found some issues.
onResponderMove={that.touchableHandleResponderMove} | ||
onResponderRelease={that.touchableHandleResponderRelease} | ||
onResponderTerminate={that.touchableHandleResponderTerminate}> | ||
{that.props.children} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot get that.props.children
because property children
is missing in propTypes of React component [1].
onResponderRelease={that.touchableHandleResponderRelease} | ||
onResponderTerminate={that.touchableHandleResponderTerminate}> | ||
{that.props.children} | ||
{Touchable.renderDebugView({color: 'red', hitSlop: that.props.hitSlop})} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot call Touchable.renderDebugView
with object literal bound to the first parameter because inexact undefined [1] is incompatible with exact EdgeInsetsProp
[2] in property hitSlop
.
onResponderRelease={that.touchableHandleResponderRelease} | ||
onResponderTerminate={that.touchableHandleResponderTerminate}> | ||
{that.props.children} | ||
{Touchable.renderDebugView({color: 'red', hitSlop: that.props.hitSlop})} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot call Touchable.renderDebugView
with object literal bound to the first parameter because inexact object type [1] is incompatible with exact EdgeInsetsProp
[2] in property hitSlop
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code analysis results:
flow
found some issues.
nativeID={that.props.nativeID} | ||
testID={that.props.testID} | ||
onLayout={that.props.onLayout} | ||
hitSlop={that.props.hitSlop} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot create View
element because inexact object type [1] is incompatible with exact EdgeInsetsProp
[2] in property hitSlop
.
onResponderMove={that.touchableHandleResponderMove} | ||
onResponderRelease={that.touchableHandleResponderRelease} | ||
onResponderTerminate={that.touchableHandleResponderTerminate}> | ||
{that.props.children} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot get that.props.children
because property children
is missing in propTypes of React component [1].
onResponderRelease={that.touchableHandleResponderRelease} | ||
onResponderTerminate={that.touchableHandleResponderTerminate}> | ||
{that.props.children} | ||
{Touchable.renderDebugView({color: 'red', hitSlop: that.props.hitSlop})} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot call Touchable.renderDebugView
with object literal bound to the first parameter because inexact undefined [1] is incompatible with exact EdgeInsetsProp
[2] in property hitSlop
.
onResponderRelease={that.touchableHandleResponderRelease} | ||
onResponderTerminate={that.touchableHandleResponderTerminate}> | ||
{that.props.children} | ||
{Touchable.renderDebugView({color: 'red', hitSlop: that.props.hitSlop})} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot call Touchable.renderDebugView
with object literal bound to the first parameter because inexact object type [1] is incompatible with exact EdgeInsetsProp
[2] in property hitSlop
.
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code analysis results:
flow
found some issues.
onStartShouldSetResponder={this.touchableHandleStartShouldSetResponder} | ||
onResponderTerminationRequest={ | ||
this.touchableHandleResponderTerminationRequest | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot get this.props.children
because property children
is missing in propTypes of React component [1].
} | ||
onResponderGrant={this.touchableHandleResponderGrant} | ||
onResponderMove={this.touchableHandleResponderMove} | ||
onResponderRelease={this.touchableHandleResponderRelease} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot call Touchable.renderDebugView
with object literal bound to the first parameter because inexact undefined [1] is incompatible with exact EdgeInsetsProp
[2] in property hitSlop
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code analysis results:
eslint
found some issues. Runyarn lint --fix
to automatically fix problems.flow
found some issues.
onResponderTerminationRequest: this | ||
.touchableHandleResponderTerminationRequest, | ||
onResponderGrant: this.touchableHandleResponderGrant, | ||
onResponderMove: this.touchableHandleResponderMove, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
react/jsx-no-undef: 'Animated' is not defined.
@@ -60,7 +59,7 @@ export type Props = $ReadOnly<{| | |||
delayPressIn?: ?number, | |||
delayPressOut?: ?number, | |||
disabled?: ?boolean, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot use exports as a type because exports is a value. To get the type of a value use typeof
.
@@ -69,7 +68,7 @@ export type Props = $ReadOnly<{| | |||
onPress?: ?(event: PressEvent) => mixed, | |||
onPressIn?: ?(event: PressEvent) => mixed, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot use exports as a type because exports is a value. To get the type of a value use typeof
.
@@ -161,7 +160,7 @@ const TouchableWithoutFeedback = ((createReactClass({ | |||
* reactivated! Move it back and forth several times while the scroll view |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exports [1] is not a React propType.
@@ -170,7 +169,7 @@ const TouchableWithoutFeedback = ((createReactClass({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exports [1] is not a React propType.
onResponderTerminationRequest: this | ||
.touchableHandleResponderTerminationRequest, | ||
onResponderGrant: this.touchableHandleResponderGrant, | ||
onResponderMove: this.touchableHandleResponderMove, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot resolve name Animated
.
hitSlop={this.props.hitSlop} | ||
onStartShouldSetResponder={this.touchableHandleStartShouldSetResponder} | ||
onResponderTerminationRequest={ | ||
this.touchableHandleResponderTerminationRequest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot get this.props.children
because property children
is missing in propTypes of React component [1].
this.touchableHandleResponderTerminationRequest | ||
} | ||
onResponderGrant={this.touchableHandleResponderGrant} | ||
onResponderMove={this.touchableHandleResponderMove} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot call Touchable.renderDebugView
with object literal bound to the first parameter because inexact undefined [1] is incompatible with exact EdgeInsetsProp
[2] in property hitSlop
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code analysis results:
flow
found some issues.
@@ -60,7 +59,7 @@ export type Props = $ReadOnly<{| | |||
delayPressIn?: ?number, | |||
delayPressOut?: ?number, | |||
disabled?: ?boolean, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot use exports as a type because exports is a value. To get the type of a value use typeof
.
@@ -69,7 +68,7 @@ export type Props = $ReadOnly<{| | |||
onPress?: ?(event: PressEvent) => mixed, | |||
onPressIn?: ?(event: PressEvent) => mixed, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot use exports as a type because exports is a value. To get the type of a value use typeof
.
} | ||
onResponderGrant={this.touchableHandleResponderGrant} | ||
onResponderMove={this.touchableHandleResponderMove} | ||
onResponderRelease={this.touchableHandleResponderRelease} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot call Touchable.renderDebugView
with object literal bound to the first parameter because inexact undefined [1] is incompatible with exact EdgeInsetsProp
[2] in property hitSlop
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code analysis results:
flow
found some issues.
@@ -60,7 +61,7 @@ export type Props = $ReadOnly<{| | |||
delayPressIn?: ?number, | |||
delayPressOut?: ?number, | |||
disabled?: ?boolean, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot use exports as a type because exports is a value. To get the type of a value use typeof
.
@@ -69,7 +70,7 @@ export type Props = $ReadOnly<{| | |||
onPress?: ?(event: PressEvent) => mixed, | |||
onPressIn?: ?(event: PressEvent) => mixed, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot use exports as a type because exports is a value. To get the type of a value use typeof
.
@@ -161,7 +162,7 @@ const TouchableWithoutFeedback = ((createReactClass({ | |||
* reactivated! Move it back and forth several times while the scroll view |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exports [1] is not a React propType.
@@ -170,7 +171,7 @@ const TouchableWithoutFeedback = ((createReactClass({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exports [1] is not a React propType.
hitSlop={this.props.hitSlop} | ||
onStartShouldSetResponder={this.touchableHandleStartShouldSetResponder} | ||
onResponderTerminationRequest={ | ||
this.touchableHandleResponderTerminationRequest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot get this.props.children
because property children
is missing in propTypes of React component [1].
this.touchableHandleResponderTerminationRequest | ||
} | ||
onResponderGrant={this.touchableHandleResponderGrant} | ||
onResponderMove={this.touchableHandleResponderMove} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot call Touchable.renderDebugView
with object literal bound to the first parameter because inexact undefined [1] is incompatible with exact EdgeInsetsProp
[2] in property hitSlop
.
Thanks for your PR. We are planning on deprecating these components in the near future and will be open sourcing a new way of handling pressable elements. I don't think it makes sense at this point to introduce such a big change to a component like this so I'm going to close this PR but feel free to use this in your own code :) |
Summary
This PR addresses the issue regarding
TouchableWithoutFeedback
components not correctly working without a<View>
embedded within them. The most current issue can be found here.render()
now returns aView
-- rather than just cloning the children -- with all of the props passed into the TouchableWithoutFeedback component, as well as all children. This addresses the issue where the children's props weren't being properly passed down into aView
.Changelog
[General] [Fixed] -
render()
now wraps all props and child props correctly in a viewTest Plan
Pass all CircleCI Tests