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

[Web LA] Fix default transitions. #6124

Merged
merged 1 commit into from
Jun 18, 2024
Merged

[Web LA] Fix default transitions. #6124

merged 1 commit into from
Jun 18, 2024

Conversation

m-bert
Copy link
Contributor

@m-bert m-bert commented Jun 14, 2024

Summary

Yesterday we've discovered that some basic transitions don't work on web anymore. Turns out that animationName was undefined, therefore transitions were not created.

This PR adds presetName field into transitions, so we can easily obtain their name.

Note

Similar thing was done in #5562, so I believe that we can stick to this convention.

Test plan

Tested on the following code:
import Animated, {
  BounceInLeft,
  FadeOutRight,
  FadingTransition,
} from 'react-native-reanimated';
import { Button, StyleSheet, View } from 'react-native';

import React from 'react';

export default function BasicLayoutAnimation() {
  const [state, setState] = React.useState(false);
  const [visible, setVisible] = React.useState(true);

  return (
    <View style={styles.container}>
      <Button onPress={() => setVisible(!visible)} title="Create/Remove" />
      <Button onPress={() => setState(!state)} title="Update" />
      {visible && (
        <Animated.View
          entering={BounceInLeft}
          layout={FadingTransition}
          exiting={FadeOutRight.duration(500)}
          style={[
            styles.box,
            {
              marginLeft: state ? 200 : 0,
              backgroundColor: state ? 'red' : 'blue',
            },
          ]}
        />
      )}
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    marginTop: 300,
  },
  box: {
    width: 100,
    height: 100,
  },
});

@m-bert m-bert requested a review from piaskowyk June 14, 2024 13:15
@m-bert m-bert added this pull request to the merge queue Jun 18, 2024
Merged via the queue into main with commit f483c75 Jun 18, 2024
7 checks passed
@m-bert m-bert deleted the @mbert/fix-transitions-name branch June 18, 2024 09:59
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.

2 participants