question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[2.2.3] withTiming use in a transform crashes the app on android

See original GitHub issue

Description

Android crashes on mount when attempting to use withTiming inside a transform animated style with


Error: Exception in HostFunction: java.lang.AssertionError: Illegal type provided
    at _updateProps (native)
    at _f (JavaScript:1:511)
    at _f (native)
    at styleUpdater (JavaScript:1:1657)
    at styleUpdater (native)
    at _f (JavaScript:1:139)
    at _f (native)
  at void com.swmansion.reanimated.AndroidErrorHandler.raise(java.lang.String) (AndroidErrorHandler.java:6)
  at void com.swmansion.reanimated.Scheduler.triggerUI() (Scheduler.java:-2)
  at void com.swmansion.reanimated.Scheduler.access$100(com.swmansion.reanimated.Scheduler) (Scheduler.java:9)
  at void com.swmansion.reanimated.Scheduler$1.run() (Scheduler.java:21)
  at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:938)
  at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:99)
  at void com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(android.os.Message) (MessageQueueThreadHandler.java:27)
  at void android.os.Looper.loop() (Looper.java:223)
  at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:7656)
  at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
  at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:592)
  at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:947)

Expected behavior

  • able to use timing transitions in transforms

Actual behavior & steps to reproduce

  • Commenting out the transform: [{ translateY: translateY.value }] and reloading the app will not crash the app

Snack or minimal code example

import { useAnimatedStyle, useDerivedValue, useSharedValue, withTiming } from "react-native-reanimated";
import { View } from "react-native";

export default function App() {
  const translateY = useSharedValue(0);

  useDerivedValue(() => {
    translateY.value = withTiming(200);
  });

  const animatedStyle = useAnimatedStyle(() => ({
    transform: [{ translateY: translateY.value }], // commenting this out will no longer crash the app
    opacity: translateY.value,
  }));

  return <View style={{ flex: 1, backgroundColor: "red" }} />;
}

Package versions

  • React Native: 0.66.1
  • React Native Reanimated: 2.2.3
  • NodeJS: 14.17.3
  • Xcode: -
  • Java & Gradle: -

Affected platforms

  • Android
  • iOS
  • Web

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:6
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
Khuongnbcommented, Nov 16, 2021

Hi, any update for this issue? seem like currently we can’t use withTiming with Easing.linear

0reactions
AuroPickcommented, Jan 27, 2022

Try this

import { Easing } from 'react-native-reanimated' // IMPORT FROM REANIMATED

translateY.value = withTiming(200, {
    easing: Easing.bezier(0.33, 0.01, 0, 1)
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to transform react-native-reanimated-65-jsc.aar [closed]
BUILD FAILED in 19s error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs ...
Read more >
Application crashes when attached to debugger (Nexus5X 7.1 ...
My Android Studio specs are the same as listed above except I'm using gradle 2.2.3. The app launches and attaches to the debugger...
Read more >
1 2 3 4 5 6 7 8 9 10 11 12 13 A B C D E F - RS Components
about the installation and use of LOGO! 8 Base Modules with more enhanced features, the. LOGO! TDE (Text Display with Ethernet interfaces), ...
Read more >
Understand and replay Android app crashes with Session ...
Businesses in highly regulated sectors such as government, healthcare, and banking use Session Replay for a variety of use cases. Dynatrace ...
Read more >
© 2014 Nima Honarmand - CORE
enable a diverse range of use-cases (such as debugging and security analysis). ... this pass transforms it for high replay parallelism.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found