react-native-v8 icon indicating copy to clipboard operation
react-native-v8 copied to clipboard

Support react native reanimated 2

Open tamacroft opened this issue 3 years ago • 11 comments

is this lib support react native reanimated 2 which is required to use hermes in their documentation?

tamacroft avatar Mar 06 '21 13:03 tamacroft

reanimated2 creates a Hermes runtime in there code, the only way to support V8 should be patch reanimated2 and build from source unfortunately.

Kudo avatar Mar 09 '21 02:03 Kudo

@Kudo When I switched the engine to V8,there was an error in reanimated2,this means that just switching engine code is not enough

hanhailong avatar Apr 07 '21 12:04 hanhailong

Hey @Kudo I have tried to add support for V8 runtime in Reanimated, but I found an issue. When I call a function with callWithThis() this doesn't set jsThis property. This happens exactly in this line: https://github.com/software-mansion/react-native-reanimated/blob/%40piaskowyk/flipper/Common/cpp/SharedItems/MutableValue.cpp#L46 This code works on Hermes and JSC without problems. Maybe you know a quick answer or suggest why? If not I can try to debug it and provide more information.

piaskowyk avatar May 07 '21 09:05 piaskowyk

@piaskowyk now that callWithThis is fixed is there a possibility to get Reanimated working with V8?

mkilburn60 avatar Oct 08 '21 19:10 mkilburn60

before reanimated support building from source, i had forked reanimated and add v8 support in https://github.com/Kudo/react-native-reanimated/commit/4b069950c4b75b836350b1803485819939ce632b

to those you would like to try react-native-v8 + reanimated, here is a one step how: yarn add react-native-reanimated@npm:[email protected]

Kudo avatar Oct 11 '21 12:10 Kudo

@Kudo I'm getting this error when trying to build for Android: Transform's input file does not exist: /Users/.../node_modules/react-native-reanimated/android/react-native-reanimated-66-v8.aar. (See https://issuetracker.google.com/issues/158753935)

What did I miss? Thank you!

egueiros avatar Nov 04 '21 23:11 egueiros

@Kudo I'm getting this error when trying to build for Android: Transform's input file does not exist: /Users/.../node_modules/react-native-reanimated/android/react-native-reanimated-66-v8.aar. (See https://issuetracker.google.com/issues/158753935)

What did I miss? Thank you!

Oh, I think it's because I'm using RN 0.66.1 🤦‍♂️ I see 64-v8.aar and 65-v8.aar.

egueiros avatar Nov 05 '21 00:11 egueiros

@Kudo Could you help to add 0.66 support? Thanks!

samjayhk avatar Jan 12 '22 07:01 samjayhk

This simple animation crashes on Android Animated.View :(

 const goesDown = useSharedValue(false);

  const progress = useSharedValue(0);

  useEffect(() => {
    progress.value = withRepeat(
      withTiming(1, { duration: 1000 }, () => {
        goesDown.value = !goesDown.value;
      }),
      -1,
      true,
    );
  }, []);
  const smallCircle = useAnimatedStyle(() => {
    // const width =  Pixel(24)
    // const top = Pixel(1)
    'worklet';
    const scale = interpolate(progress.value, [0, 1], [0, 1]);
    return {
      transform: [{ scale }],
      height: 30,
      width: 30,
      backgroundColor: 'red',
      borderColor: 'green',
      borderRadius: 15,
      borderWidth: 1,
      alignSelf: 'center',
      position: 'relative',
      top: 10,
    };
  });

gpbaculio avatar Apr 07 '22 17:04 gpbaculio

@gpbaculio could you help to try the new approach for v8 + reanimated? it's not merged from reanimated but you can still preview by installing the node package from github. i use the new approach with your example code, it works for me 🤔

Kudo avatar Apr 08 '22 10:04 Kudo

@Kudo seems the new approach works on the sample, but trying to add it on my current project does not. I get this error:

was successfully found. However, this package itself specifies a main module field that could not be resolved (/Users/glendonphilippbaculio/Desktop/marketplace-app/node_modules/react-native-reanimated/lib/Animated.js. Indeed, none of these files exist

it works if i import like "react-native-reanimated/src/Animated"

gpbaculio avatar Apr 11 '22 04:04 gpbaculio