react-native-glance-chat 0.1.4 → 0.1.5

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.
@@ -9,7 +9,7 @@ buildscript {
9
9
  // example/android/settings.gradle and the README integration section. During local
10
10
  // development, publish with `./gradlew publishToMavenLocal -Psdk.version=1.0.0`
11
11
  // (produces 1.0.0-local) and set sdkVersion to "1.0.0-local" to resolve from mavenLocal().
12
- sdkVersion: "1.0.10"
12
+ sdkVersion: "1.0.11"
13
13
  ]
14
14
 
15
15
  ext.getExtOrDefault = { prop ->
@@ -48,6 +48,10 @@ class GlanceProductTryOnWidgetViewManager :
48
48
  (view as WidgetHostLayout).widgetEnabled = value
49
49
  }
50
50
 
51
+ override fun setAlign(view: FrameLayout, value: String?) {
52
+ (view as WidgetHostLayout).widgetAlign = value ?: "end"
53
+ }
54
+
51
55
  override fun getExportedCustomBubblingEventTypeConstants(): Map<String, Any> {
52
56
  return mapOf(
53
57
  "onPress" to mapOf(
@@ -83,6 +87,13 @@ class GlanceProductTryOnWidgetViewManager :
83
87
  if (isAttachedToWindow) renderContent()
84
88
  }
85
89
 
90
+ /** 'end' (default) hugs the host's right edge; 'start' hugs the left. */
91
+ var widgetAlign: String = "end"
92
+ set(value) {
93
+ field = value
94
+ if (isAttachedToWindow) renderContent()
95
+ }
96
+
86
97
  override fun onAttachedToWindow() {
87
98
  super.onAttachedToWindow()
88
99
  renderContent()
@@ -109,11 +120,18 @@ class GlanceProductTryOnWidgetViewManager :
109
120
  }
110
121
  val currentVariantId = variantId
111
122
  val currentEnabled = widgetEnabled
123
+ val currentAlignment =
124
+ if (widgetAlign == "start") {
125
+ androidx.compose.ui.Alignment.CenterStart
126
+ } else {
127
+ androidx.compose.ui.Alignment.CenterEnd
128
+ }
112
129
  view.setContent {
113
130
  ProductTryOnWidget(
114
131
  onClick = { emitPress() },
115
132
  variantId = currentVariantId,
116
- enabled = currentEnabled
133
+ enabled = currentEnabled,
134
+ alignment = currentAlignment
117
135
  )
118
136
  }
119
137
  // RN (Fabric) won't re-run layout for natively-added children, so measure
@@ -9,6 +9,12 @@ export interface NativeProps extends ViewProps {
9
9
  variantId: string;
10
10
  /** Whether the widget is interactive. Defaults to true on the native side. */
11
11
  enabled?: boolean;
12
+ /**
13
+ * Edge the pill hugs inside its host box: 'end' (default) right-aligns, 'start'
14
+ * left-aligns — pass 'start' when the host is positioned on a product image's
15
+ * bottom-left so the expanded "Try On" label grows rightward unclipped.
16
+ */
17
+ align?: string;
12
18
  /** Fired when the widget is tapped (maps to the native onClick lambda). */
13
19
  onPress?: BubblingEventHandler<PressEvent> | null;
14
20
  }
@@ -6,6 +6,12 @@ export interface NativeProps extends ViewProps {
6
6
  variantId: string;
7
7
  /** Whether the widget is interactive. Defaults to true on the native side. */
8
8
  enabled?: boolean;
9
+ /**
10
+ * Edge the pill hugs inside its host box: 'end' (default) right-aligns, 'start'
11
+ * left-aligns — pass 'start' when the host is positioned on a product image's
12
+ * bottom-left so the expanded "Try On" label grows rightward unclipped.
13
+ */
14
+ align?: string;
9
15
  /** Fired when the widget is tapped (maps to the native onClick lambda). */
10
16
  onPress?: BubblingEventHandler<PressEvent> | null;
11
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"GlanceProductTryOnWidgetNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/GlanceProductTryOnWidgetNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAG/F,KAAK,UAAU,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;AAE/B,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,0EAA0E;IAC1E,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,oBAAoB,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;CACnD;wBAII,aAAa,CAAC,WAAW,CAAC;AAF/B,wBAEgC"}
1
+ {"version":3,"file":"GlanceProductTryOnWidgetNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/GlanceProductTryOnWidgetNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAG/F,KAAK,UAAU,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;AAE/B,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,0EAA0E;IAC1E,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,OAAO,CAAC,EAAE,oBAAoB,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;CACnD;wBAII,aAAa,CAAC,WAAW,CAAC;AAF/B,wBAEgC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-glance-chat",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "React Native wrapper for the Glance Chat SDK (Android + iOS)",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -9,6 +9,12 @@ export interface NativeProps extends ViewProps {
9
9
  variantId: string;
10
10
  /** Whether the widget is interactive. Defaults to true on the native side. */
11
11
  enabled?: boolean;
12
+ /**
13
+ * Edge the pill hugs inside its host box: 'end' (default) right-aligns, 'start'
14
+ * left-aligns — pass 'start' when the host is positioned on a product image's
15
+ * bottom-left so the expanded "Try On" label grows rightward unclipped.
16
+ */
17
+ align?: string;
12
18
  /** Fired when the widget is tapped (maps to the native onClick lambda). */
13
19
  onPress?: BubblingEventHandler<PressEvent> | null;
14
20
  }