Skip to content

Commit

Permalink
Update @react-native-community/masked-view to 0.1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
esamelson committed May 26, 2020
1 parent 09e3931 commit 561370b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public RNCMaskedView(Context context) {
protected void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);

// redraw mask element to support animated elements
updateBitmapMask();

// draw the mask
if (mBitmapMask != null) {
mPaint.setXfermode(mPorterDuffXferMode);
Expand All @@ -42,13 +45,21 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);

if (changed) {
View maskView = getChildAt(0);
maskView.setVisibility(View.VISIBLE);
this.mBitmapMask = getBitmapFromView(maskView);
maskView.setVisibility(View.INVISIBLE);
updateBitmapMask();
}
}

private void updateBitmapMask() {
if (this.mBitmapMask != null) {
this.mBitmapMask.recycle();
}

View maskView = getChildAt(0);
maskView.setVisibility(View.VISIBLE);
this.mBitmapMask = getBitmapFromView(maskView);
maskView.setVisibility(View.INVISIBLE);
}

public static Bitmap getBitmapFromView(final View view) {
view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());

Expand Down
2 changes: 1 addition & 1 deletion apps/native-component-list/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dependencies": {
"@expo/react-native-action-sheet": "^2.0.1",
"@react-native-community/datetimepicker": "2.4.0",
"@react-native-community/masked-view": "0.1.6",
"@react-native-community/masked-view": "0.1.10",
"@react-native-community/netinfo": "5.9.2",
"@react-native-community/segmented-control": "1.6.1",
"@react-native-community/viewpager": "3.3.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/expo/bundledNativeModules.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"expo-store-review": "~2.1.0",
"expo-updates": "~0.2.5",
"@react-native-community/datetimepicker": "2.4.0",
"@react-native-community/masked-view": "0.1.6",
"@react-native-community/masked-view": "0.1.10",
"@react-native-community/viewpager": "3.3.0",
"@react-native-community/segmented-control": "1.6.1",
"expo-error-recovery": "~1.1.0",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2416,10 +2416,10 @@
dependencies:
invariant "^2.2.4"

"@react-native-community/masked-view@0.1.6":
version "0.1.6"
resolved "https://registry.yarnpkg.com/@react-native-community/masked-view/-/masked-view-0.1.6.tgz#c7f2ac187c1f25aa8c30d11baa8f4398eca3bb84"
integrity sha512-PpMoeXwPUoldCRKDuSi+zK5rT+sJTW6ri6RdGPkSKRzU77Q1d9IaR0O5IKvBj0XSdL3p+dcOa05gk35aGDffBQ==
"@react-native-community/masked-view@0.1.10":
version "0.1.10"
resolved "https://registry.yarnpkg.com/@react-native-community/masked-view/-/masked-view-0.1.10.tgz#5dda643e19e587793bc2034dd9bf7398ad43d401"
integrity sha512-rk4sWFsmtOw8oyx8SD3KSvawwaK7gRBSEIy2TAwURyGt+3TizssXP1r8nx3zY+R7v2vYYHXZ+k2/GULAT/bcaQ==

"@react-native-community/netinfo@5.9.2":
version "5.9.2"
Expand Down

0 comments on commit 561370b

Please sign in to comment.