Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

keyframes don't animate color #6583

Open
jbrodriguez opened this issue Oct 9, 2024 · 0 comments
Open

keyframes don't animate color #6583

jbrodriguez opened this issue Oct 9, 2024 · 0 comments
Labels
Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snippet of code, snack or repo is provided Reproducible 🎉

Comments

@jbrodriguez
Copy link

Description

keyframes should animate colors, but they currently won't

they do animated the transform, but not the color

import React from 'react';
import {StyleSheet} from 'react-native';
import Animated, {
  Keyframe,
  interpolateColor,
  useAnimatedStyle,
  useSharedValue,
} from 'react-native-reanimated';

const viewKeyframes = new Keyframe({
  0: {
    color: '#FF0000',
    transform: [{scaleX: 1}, {scaleY: 1}],
  },
  50: {
    color: 'white',
    transform: [{scaleX: 0.85}, {scaleY: 0.85}],
  },
  75: {
    color: '#FFFF00',
    transform: [{scaleX: 1.15}, {scaleY: 1.15}],
  },
  100: {
    color: 'red',
    transform: [{scaleX: 1}, {scaleY: 1}],
  },
});

export const Test = () => {
  return (
    <Animated.View style={styles.container}>
      <Animated.Text
        entering={viewKeyframes.duration(5000)}
        style={styles.text}>
        TEST
      </Animated.Text>
    </Animated.View>
  );
};

const styles = StyleSheet.create({
  container: {
    justifyContent: 'center',
    alignItems: 'center',
    // flex: 1,
  },
  text: {
    fontSize: 100,
    color: '#FF0000', // Initial color
  },
});

Steps to reproduce

  1. copy snippet
  2. run snippt

Snack or a link to a repository

https://snack.expo.dev/uhT9qHSEruNJJBCc2w_j6

Reanimated version

3.15.4

React Native version

0.76.0-rc.2

Platforms

iOS

JavaScript runtime

Hermes

Workflow

React Native

Architecture

Fabric (New Architecture)

Build type

Debug app & dev bundle

Device

iOS simulator

Device model

No response

Acknowledgements

Yes

@github-actions github-actions bot added Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snippet of code, snack or repo is provided labels Oct 9, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snippet of code, snack or repo is provided Reproducible 🎉
Projects
None yet
Development

No branches or pull requests

2 participants