react-native-security-suite 0.9.1 → 0.9.2

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,20 +21,25 @@ 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());
@@ -45,20 +49,29 @@ public class SecureView extends FrameLayout {
45
49
  int finalWidth = Math.max(maxWidth, getSuggestedMinimumWidth());
46
50
  int finalHeight = Math.max(maxHeight, getSuggestedMinimumHeight());
47
51
 
52
+ if (finalWidth == 0)
53
+ finalWidth = 100;
54
+ if (finalHeight == 0)
55
+ finalHeight = 100;
56
+
48
57
  setMeasuredDimension(finalWidth, finalHeight);
49
58
 
50
59
  ThemedReactContext reactContext = (ThemedReactContext) getContext();
51
60
  UIManagerModule uiManagerModule = reactContext.getNativeModule(UIManagerModule.class);
52
61
 
53
62
  if (uiManagerModule != null) {
54
- reactContext.runOnNativeModulesQueueThread(() -> uiManagerModule.updateNodeSize(getId(), finalWidth, finalHeight));
63
+ reactContext
64
+ .runOnNativeModulesQueueThread(() -> uiManagerModule.updateNodeSize(getId(), finalWidth, finalHeight));
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.2",
4
4
  "description": "Security solution for React Native",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/commonjs/index.js",