react-native-security-suite 0.9.1 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,6 @@ package com.securitysuite;
3
3
  import android.content.Context;
4
4
  import android.view.View;
5
5
  import android.widget.FrameLayout;
6
-
7
6
  import com.facebook.react.uimanager.ThemedReactContext;
8
7
  import com.facebook.react.uimanager.UIManagerModule;
9
8
 
@@ -22,28 +21,37 @@ public class SecureView extends FrameLayout {
22
21
 
23
22
  private final Runnable measureAndLayout = () -> {
24
23
  measure(
25
- MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.EXACTLY),
26
- MeasureSpec.makeMeasureSpec(getHeight(), MeasureSpec.EXACTLY));
24
+ MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.EXACTLY),
25
+ MeasureSpec.makeMeasureSpec(getHeight(), MeasureSpec.EXACTLY));
27
26
  layout(getLeft(), getTop(), getRight(), getBottom());
28
27
  };
29
28
 
30
29
  @Override
31
30
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
31
+ int parentWidth = MeasureSpec.getSize(widthMeasureSpec);
32
+ int parentHeight = MeasureSpec.getSize(heightMeasureSpec);
33
+
32
34
  int maxWidth = 0;
33
35
  int maxHeight = 0;
34
36
 
35
37
  for (int i = 0; i < getChildCount(); i++) {
36
38
  View child = getChildAt(i);
37
39
  if (child.getVisibility() != GONE) {
38
- child.measure(widthMeasureSpec, MeasureSpec.UNSPECIFIED);
40
+ child.measure(
41
+ MeasureSpec.makeMeasureSpec(parentWidth, MeasureSpec.AT_MOST),
42
+ MeasureSpec.makeMeasureSpec(parentHeight, MeasureSpec.AT_MOST));
39
43
 
40
44
  maxWidth = Math.max(maxWidth, child.getMeasuredWidth());
41
45
  maxHeight = Math.max(maxHeight, child.getMeasuredHeight());
42
46
  }
43
47
  }
44
48
 
45
- int finalWidth = Math.max(maxWidth, getSuggestedMinimumWidth());
46
- int finalHeight = Math.max(maxHeight, getSuggestedMinimumHeight());
49
+ final int finalWidth = Math.max(maxWidth, getSuggestedMinimumWidth()) > 0
50
+ ? Math.max(maxWidth, getSuggestedMinimumWidth())
51
+ : 100;
52
+ final int finalHeight = Math.max(maxHeight, getSuggestedMinimumHeight()) > 0
53
+ ? Math.max(maxHeight, getSuggestedMinimumHeight())
54
+ : 100;
47
55
 
48
56
  setMeasuredDimension(finalWidth, finalHeight);
49
57
 
@@ -51,14 +59,19 @@ public class SecureView extends FrameLayout {
51
59
  UIManagerModule uiManagerModule = reactContext.getNativeModule(UIManagerModule.class);
52
60
 
53
61
  if (uiManagerModule != null) {
54
- reactContext.runOnNativeModulesQueueThread(() -> uiManagerModule.updateNodeSize(getId(), finalWidth, finalHeight));
62
+ reactContext.runOnNativeModulesQueueThread(() ->
63
+ uiManagerModule.updateNodeSize(getId(), finalWidth, finalHeight)
64
+ );
55
65
  }
56
66
  }
57
67
 
58
-
59
68
  public void setContentView(View view) {
69
+ if (contentView != null) {
70
+ removeView(contentView);
71
+ }
60
72
  contentView = view;
61
73
  addView(contentView);
74
+ requestLayout();
62
75
  }
63
76
 
64
77
  public View getContentView() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-security-suite",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
4
4
  "description": "Security solution for React Native",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/commonjs/index.js",