Uh oh!
There was an error while loading. Please reload this page.
Make AnimatedComponents and Touchables strict mode compatible - #24218
Make AnimatedComponents and Touchables strict mode compatible#24218Jyrno42 wants to merge 1 commit into
Conversation
analysis-bot
left a comment
There was a problem hiding this comment.
Code analysis results:
eslintfound some issues. Runyarn lint --fixto automatically fix problems.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
6b09f0e to
386dc80Compare
analysis-bot
left a comment
There was a problem hiding this comment.
Code analysis results:
eslintfound some issues. Runyarn lint --fixto automatically fix problems.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
386dc80 to
0215319CompareConvert all Touchables to be class based and remove UNSAFE props. Also renamed Touchable.Mixin.withoutDefaultFocusAndBlur to Touchable.MixinWithoutDefaultFocusAndBlur to improve flow automatic typings. Note: TouchableNativeFeedback uses ReactNative.findNodeHandle which triggers a warning in strict mode during a tap. I could not figure out how to remove the need for that call. Related to react#22186
0215319 to
4b0c955CompareJyrno42
commented
Mar 30, 2019
Will look into the test failures tomorrow. |
cpojer
commented
Apr 3, 2019
Thank you for this PR! Moving function calls from unsafe lifecycle methods to the constructor unfortunately doesn't actually fix any issues, it just masks them further. For Touchable, we are hoping to move those out of React Native core as part of the Lean Core effort, but first we will need to introduce a replacement. For now, we are not looking to make any larger changes to it that may break them. Would you mind sending a new PR that just fixes the |
Jyrno42
commented
Apr 3, 2019
So I should convert the animated component to use hooks too like you recommended in the scrollview PR? |
Jyrno42
commented
Apr 3, 2019
Also this might be more of a support question so I don't expect an answer, but why isn't calling attachProps from constructor the same as doing it in UNSAFE_componentWillMount? Given that it essentially only sets up the _propsAnimated value in the first pass. Note: I do see the problem with the willReceiveProps and didUpdate case (attachProps call used to run before render, now it runs after it). |
Jyrno42
commented
Apr 3, 2019
@cpojer Can you clarify the above things for me if possible |
gaearon
commented
Apr 3, 2019
It is the same. But I haven't looked in the code in detail so I don't know for sure whether it's a problem or not. Just moving all code from |
gaearon
commented
Apr 3, 2019
In particular, a PR that moves things from |
Summary
Convert all Touchables to be class based and remove UNSAFE props. Also renamed
Touchable.Mixin.withoutDefaultFocusAndBlur to Touchable.MixinWithoutDefaultFocusAndBlur
to improve flow automatic typings.
Note: TouchableNativeFeedback uses ReactNative.findNodeHandle which triggers a
warning in strict mode during a tap. I could not figure out how to remove the need for
that call.
Related to #22186
Changelog
[General] [Fixed] - Converted createAnimatedComponent to be compatible with StrictMode
[General] [Fixed] - Converted Touchable.Mixin to be compatible with StrictMode and updated built-in Touchable components.
[General] [Changed] - Renamed Touchable.Mixin.withoutDefaultFocusAndBlur to Touchable.MixinWithoutDefaultFocusAndBlur
Test Plan
Tested manually via RNTester by opening StrictMode example and ensuring no strict-mode warnings are rendered. Also made sure onPress handlers and effects still work for all of them.