react-native-glitter 1.0.3 → 1.0.4

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
@@ -167,6 +167,9 @@ function ControlledGlitter() {
167
167
  | `iterations` | `number` | `-1` | Number of animation cycles (-1 for infinite) |
168
168
  | `onAnimationStart` | `() => void` | - | Callback when animation starts |
169
169
  | `onAnimationComplete` | `() => void` | - | Callback when all iterations complete |
170
+ | `testID` | `string` | - | Test ID for e2e testing |
171
+ | `accessibilityLabel` | `string` | - | Accessibility label for screen readers |
172
+ | `accessible` | `boolean` | `true` | Whether the component is accessible |
170
173
 
171
174
  ## Examples
172
175
 
@@ -52,7 +52,7 @@ const HEIGHT_MULTIPLIER = 1.5;
52
52
  const NORMAL_FADE_RATIO = (HEIGHT_MULTIPLIER - 1) / HEIGHT_MULTIPLIER / 2;
53
53
  const ANIMATED_SEGMENTS = generateVerticalSegments(0.25);
54
54
  const NORMAL_SEGMENTS = generateVerticalSegments(NORMAL_FADE_RATIO);
55
- function GlitterComponent({ children, duration = 1500, delay = 400, color = 'rgba(255, 255, 255, 0.8)', angle = 20, shimmerWidth = 60, active = true, style, easing, mode = 'normal', position = 'center', direction = 'left-to-right', iterations = -1, onAnimationStart, onAnimationComplete, }) {
55
+ function GlitterComponent({ children, duration = 1500, delay = 400, color = 'rgba(255, 255, 255, 0.8)', angle = 20, shimmerWidth = 60, active = true, style, easing, mode = 'normal', position = 'center', direction = 'left-to-right', iterations = -1, onAnimationStart, onAnimationComplete, testID, accessibilityLabel, accessible = true, }) {
56
56
  const animatedValue = useRef(new Animated.Value(0)).current;
57
57
  const [containerWidth, setContainerWidth] = useState(0);
58
58
  const [containerHeight, setContainerHeight] = useState(0);
@@ -198,7 +198,7 @@ function GlitterComponent({ children, duration = 1500, delay = 400, color = 'rgb
198
198
  : [],
199
199
  },
200
200
  ], [layerWidth, lineHeight, isAnimated, transformOriginOffset, scaleY]);
201
- return (_jsxs(View, { style: [styles.container, style], onLayout: onLayout, children: [children, active && containerWidth > 0 && containerHeight > 0 && (_jsx(Animated.View, { style: shimmerContainerStyle, pointerEvents: "none", children: _jsx(View, { style: rotationWrapperStyle, children: shimmerLayers.map((layer, layerIndex) => (_jsx(Animated.View, { style: getShimmerLineStyle(layer.position), children: segments.map((segment, vIndex) => (_jsx(View, { style: [
201
+ return (_jsxs(View, { style: [styles.container, style], onLayout: onLayout, testID: testID, accessibilityLabel: accessibilityLabel, accessible: accessible, children: [children, active && containerWidth > 0 && containerHeight > 0 && (_jsx(Animated.View, { style: shimmerContainerStyle, pointerEvents: "none", children: _jsx(View, { style: rotationWrapperStyle, children: shimmerLayers.map((layer, layerIndex) => (_jsx(Animated.View, { style: getShimmerLineStyle(layer.position), children: segments.map((segment, vIndex) => (_jsx(View, { style: [
202
202
  styles.segment,
203
203
  {
204
204
  height: lineHeight * segment.heightRatio,
@@ -19,7 +19,13 @@ export interface GlitterProps {
19
19
  iterations?: number;
20
20
  onAnimationStart?: () => void;
21
21
  onAnimationComplete?: () => void;
22
+ /** Test ID for e2e testing */
23
+ testID?: string;
24
+ /** Accessibility label for screen readers */
25
+ accessibilityLabel?: string;
26
+ /** Whether the component is accessible (default: true) */
27
+ accessible?: boolean;
22
28
  }
23
- declare function GlitterComponent({ children, duration, delay, color, angle, shimmerWidth, active, style, easing, mode, position, direction, iterations, onAnimationStart, onAnimationComplete, }: GlitterProps): ReactElement;
29
+ declare function GlitterComponent({ children, duration, delay, color, angle, shimmerWidth, active, style, easing, mode, position, direction, iterations, onAnimationStart, onAnimationComplete, testID, accessibilityLabel, accessible, }: GlitterProps): ReactElement;
24
30
  export declare const Glitter: import("react").MemoExoticComponent<typeof GlitterComponent>;
25
31
  export default Glitter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-glitter",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "A beautiful shimmer/glitter effect component for React Native. Add a sparkling diagonal shine animation to any component!",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
package/src/index.tsx CHANGED
@@ -40,6 +40,12 @@ export interface GlitterProps {
40
40
  iterations?: number;
41
41
  onAnimationStart?: () => void;
42
42
  onAnimationComplete?: () => void;
43
+ /** Test ID for e2e testing */
44
+ testID?: string;
45
+ /** Accessibility label for screen readers */
46
+ accessibilityLabel?: string;
47
+ /** Whether the component is accessible (default: true) */
48
+ accessible?: boolean;
43
49
  }
44
50
 
45
51
  function generateGlitterOpacities(count: number, peak: number = 1): number[] {
@@ -124,6 +130,9 @@ function GlitterComponent({
124
130
  iterations = -1,
125
131
  onAnimationStart,
126
132
  onAnimationComplete,
133
+ testID,
134
+ accessibilityLabel,
135
+ accessible = true,
127
136
  }: GlitterProps): ReactElement {
128
137
  const animatedValue = useRef(new Animated.Value(0)).current;
129
138
  const [containerWidth, setContainerWidth] = useState(0);
@@ -332,7 +341,13 @@ function GlitterComponent({
332
341
  );
333
342
 
334
343
  return (
335
- <View style={[styles.container, style]} onLayout={onLayout}>
344
+ <View
345
+ style={[styles.container, style]}
346
+ onLayout={onLayout}
347
+ testID={testID}
348
+ accessibilityLabel={accessibilityLabel}
349
+ accessible={accessible}
350
+ >
336
351
  {children}
337
352
  {active && containerWidth > 0 && containerHeight > 0 && (
338
353
  <Animated.View style={shimmerContainerStyle} pointerEvents="none">