Repository navigation
Conversation
Generated by 🚫 dangerJS |
|
I use |
| const React = require('React'); | ||
| const PropTypes = require('prop-types'); | ||
| const ReactNative = require('ReactNative'); | ||
| // $FlowFixMe |
There was a problem hiding this comment.
This is to fix the flow warning about not importing from untyped files, right? If that is the case then lets just not turn on strict-local in this file.
There was a problem hiding this comment.
Thank you for reviewing.
I applied flow to Touchable.js then I removed FlowFixMe from TouchableNativeFeedback.android.js.
1996e49 to
4623d51
Compare
…o flow-touchable-native-feedback
facebook-github-bot
left a comment
There was a problem hiding this comment.
@RSNara has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
RSNara
left a comment
There was a problem hiding this comment.
@mottox2: I noticed a few contradictions in this diff while I was reviewing it internally. You used LayoutEvent in interesting ways. (I've fixed up the diff internally to only use PressEvent, so you don't need to push any updates to this). Before I landed the diff, I just wanted to check in here to see if I was missing something. 😅
| }, | ||
|
|
||
| _handleDelay: function(e) { | ||
| _handleDelay: function(e: LayoutEvent) { |
There was a problem hiding this comment.
This is a bit curious. How come you decided to type this with LayoutEvent?
| }, | ||
|
|
||
| _handleLongDelay: function(e) { | ||
| _handleLongDelay: function(e: LayoutEvent) { |
There was a problem hiding this comment.
Same deal here. Why is this a LayoutEvent and not a PressEvent? This function calls _receiveSignal, which I think should accept a PressEvent.
| }, | ||
|
|
||
| _savePressInLocation: function(e) { | ||
| _savePressInLocation: function(e: LayoutEvent) { |
There was a problem hiding this comment.
Later on in the function, we call TouchEventUtils.extractSingleTouch, which expects to be called with the native event of a PressEvent. So, I think this type should be PressEvent and not LayoutEvent.
| }, | ||
|
|
||
| _endHighlight: function(e) { | ||
| _endHighlight: function(e: LayoutEvent) { |
There was a problem hiding this comment.
This method calls this.touchableHandleActivePressOut, which you typed as accepting a PressEvent inside TouchableNativeFeedback.android.js. So, shouldn't the type of e also be PressEvent?
| }, | ||
|
|
||
| _startHighlight: function(e) { | ||
| _startHighlight: function(e: LayoutEvent) { |
There was a problem hiding this comment.
Same deal as _endHighlight here.
| nextState: State, | ||
| signal: Signal, | ||
| e: LayoutEvent, | ||
| ) { |
There was a problem hiding this comment.
This event is forwarded to _startHighlight and _endHighlight. Shouldn't it therefore also be typed as a PressEvent?
| * @sideeffects | ||
| */ | ||
| _receiveSignal: function(signal, e) { | ||
| _receiveSignal: function(signal: Signal, e: LayoutEvent) { |
There was a problem hiding this comment.
This gets forwarded to _performSideEffectsForTransition. So, shouldn't e be typed as PressEvent?
| * | ||
| */ | ||
| touchableHandleResponderGrant: function(e) { | ||
| touchableHandleResponderGrant: function(e: SyntheticEvent<any>) { |
There was a problem hiding this comment.
I think this function accepts a PressEvent.
| * Place as callback for a DOM element's `onResponderTerminate` event. | ||
| */ | ||
| touchableHandleResponderTerminate: function(e) { | ||
| touchableHandleResponderTerminate: function(e: PressEvent) { |
There was a problem hiding this comment.
You've typed this function as accepting a PressEvent, but later on in the function, we forward this event to _receiveSignal, which accepts a LayoutEvent. There's a contradiction here.
Summary: Related to react#22100 Turn Flow strict mode on for Libraries/Components/Touchable/TouchableNativeFeedback.android.js. Pull Request resolved: react#22176 Reviewed By: TheSavior Differential Revision: D13033239 Pulled By: RSNara fbshipit-source-id: 57e89ce16040e6238e01e0437327db943a5f2581
Related to #22100
Turn Flow strict mode on for Libraries/Components/Touchable/TouchableNativeFeedback.android.js.
Test Plan:
Changelog:
[GENERAL][FIXED] - apply flow