Skip to content
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

Remove setNextLayoutAnimationGroup call #4955

Merged
merged 2 commits into from
Sep 11, 2023

Conversation

tomekzaw
Copy link
Member

Summary

See Expensify/App#20552 (comment) for details.

Test plan

@tomekzaw tomekzaw marked this pull request as ready for review August 22, 2023 15:07
@ntdiary
Copy link

ntdiary commented Aug 22, 2023

Hi, a small question, we now replace uiBlockWithLayoutUpdateForRootView with reanimated_uiBlockWithLayoutUpdateForRootView, which means if we only remove the clearing code, when users call LayoutAnimation.configureNext with a different animation in the future, the warning will still appear.

[REAUtils swizzleMethod:@selector(uiBlockWithLayoutUpdateForRootView:)
forClass:[RCTUIManager class]
with:@selector(reanimated_uiBlockWithLayoutUpdateForRootView:)
fromClass:[self class]];

Here is my small test, code modified from issue #4815

App.jsx
import { useState } from "react";
import {
  StyleSheet,
  Text,
  TextInput,
  View,
  Keyboard,
  KeyboardAvoidingView,
  LayoutAnimation,
} from "react-native";
import Animated, { Layout, FadeInUp, FadeOutUp } from "react-native-reanimated";

const SET_TRUE_TO_REPRO = false;

export default function App() {
  const [focused, setFocused] = useState(false);

  return (
    <KeyboardAvoidingView style={{ flex: 1 }} enabled={SET_TRUE_TO_REPRO}>
      <View
        style={styles.container}
        onTouchEnd={() => focused && Keyboard.dismiss()}
      >
        <Text>Open up App.js to start working on your app!</Text>
        <Animated.View
          layout={Layout.duration(150)}
          style={{ backgroundColor: "red", width: focused ? 300 : 100 }}
        >
          <TextInput
            style={{ backgroundColor: "blue", width: 50 }}
            onFocus={() => setFocused(true)}
            onBlur={() => {
              setFocused(false);
              setTimeout(() => {
                LayoutAnimation.configureNext({
                  duration: 30,
                });
              }, 1000);
            }}
          />
        </Animated.View>
      </View>
    </KeyboardAvoidingView>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#fff",
    alignItems: "center",
    justifyContent: "center",
  },
});
test.mp4

@tomekzaw
Copy link
Member Author

@ntdiary Thanks for pointing out this problem as well as providing a repro. Looks like the fix which was supposed to resolve this issue doesn't work like expected so we'll need some more time to propose another solution.

@tomekzaw tomekzaw marked this pull request as draft August 25, 2023 09:17
@tomekzaw tomekzaw marked this pull request as ready for review September 11, 2023 09:29
@tomekzaw tomekzaw added this pull request to the merge queue Sep 11, 2023
Merged via the queue into main with commit e006f55 Sep 11, 2023
11 checks passed
@tomekzaw tomekzaw deleted the @tomekzaw/remove-layout-animation-group-cleanup branch September 11, 2023 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants