diff --git a/android-npm/react-native-reanimated-66-hermes.aar b/android-npm/react-native-reanimated-66-hermes.aar index 1f3fe47f590..1dbb657fe52 100644 Binary files a/android-npm/react-native-reanimated-66-hermes.aar and b/android-npm/react-native-reanimated-66-hermes.aar differ diff --git a/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java b/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java index cbc4e0f5945..152ceb7649c 100644 --- a/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +++ b/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java @@ -1,5 +1,6 @@ package com.swmansion.reanimated.layoutReanimation; +import android.app.Activity; import android.util.DisplayMetrics; import android.util.Log; import android.view.View; @@ -364,12 +365,18 @@ public HashMap prepareDataForAnimationWorklet( preparedValues.put(key, PixelUtil.toDIPFromPixel((int) values.get(key))); } - DisplayMetrics displaymetrics = new DisplayMetrics(); - mContext.getCurrentActivity().getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); - int height = displaymetrics.heightPixels; - int width = displaymetrics.widthPixels; - preparedValues.put("windowWidth", PixelUtil.toDIPFromPixel(width)); - preparedValues.put("windowHeight", PixelUtil.toDIPFromPixel(height)); + DisplayMetrics displayMetrics = new DisplayMetrics(); + Activity currentActivity = mContext.getCurrentActivity(); + if (currentActivity != null) { + currentActivity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); + int height = displayMetrics.heightPixels; + int width = displayMetrics.widthPixels; + preparedValues.put("windowWidth", PixelUtil.toDIPFromPixel(width)); + preparedValues.put("windowHeight", PixelUtil.toDIPFromPixel(height)); + } else { + preparedValues.put("windowWidth", PixelUtil.toDIPFromPixel(0)); + preparedValues.put("windowHeight", PixelUtil.toDIPFromPixel(0)); + } return preparedValues; } diff --git a/package.json b/package.json index 3da3e6e49ee..be8b875ce19 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-reanimated", - "version": "2.4.1-wp-1", + "version": "2.4.1-wp-2", "description": "More powerful alternative to Animated library for React Native.", "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", diff --git a/react-native-reanimated-2.4.1-wp-1.tgz b/react-native-reanimated-2.4.1-wp-1.tgz deleted file mode 100644 index 52ad267e55d..00000000000 Binary files a/react-native-reanimated-2.4.1-wp-1.tgz and /dev/null differ diff --git a/react-native-reanimated-2.4.1-wp-2.tgz b/react-native-reanimated-2.4.1-wp-2.tgz new file mode 100644 index 00000000000..4d6da6f75d4 Binary files /dev/null and b/react-native-reanimated-2.4.1-wp-2.tgz differ