react-native-actionsheet
react-native-actionsheet copied to clipboard
Update ActionSheetCustom.js
fixes warning
Mb merge with small update?
When will this get merged? The warning is very annoying...
Maybe @xiaoyann can merge?
I have read the code. In my opinion, there is a better way to fix this warning. The method componentWillReceiveProps
only re-calculate the value of this.translateY
. To fix this warning, just move the calculation into shouldComponentUpdate
like below:
![Screen Shot 2020-06-10 at 11 05 41](https://user-images.githubusercontent.com/22119727/84225831-5b6b4200-ab0a-11ea-8d3c-8aef0c76fa74.png)
It works fine because shouldComponentUpdate
also be executed before re-rendering like componentWillReceiveProps
. For the first rendering, translateY
has been calculated in constructor.
There is no need to use UNSFAFE_componentWillReceiveProps
anymore. It is unsafe :D
I think shouldComponentUpdate
is not supposed to modify state? It's basically a read-only function that should have no side effects.
I think maybe a better way would be to get rid of classes, bump the dependency on react version with hooks and use hooks. Update this packages major version and it would be a clean slate again.
I think
shouldComponentUpdate
is not supposed to modify state? It's basically a read-only function that should have no side effects. I think maybe a better way would be to get rid of classes, bump the dependency on react version with hooks and use hooks. Update this packages major version and it would be a clean slate again.
Thank you for your comment. I will try to rewrite the component using Hook API.
Thanks for your efforts, lets hope the repo owners still maintain this repo and merge some PRs.
@thanhtunguet any updates on this?
@thanhtunguet any updates on this?
I have rewritten the package and created a new issue #114 . It works but the stylesheet is broken. I don't have enough time to find out why.
@thanhtunguet any updates on this?
See my package here:
https://www.npmjs.com/package/thanhtunguet-react-native-actionsheet I fixed styles and all warnings.
Did you update your #114 accordingly?
#114
Nope, I have to use this package in my project so that I can not wait for pull request acceptance or any reply of the issue. I have published the package with my own name.
Did you update your #114 accordingly?
Nope, I have closed the issue because of days I had not received any reply, published my own package to use in my project. I need someone to test it, tell me that it works properly so I will create a pull request back to this repository.
@pke
See my #115 pull request please.
Will this be merged any time soon ?