@umituz/react-native-mascot 1.2.0 → 1.3.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-mascot",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Interactive mascot system for React Native apps - Customizable animated characters with Lottie and SVG support, mood system, and easy integration",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Mascot Component
|
|
3
3
|
*
|
|
4
4
|
* A simplified, configurable mascot component that works across different apps.
|
|
5
5
|
* Uses Reanimated animations and accepts dynamic theme colors and image sources.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```tsx
|
|
9
|
-
* import {
|
|
9
|
+
* import { Mascot } from '@umituz/react-native-mascot';
|
|
10
10
|
*
|
|
11
|
-
* <
|
|
11
|
+
* <Mascot
|
|
12
12
|
* source={require('../assets/mascot.png')}
|
|
13
13
|
* state="thinking"
|
|
14
14
|
* size="large"
|
|
@@ -33,7 +33,7 @@ import Animated, {
|
|
|
33
33
|
|
|
34
34
|
import type { MascotState } from './types';
|
|
35
35
|
|
|
36
|
-
export interface
|
|
36
|
+
export interface MascotProps {
|
|
37
37
|
/** Image source for the mascot (require() or URI) */
|
|
38
38
|
source: ImageSource;
|
|
39
39
|
|
|
@@ -74,7 +74,7 @@ const SIZE_PRESETS: Record<string, number> = {
|
|
|
74
74
|
large: 140,
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
function
|
|
77
|
+
function MascotComponent({
|
|
78
78
|
source,
|
|
79
79
|
state = 'idle',
|
|
80
80
|
size = 'medium',
|
|
@@ -83,7 +83,7 @@ function SimpleMascotComponent({
|
|
|
83
83
|
animate = true,
|
|
84
84
|
style,
|
|
85
85
|
testID = 'simple-mascot',
|
|
86
|
-
}:
|
|
86
|
+
}: MascotProps) {
|
|
87
87
|
const translateY = useSharedValue(0);
|
|
88
88
|
const scale = useSharedValue(1);
|
|
89
89
|
const rotate = useSharedValue(0);
|
|
@@ -238,16 +238,16 @@ function SimpleMascotComponent({
|
|
|
238
238
|
</Animated.View>
|
|
239
239
|
{message ? (
|
|
240
240
|
<View style={[styles.messageContainer, { backgroundColor }]}>
|
|
241
|
-
<
|
|
241
|
+
<MascotText style={{ color: textColor }}>{message}</MascotText>
|
|
242
242
|
</View>
|
|
243
243
|
) : null}
|
|
244
244
|
</View>
|
|
245
245
|
);
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
-
|
|
248
|
+
MascotComponent.displayName = 'Mascot';
|
|
249
249
|
|
|
250
|
-
const
|
|
250
|
+
const MascotText = memo(({ style, children }: { style: any; children: React.ReactNode }) => (
|
|
251
251
|
<View>
|
|
252
252
|
{typeof children === 'string' ? (
|
|
253
253
|
<Animated.Text style={style}>{children}</Animated.Text>
|
|
@@ -257,7 +257,7 @@ const SimpleMascotText = memo(({ style, children }: { style: any; children: Reac
|
|
|
257
257
|
</View>
|
|
258
258
|
));
|
|
259
259
|
|
|
260
|
-
export const
|
|
260
|
+
export const Mascot = memo(MascotComponent);
|
|
261
261
|
|
|
262
262
|
const styles = StyleSheet.create({
|
|
263
263
|
container: {
|
package/src/presentation.ts
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
export { MascotView } from './presentation/components/MascotView';
|
|
8
8
|
export type { MascotViewProps } from './presentation/components/MascotView';
|
|
9
9
|
|
|
10
|
-
export {
|
|
11
|
-
export type {
|
|
10
|
+
export { Mascot } from './presentation/components/Mascot';
|
|
11
|
+
export type { MascotProps } from './presentation/components/Mascot';
|
|
12
12
|
|
|
13
13
|
export { LottieMascot } from './presentation/components/LottieMascot';
|
|
14
14
|
export type { LottieMascotProps } from './presentation/components/LottieMascot';
|