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

fix: disable shared global context and fix reanimated hanging issue #210

Merged
merged 2 commits into from
Aug 20, 2024

Conversation

Kudo
Copy link
Owner

@Kudo Kudo commented Aug 20, 2024

Why

fixes #208

How

Test Plan

tested on reanimated 3.15.0 with the following code

import React from 'react';
import { View, Button, StyleSheet } from 'react-native';
import Animated, {
  useSharedValue,
  useAnimatedStyle,
  withRepeat,
  withTiming,
  Easing,
  ReduceMotion,
} from 'react-native-reanimated';

const App = () => {
  const rotation = useSharedValue(0);

  const animatedStyle = useAnimatedStyle(() => {
    return {
      transform: [{ rotateZ: `${rotation.value}deg` }],
    };
  });

  const startInfiniteRotation = () => {
    rotation.value = withRepeat(
      withTiming(360, {
        duration: 2000,
        easing: Easing.linear,
        reduceMotion: ReduceMotion.Never,
      }),
      -1, // -1 for infinite repetition,
      false,
      () => {},
      ReduceMotion.Never,
    );
  };

  return (
    <View style={styles.container}>
      <Animated.View style={[styles.box, animatedStyle]} />
      <Button title="Start Rotation" onPress={startInfiniteRotation} />
    </View>
  );
};

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

export default App;

@Kudo Kudo merged commit 8733225 into main Aug 20, 2024
10 checks passed
@Kudo Kudo deleted the @kudo/fix-reanimated branch August 20, 2024 18:05
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.

Build fails on Android with Reanimated 3.14.0
1 participant