* Cancelling animation frame on unmounting the component
* avoid calling cancel animation twice
* Update app/components/post_draft/post_draft.js
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
(cherry picked from commit 789cf9ab54)
Co-authored-by: Anurag Shivarathri <anurag6713@gmail.com>
This commit is contained in:
parent
0561e9a78b
commit
5a3c9839bf
1 changed files with 7 additions and 3 deletions
|
|
@ -41,6 +41,9 @@ export default class PostDraft extends PureComponent {
|
|||
|
||||
componentWillUnmount() {
|
||||
EventEmitter.off(UPDATE_NATIVE_SCROLLVIEW, this.updateNativeScrollView);
|
||||
if (this.resetScrollView) {
|
||||
cancelAnimationFrame(this.resetScrollView);
|
||||
}
|
||||
}
|
||||
|
||||
handleInputQuickAction = (value) => {
|
||||
|
|
@ -51,9 +54,10 @@ export default class PostDraft extends PureComponent {
|
|||
|
||||
updateNativeScrollView = (scrollViewNativeID) => {
|
||||
if (this.keyboardTracker?.current && this.props.scrollViewNativeID === scrollViewNativeID) {
|
||||
const resetScrollView = requestAnimationFrame(() => {
|
||||
this.keyboardTracker.current.resetScrollView(scrollViewNativeID);
|
||||
cancelAnimationFrame(resetScrollView);
|
||||
this.resetScrollView = requestAnimationFrame(() => {
|
||||
this.keyboardTracker.current?.resetScrollView(scrollViewNativeID);
|
||||
cancelAnimationFrame(this.resetScrollView);
|
||||
this.resetScrollView = null;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue