@popp0102/nova 0.3.3 → 0.5.0

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.
@@ -0,0 +1,33 @@
1
+ import { View, Pressable, StyleSheet } from "react-native";
2
+
3
+ export default function Card({ children, onPress, style }) {
4
+ const cardContent = (
5
+ <View style={[styles.card, style]}>
6
+ {children}
7
+ </View>
8
+ );
9
+
10
+ if (onPress) {
11
+ return (
12
+ <Pressable
13
+ style={({ pressed }) => [pressed && styles.cardPressed]}
14
+ onPress={onPress}
15
+ >
16
+ {cardContent}
17
+ </Pressable>
18
+ );
19
+ }
20
+
21
+ return cardContent;
22
+ }
23
+
24
+ const styles = StyleSheet.create({
25
+ card: {
26
+ backgroundColor: 'white',
27
+ borderRadius: 16,
28
+ padding: 16,
29
+ },
30
+ cardPressed: {
31
+ opacity: 0.5,
32
+ },
33
+ });
@@ -0,0 +1,23 @@
1
+ import { Text, StyleSheet } from "react-native";
2
+
3
+ const SIZES = {
4
+ small: 12,
5
+ medium: 14,
6
+ large: 16,
7
+ };
8
+
9
+ export default function Subtitle({ children, color = '#777', size = 'medium' }) {
10
+ const fontSize = SIZES[size] || SIZES.medium;
11
+
12
+ return (
13
+ <Text style={[styles.subtitle, { color, fontSize }]}>
14
+ {children}
15
+ </Text>
16
+ );
17
+ }
18
+
19
+ const styles = StyleSheet.create({
20
+ subtitle: {
21
+ fontStyle: 'italic',
22
+ },
23
+ });
@@ -0,0 +1,48 @@
1
+ import { useEffect, useRef } from 'react';
2
+ import { Animated } from 'react-native';
3
+
4
+ export default function ShakeView({
5
+ shake,
6
+ children,
7
+ style,
8
+ duration = 50,
9
+ distance = 10,
10
+ intensity = 4
11
+ }) {
12
+ const shakeAnim = useRef(new Animated.Value(0)).current;
13
+
14
+ useEffect(() => {
15
+ if (shake) {
16
+ const shakeSequence = [];
17
+
18
+ // Create alternating shake animations based on intensity
19
+ for (let i = 0; i < intensity; i++) {
20
+ const direction = i % 2 === 0 ? distance : -distance;
21
+ shakeSequence.push(
22
+ Animated.timing(shakeAnim, {
23
+ toValue: direction,
24
+ duration,
25
+ useNativeDriver: true
26
+ })
27
+ );
28
+ }
29
+
30
+ // Return to center
31
+ shakeSequence.push(
32
+ Animated.timing(shakeAnim, {
33
+ toValue: 0,
34
+ duration,
35
+ useNativeDriver: true
36
+ })
37
+ );
38
+
39
+ Animated.sequence(shakeSequence).start();
40
+ }
41
+ }, [shake, duration, distance, intensity]);
42
+
43
+ return (
44
+ <Animated.View style={[style, { transform: [{ translateX: shakeAnim }] }]}>
45
+ {children}
46
+ </Animated.View>
47
+ );
48
+ }
package/lib/index.js CHANGED
@@ -1,5 +1,8 @@
1
1
  export { default as Button } from './components/Button';
2
2
  export { default as Modal } from './components/Modal';
3
3
  export { default as Badge } from './components/Badge';
4
+ export { default as Card } from './components/Card';
5
+ export { default as Subtitle } from './components/Subtitle';
4
6
  export { default as FadeView } from './components/animations/FadeView';
5
7
  export { default as SlideView } from './components/animations/SlideView';
8
+ export { default as ShakeView } from './components/animations/ShakeView';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popp0102/nova",
3
- "version": "0.3.3",
3
+ "version": "0.5.0",
4
4
  "description": "React Native component library",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.js",