react-native-gleam 1.0.0 → 1.0.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.
package/README.md CHANGED
@@ -35,10 +35,11 @@ No config plugin needed — autolinking and codegen handle everything.
35
35
 
36
36
  ### Claude Code
37
37
 
38
- Install the plugin to help Claude guide your first implementation — it knows every prop, pattern, and pitfall.
38
+ Install the plugin, then run `/gleam` to get guided through setup.
39
39
 
40
40
  ```sh
41
- claude plugin add --from github:RamboWasReal/react-native-gleam
41
+ claude plugin marketplace add RamboWasReal/react-native-gleam
42
+ claude plugin install react-native-gleam
42
43
  ```
43
44
 
44
45
  ## Usage
@@ -319,10 +319,10 @@ class GleamView(context: Context) : ReactViewGroup(context) {
319
319
  }
320
320
 
321
321
  private fun blendColor(from: Int, to: Int, ratio: Float): Int {
322
- val r = Color.red(from) + ((Color.red(to) - Color.red(from)) * ratio).toInt()
323
- val g = Color.green(from) + ((Color.green(to) - Color.green(from)) * ratio).toInt()
324
- val b = Color.blue(from) + ((Color.blue(to) - Color.blue(from)) * ratio).toInt()
325
- val a = Color.alpha(from) + ((Color.alpha(to) - Color.alpha(from)) * ratio).toInt()
322
+ val r = (Color.red(from) + ((Color.red(to) - Color.red(from)) * ratio).toInt()).coerceIn(0, 255)
323
+ val g = (Color.green(from) + ((Color.green(to) - Color.green(from)) * ratio).toInt()).coerceIn(0, 255)
324
+ val b = (Color.blue(from) + ((Color.blue(to) - Color.blue(from)) * ratio).toInt()).coerceIn(0, 255)
325
+ val a = (Color.alpha(from) + ((Color.alpha(to) - Color.alpha(from)) * ratio).toInt()).coerceIn(0, 255)
326
326
  return Color.argb(a, r, g, b)
327
327
  }
328
328
 
package/ios/GleamView.mm CHANGED
@@ -51,6 +51,7 @@ static void _registerView(GleamView *view) {
51
51
  if (_viewCount >= _viewCapacity) {
52
52
  NSUInteger newCap = _viewCapacity == 0 ? 16 : _viewCapacity * 2;
53
53
  GleamView * __strong *newBuf = (GleamView * __strong *)calloc(newCap, sizeof(GleamView *));
54
+ if (!newBuf) return;
54
55
  if (_views) {
55
56
  for (NSUInteger i = 0; i < _viewCount; i++) {
56
57
  newBuf[i] = _views[i];
@@ -263,15 +264,18 @@ static void _unregisterView(GleamView *view) {
263
264
  const auto &newViewProps = *std::static_pointer_cast<GleamViewProps const>(props);
264
265
 
265
266
  if (oldViewProps.speed != newViewProps.speed) {
266
- _speed = fmax(newViewProps.speed / 1000.0, 0.001);
267
+ double s = newViewProps.speed / 1000.0;
268
+ _speed = (isnan(s) || isinf(s) || s <= 0) ? 1.0 : fmax(s, 0.001);
267
269
  }
268
270
 
269
271
  if (oldViewProps.delay != newViewProps.delay) {
270
- _delay = newViewProps.delay / 1000.0;
272
+ double d = newViewProps.delay / 1000.0;
273
+ _delay = (isnan(d) || isinf(d)) ? 0.0 : d;
271
274
  }
272
275
 
273
276
  if (oldViewProps.transitionDuration != newViewProps.transitionDuration) {
274
- _transitionDuration = newViewProps.transitionDuration / 1000.0;
277
+ double td = newViewProps.transitionDuration / 1000.0;
278
+ _transitionDuration = (isnan(td) || isinf(td) || td < 0) ? 0.3 : td;
275
279
  }
276
280
 
277
281
  if (oldViewProps.transitionType != newViewProps.transitionType) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-gleam",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Native-powered shimmer loading effect for React Native",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",