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

com.swmansion.reanimated.layoutReanimation.AnimationsManager.prepareDataForAnimationWorklet #2959

Closed
1 of 3 tasks
dodiwknd opened this issue Feb 7, 2022 · 3 comments · Fixed by #3162
Closed
1 of 3 tasks
Assignees
Labels
Needs review Issue is ready to be reviewed by a maintainer Platform: Android This issue is specific to Android Repro provided A reproduction with a snippet of code, snack or repo is provided Wait for reply

Comments

@dodiwknd
Copy link

dodiwknd commented Feb 7, 2022

Description

Android app crash on production mode

Expected behavior

on release build app not crashing

Actual behavior & steps to reproduce

on release versions the app doesn't crash, but sends an error like:
image

Snack or minimal code example

on the screen capture

Package versions

name version
react-native 0.65.2
react-native-reanimated 2.3.1, 2.4.0
NodeJS 14.17.0
Xcode 13.2.1
Java 11.0.10
Gradle 4.2.2
expo -

Affected platforms

  • Android
  • iOS
  • Web
@dodiwknd dodiwknd added the Needs review Issue is ready to be reviewed by a maintainer label Feb 7, 2022
@github-actions github-actions bot added Platform: Android This issue is specific to Android Missing repro This issue need minimum repro scenario labels Feb 7, 2022
@kkafar kkafar self-assigned this Feb 9, 2022
@kkafar
Copy link
Member

kkafar commented Feb 9, 2022

Hi @dodiwknd!
Could you provide snack or repo with minimal reproducible example?
Could you also provide us with information in what situation does the error occur? Is it on startup or do you need to do something specific?

I've run into this issue, which seems to cover the same NPE. Can you try updating reanimated to 2.4.1?

@piaskowyk piaskowyk added the Close when stale This issue is going to be closed when there is no activity for a while label Feb 15, 2022
@github-actions github-actions bot removed the Close when stale This issue is going to be closed when there is no activity for a while label Feb 17, 2022
@dodiwknd
Copy link
Author

Hi @dodiwknd! Could you provide snack or repo with minimal reproducible example? Could you also provide us with information in what situation does the error occur? Is it on startup or do you need to do something specific?

I've run into this issue, which seems to cover the same NPE. Can you try updating reanimated to 2.4.1?

Unfortunately I can't provide samples, this application has been built very extensively, because I don't know for sure when this will happen. I think this is happening because the animated Layout has not been rendered and the user has navigated to another page. hope this can help you

@rpander93
Copy link

rpander93 commented Feb 22, 2022

ran across the same crash recently. we started seeing it once we added an Animated.View with a layout animation. so the suggestion from @dodiwknd may be correct. excerpt from the component:

export default function UpdateHighlightsBanner() {
  const dispatch = useDispatch();
  const { dismissedBanner, updatedOn } = useSelector((store: RootState) => store.settings.version);
  const { releaseNote } = useAppUpdate();

  const releaseNotes = releaseNote.replace(/; /g, ";").split(";");
  const daysSinceUpdate = differenceInDays(today, parseISO(updatedOn));

  const handleOnDismiss = () => {
    dispatch(settingsActions.dismissUpdatesBanner());
  };

  const visible = !dismissedBanner && daysSinceUpdate <= 3 && releaseNotes.length > 1;
  if (false === visible) return null;

  return (
    <Animated.View style={styles.container} exiting={FadeOut.duration(200)} layout={Layout.delay(250)}>
      <Image source={require("./update-highlights-confetti.webp")} style={styles.confetti} />
      <View style={styles.header}>
        <Text>Some text</Text>
        <Pressable onPress={handleOnDismiss}>
          <Icon name="close" />
        </Pressable>
      </View>
      <DisplayTextList icon="check" iconColor={Theme.palette.success} list={releaseNotes.slice(0, 3)} />
    </Animated.View>
  );
}

@github-actions github-actions bot added Repro provided A reproduction with a snippet of code, snack or repo is provided and removed Missing repro This issue need minimum repro scenario labels Feb 22, 2022
piaskowyk pushed a commit that referenced this issue Apr 11, 2022
## Description
ReactApplicationContext.getCurentContext sometimes return null. This causes a crash (NullPointerException) in reanimated due to not checking if context exists. As per react native's examples, we can only measure device metrics when current activity is not null (https://github.com/facebook/react-native/blob/8bd3edec88148d0ab1f225d2119435681fbbba33/ReactCommon/react/nativemodule/samples/platform/android/SampleTurboModule.java#L56)

Fixes #2959.

## Changes

Check if current activity is not null before measuring the device.
fluiddot pushed a commit to wordpress-mobile/react-native-reanimated that referenced this issue May 3, 2022
…re-mansion#3162)

## Description
ReactApplicationContext.getCurentContext sometimes return null. This causes a crash (NullPointerException) in reanimated due to not checking if context exists. As per react native's examples, we can only measure device metrics when current activity is not null (https://github.com/facebook/react-native/blob/8bd3edec88148d0ab1f225d2119435681fbbba33/ReactCommon/react/nativemodule/samples/platform/android/SampleTurboModule.java#L56)

Fixes software-mansion#2959.

## Changes

Check if current activity is not null before measuring the device.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs review Issue is ready to be reviewed by a maintainer Platform: Android This issue is specific to Android Repro provided A reproduction with a snippet of code, snack or repo is provided Wait for reply
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants