Skip to content

[v3][iOS] useAnimatedKeyboard smooth animation breaks with keyboardDismissMode="on-drag" #4194

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

Closed
azhavrid opened this issue Mar 8, 2023 · 3 comments · Fixed by #4266
Closed
Labels
Missing info The user didn't precise the problem enough Missing repro This issue need minimum repro scenario Needs review Issue is ready to be reviewed by a maintainer Platform: iOS This issue is specific to iOS

Comments

@azhavrid
Copy link

azhavrid commented Mar 8, 2023

Description

Smooth animation glitches when ScrollView with prop keyboardDismissMode="on-drag" dismisses keyboard.

Attaching video preview of this issue. At first closed 2 times keyboard with simple tap and later on closed it by dragging ScrollView.

Video Preview

Screenshot.2023-03-09.at.00.45.07.mp4

Code to reproduce

import React from 'react';
import {ScrollView, TextInput, View} from 'react-native';
import Animated, {
  useAnimatedKeyboard,
  useAnimatedStyle,
} from 'react-native-reanimated';

function App() {
  const keyboard = useAnimatedKeyboard();
  const translateStyle = useAnimatedStyle(() => {
    return {
      backgroundColor: 'red',
      transform: [{translateY: -keyboard.height.value}],
    };
  });

  return (
    <ScrollView keyboardDismissMode="on-drag">
      <View style={{height: 500, backgroundColor: 'blue'}} />
      <Animated.View style={translateStyle}>
        <TextInput />
      </Animated.View>
    </ScrollView>
  );
}

export default App;

Other tested cases

  • Keyboard.dismiss() doesn't break animation
  • Closing gesture for react-navigation stack breaks animation
  • Moving app to background with opened keyboard breaks animation

Steps to reproduce

  1. Focus input
  2. Drag ScrolView with keyboardDismissMode="on-drag"

Versions

  • "react-native": "0.71.4",
  • "react-native-reanimated": "3.0.2"

Platforms

iOS

@azhavrid azhavrid added the Needs review Issue is ready to be reviewed by a maintainer label Mar 8, 2023
@github-actions github-actions bot added Platform: iOS This issue is specific to iOS Missing repro This issue need minimum repro scenario labels Mar 8, 2023
@github-actions
Copy link

github-actions bot commented Mar 8, 2023

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

@github-actions github-actions bot added the Missing info The user didn't precise the problem enough label Mar 8, 2023
@github-actions
Copy link

github-actions bot commented Mar 8, 2023

Hey! 👋

It looks like you've omitted a few important sections from the issue template.

Please complete Snack or a link to a repository, Reanimated version and React Native version sections.

@azhavrid azhavrid changed the title [v3][iOS] useKeyboardAnimated smooth animation breaks with keyboardDismissMode="on-drag" [v3][iOS] useAnimatedKeyboard smooth animation breaks with keyboardDismissMode="on-drag" Mar 9, 2023
@tomekzaw
Copy link
Member

tomekzaw commented Mar 23, 2023

May be fixed with #4266.

piaskowyk added a commit that referenced this issue Mar 24, 2023
## Summary

When you try to hide animation during keyboard opening, this ends the
current animation and starts another one. I added a missing flag setter
to prevent the clearing of the displayLink object.

## Test plan

| Before      | After |
| ----------- | ----------- |
| <video
src="https://user-images.githubusercontent.com/36106620/227270299-5f7cd5e6-21b3-47c3-85fb-2860fb9fbac9.mov"
/> | <video
src="https://user-images.githubusercontent.com/36106620/227269574-bf94ebc9-3132-49d9-bd2d-f5cd8671990c.mov"
/> |

Fixes
#4194
fluiddot pushed a commit to wordpress-mobile/react-native-reanimated that referenced this issue Jun 5, 2023
## Summary

When you try to hide animation during keyboard opening, this ends the
current animation and starts another one. I added a missing flag setter
to prevent the clearing of the displayLink object.

## Test plan

| Before      | After |
| ----------- | ----------- |
| <video
src="https://user-images.githubusercontent.com/36106620/227270299-5f7cd5e6-21b3-47c3-85fb-2860fb9fbac9.mov"
/> | <video
src="https://user-images.githubusercontent.com/36106620/227269574-bf94ebc9-3132-49d9-bd2d-f5cd8671990c.mov"
/> |

Fixes
software-mansion#4194
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing info The user didn't precise the problem enough Missing repro This issue need minimum repro scenario Needs review Issue is ready to be reviewed by a maintainer Platform: iOS This issue is specific to iOS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants