react-native-football-formation 1.0.3 → 1.0.6

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
@@ -81,6 +81,63 @@ export default function FormationScreen() {
81
81
  }
82
82
  ```
83
83
 
84
+ ### Complete Player Object Example
85
+
86
+ Here's a complete player object showing all available fields and stats:
87
+
88
+ ```tsx
89
+ const teamLineup = {
90
+ players: [
91
+ // Example 1: Player with all stats
92
+ {
93
+ playerId: "5il4uc7d941ndwjl0qu97y7dh",
94
+ matchName: "Marcelo Grohe",
95
+ shirtNumber: 43,
96
+ rating: "7.2",
97
+ position: "Goalkeeper",
98
+ positionSide: "Centre",
99
+ formationPlace: "1",
100
+ stats: [
101
+ { type: "totalSubOff", value: "1" },
102
+ { type: "goals", value: 1 },
103
+ { type: "yellowCard", value: "1" },
104
+ { type: "redCard", value: "1" },
105
+ { type: "goalAssist", value: "0" },
106
+ { type: "ownGoals", value: "1" }
107
+ ]
108
+ },
109
+ // Example 2: Player with stats array containing null values
110
+ {
111
+ playerId: "abc123",
112
+ matchName: "Lionel Messi",
113
+ shirtNumber: 10,
114
+ rating: "9.5",
115
+ position: "Forward",
116
+ positionSide: "Right",
117
+ formationPlace: "10",
118
+ stats: [
119
+ { type: "goals", value: 2 },
120
+ null,
121
+ { type: "goalAssist", value: "1" },
122
+ null,
123
+ { type: "yellowCard", value: "0" }
124
+ ]
125
+ },
126
+ // ... 9 more players with formationPlace "2" to "9", "11"
127
+ ],
128
+ formationUsed: "433" // or "4-3-3"
129
+ };
130
+
131
+ <FormationField
132
+ lineup={teamLineup}
133
+ getPlayerPhotoUrl={(playerId) =>
134
+ `https://example.com/players/${playerId}.png`
135
+ }
136
+ />
137
+ ```
138
+
139
+ **Note:** The `stats` array can contain both `PlayerStats` objects and `null` values. Null values are safely ignored.
140
+
84
141
  ### With Custom Theme
85
142
 
86
143
  ```tsx
@@ -89,6 +146,7 @@ export default function FormationScreen() {
89
146
  theme={{
90
147
  colors: {
91
148
  primary: '#FF0000',
149
+ playerName: '#FFFFFF',
92
150
  success: '#00FF00',
93
151
  warning: '#FFAA00',
94
152
  },
@@ -166,11 +224,11 @@ interface Player {
166
224
  matchName: string;
167
225
  shirtNumber: number;
168
226
  formationPlace?: string; // "1" to "11"
169
- stats: PlayerStats[] | null[];
227
+ stats: (PlayerStats | null)[]; // Array can contain PlayerStats objects or null values
170
228
  }
171
229
 
172
230
  interface PlayerStats {
173
- type: string; // "goals", "yellowCard", "redCard", "goalAssist", etc.
231
+ type: 'goals' | 'yellowCard' | 'redCard' | 'goalAssist' | 'totalSubOff' | 'ownGoals';
174
232
  value: string | number;
175
233
  }
176
234
  ```
@@ -184,6 +242,7 @@ interface FormationTheme {
184
242
  blue: string;
185
243
  white: string;
186
244
  text: string;
245
+ playerName: string;
187
246
  border: string;
188
247
  warning: string;
189
248
  success: string;
@@ -322,27 +381,47 @@ The component supports 24 different tactical formations:
322
381
 
323
382
  ## Player Statistics
324
383
 
325
- The component automatically displays player statistics when available:
384
+ The component automatically displays player statistics when available. The `stats` array can contain `PlayerStats` objects or `null` values.
385
+
386
+ ### Supported Stat Types
326
387
 
327
- - **Goals** - Football icon with count
328
- - 👟 **Assists** - Kicker icon
329
- - 🟨 **Yellow Card** - Yellow card indicator
330
- - 🟥 **Red Card** - Red card indicator
331
- - 🔄 **Substitution** - Substitution icon
332
- - ⚽🔴 **Own Goals** - Own goal icon with count
388
+ | Stat Type | Display | Description |
389
+ |-----------|---------|-------------|
390
+ | `goals` | Football icon + count | Number of goals scored |
391
+ | `goalAssist` | 👟 Kicker icon | Number of assists provided |
392
+ | `yellowCard` | 🟨 Yellow card | Yellow card received |
393
+ | `redCard` | 🟥 Red card | Red card received |
394
+ | `totalSubOff` | 🔄 Substitution icon | Player was substituted off |
395
+ | `ownGoals` | ⚽🔴 Own goal icon + count | Number of own goals |
333
396
 
334
- Statistics are extracted from the `stats` array in the player data:
397
+ ### Example Player Stats
398
+
399
+ The `stats` array can contain both stat objects and `null` values:
335
400
 
336
401
  ```typescript
337
402
  {
403
+ playerId: '1',
404
+ matchName: 'Cristiano Ronaldo',
405
+ shirtNumber: 7,
406
+ formationPlace: '9',
338
407
  stats: [
339
- { type: 'goals', value: '2' },
340
- { type: 'yellowCard', value: '1' },
341
- { type: 'goalAssist', value: '1' },
408
+ { type: 'goals', value: 1 }, // Scored 1 goal
409
+ { type: 'yellowCard', value: '1' }, // Received yellow card
410
+ { type: 'goalAssist', value: '0' }, // No assists (won't display)
411
+ { type: 'redCard', value: '1' }, // Received red card
412
+ { type: 'totalSubOff', value: '1' }, // Was substituted
413
+ { type: 'ownGoals', value: '1' }, // Scored own goal
414
+ null, // Null values are safely handled
342
415
  ]
343
416
  }
344
417
  ```
345
418
 
419
+ **Note:**
420
+ - Values can be either `string` or `number` types
421
+ - Stats with a value of `'0'` or `0` won't be displayed
422
+ - The `stats` array safely handles `null` entries
423
+ - If `stats` is empty or all values are `null`, no stats will be displayed
424
+
346
425
  ## Utilities
347
426
 
348
427
  The package exports utility functions for advanced use cases:
@@ -380,6 +459,8 @@ The package is written in TypeScript and includes full type definitions. Import
380
459
  import type {
381
460
  TeamLineup,
382
461
  Player,
462
+ PlayerStats,
463
+ PlayerStatType,
383
464
  LineupFormationPlayer,
384
465
  FormationTheme,
385
466
  FormationFieldProps,
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1 +1 @@
1
- {"version":3,"file":"FormationField.d.ts","sourceRoot":"","sources":["../../src/components/FormationField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAUvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;;AA2K/C,wBAA0C"}
1
+ {"version":3,"file":"FormationField.d.ts","sourceRoot":"","sources":["../../src/components/FormationField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAUvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;;AA4K/C,wBAA0C"}
@@ -48,10 +48,11 @@ const FormationField = ({ lineup, width = screenWidth + 10, height = 395, theme:
48
48
  const lineupTransformed = (0, react_1.useMemo)(() => {
49
49
  if (!lineup)
50
50
  return [];
51
- const formation = lineup?.formationUsed?.split('').join('-') || '4-3-3';
52
- return (0, utils_1.transformLineupByFormationPlace)(lineup, formation, getPlayerPhotoUrl);
51
+ // Normalize formation: remove dashes then add them back properly
52
+ const normalizedFormation = lineup?.formationUsed?.replace(/-/g, '').split('').join('-') || '4-3-3';
53
+ return (0, utils_1.transformLineupByFormationPlace)(lineup, normalizedFormation, getPlayerPhotoUrl);
53
54
  }, [lineup, getPlayerPhotoUrl]);
54
- const formationDisplay = lineup?.formationUsed?.split('').join('-') || '4-3-3';
55
+ const formationDisplay = lineup?.formationUsed?.replace(/-/g, '').split('').join('-') || '4-3-3';
55
56
  return (<react_native_1.ImageBackground source={fieldImage} style={[
56
57
  styles.footballField,
57
58
  {
@@ -102,6 +102,7 @@ const PlayerCard = ({ player, fieldWidth, fieldHeight, theme, onPress, style, na
102
102
  }}>
103
103
  {Number(player?.ownGoals) > 1 && (<react_native_1.View style={[
104
104
  react_native_1.I18nManager.isRTL ? { paddingRight: 2 } : { paddingLeft: 2 },
105
+ { justifyContent: 'center' }
105
106
  ]}>
106
107
  <react_native_1.Text style={[
107
108
  styles.goalsText,
@@ -247,7 +248,7 @@ const PlayerCard = ({ player, fieldWidth, fieldHeight, theme, onPress, style, na
247
248
  styles.playerName,
248
249
  {
249
250
  fontSize: theme.typography.playerNameSize,
250
- color: theme.colors.text,
251
+ color: theme.colors.playerName,
251
252
  fontFamily: theme.typography.fontFamily,
252
253
  },
253
254
  nameStyle,
@@ -317,7 +318,6 @@ const styles = react_native_1.StyleSheet.create({
317
318
  },
318
319
  goalsText: {
319
320
  includeFontPadding: false,
320
- lineHeight: 13.8,
321
321
  },
322
322
  footballIcon: {},
323
323
  yellowCardWrapper: {
@@ -1 +1 @@
1
- {"version":3,"file":"defaultTheme.d.ts","sourceRoot":"","sources":["../../src/theme/defaultTheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,cAsC1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,GACrB,cAAc,OAAO,CAAC,cAAc,CAAC,KACpC,cAqBF,CAAC"}
1
+ {"version":3,"file":"defaultTheme.d.ts","sourceRoot":"","sources":["../../src/theme/defaultTheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,cAuC1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,GACrB,cAAc,OAAO,CAAC,cAAc,CAAC,KACpC,cAqBF,CAAC"}
@@ -11,6 +11,7 @@ exports.defaultTheme = {
11
11
  blue: '#2194FF',
12
12
  white: '#ffffff',
13
13
  text: '#13151F',
14
+ playerName: '#ffffff',
14
15
  border: '#96CBCB',
15
16
  warning: '#FFA500',
16
17
  success: '#34C759',
@@ -1,6 +1,10 @@
1
1
  /**
2
2
  * Type definitions for React Native Football Formation component
3
3
  */
4
+ /**
5
+ * Supported player statistics types
6
+ */
7
+ export type PlayerStatType = 'goals' | 'yellowCard' | 'redCard' | 'goalAssist' | 'totalSubOff' | 'ownGoals';
4
8
  export interface PlayerStats {
5
9
  type: string;
6
10
  value: string | number;
@@ -14,7 +18,7 @@ export interface Player {
14
18
  positionSide?: string;
15
19
  formationPosition?: string;
16
20
  formationPlace?: string;
17
- stats: PlayerStats[] | null[];
21
+ stats: (PlayerStats | null)[];
18
22
  }
19
23
  export interface TeamLineup {
20
24
  players: Player[];
@@ -1 +1 @@
1
- {"version":3,"file":"formation.types.d.ts","sourceRoot":"","sources":["../../src/types/formation.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,WAAW;IAC1B,I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AO,GACP,OAAO,GACP,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,QAAQ,GACR,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAAC;CAChC,CAAC"}
1
+ {"version":3,"file":"formation.types.d.ts","sourceRoot":"","sources":["../../src/types/formation.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB,OAAO,GACP,YAAY,GACZ,SAAS,GACT,YAAY,GACZ,aAAa,GACb,UAAU,CAAC;AAEf,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,OAAO,GACP,WAAW,GACX,OAAO,GACP,OAAO,GACP,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,QAAQ,GACR,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAAC;CAChC,CAAC"}
@@ -6,6 +6,7 @@ export interface FormationThemeColors {
6
6
  blue: string;
7
7
  white: string;
8
8
  text: string;
9
+ playerName?: string;
9
10
  border: string;
10
11
  warning: string;
11
12
  success: string;
@@ -1 +1 @@
1
- {"version":3,"file":"theme.types.d.ts","sourceRoot":"","sources":["../../src/types/theme.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAA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AAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,qBAAqB;IACpC,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,wBAAwB;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,0BAA0B;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,oBAAoB,CAAC;IAC7B,OAAO,EAAE,qBAAqB,CAAC;IAC/B,UAAU,EAAE,wBAAwB,CAAC;IACrC,YAAY,EAAE,0BAA0B,CAAC;CAC1C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-football-formation",
3
- "version": "1.0.3",
3
+ "version": "1.0.6",
4
4
  "description": "A highly customizable React Native component for displaying football/soccer team formations with player positions and match statistics",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -15,7 +15,8 @@
15
15
  "LICENSE"
16
16
  ],
17
17
  "scripts": {
18
- "build": "tsc",
18
+ "build": "tsc && npm run copy-assets",
19
+ "copy-assets": "mkdir -p dist/assets/images && cp -r src/assets/images/* dist/assets/images/",
19
20
  "prepare": "npm run build",
20
21
  "test": "jest",
21
22
  "lint": "eslint src/ --ext .ts,.tsx",
@@ -44,11 +44,12 @@ const FormationField: React.FC<FormationFieldProps> = ({
44
44
  const lineupTransformed = useMemo(() => {
45
45
  if (!lineup) return [];
46
46
 
47
- const formation = lineup?.formationUsed?.split('').join('-') || '4-3-3';
48
- return transformLineupByFormationPlace(lineup, formation, getPlayerPhotoUrl);
47
+ // Normalize formation: remove dashes then add them back properly
48
+ const normalizedFormation = lineup?.formationUsed?.replace(/-/g, '').split('').join('-') || '4-3-3';
49
+ return transformLineupByFormationPlace(lineup, normalizedFormation, getPlayerPhotoUrl);
49
50
  }, [lineup, getPlayerPhotoUrl]);
50
51
 
51
- const formationDisplay = lineup?.formationUsed?.split('').join('-') || '4-3-3';
52
+ const formationDisplay = lineup?.formationUsed?.replace(/-/g, '').split('').join('-') || '4-3-3';
52
53
 
53
54
  return (
54
55
  <ImageBackground
@@ -143,6 +143,7 @@ const PlayerCard: React.FC<PlayerCardProps> = ({
143
143
  <View
144
144
  style={[
145
145
  I18nManager.isRTL ? { paddingRight: 2 } : { paddingLeft: 2 },
146
+ {justifyContent: 'center'}
146
147
  ]}>
147
148
  <Text
148
149
  style={[
@@ -327,7 +328,7 @@ const PlayerCard: React.FC<PlayerCardProps> = ({
327
328
  styles.playerName,
328
329
  {
329
330
  fontSize: theme.typography.playerNameSize,
330
- color: theme.colors.text,
331
+ color: theme.colors.playerName,
331
332
  fontFamily: theme.typography.fontFamily,
332
333
  },
333
334
  nameStyle,
@@ -403,7 +404,6 @@ const styles = StyleSheet.create({
403
404
  },
404
405
  goalsText: {
405
406
  includeFontPadding: false,
406
- lineHeight: 13.8,
407
407
  },
408
408
  footballIcon: {},
409
409
  yellowCardWrapper: {
@@ -10,6 +10,7 @@ export const defaultTheme: FormationTheme = {
10
10
  blue: '#2194FF',
11
11
  white: '#ffffff',
12
12
  text: '#13151F',
13
+ playerName: '#ffffff',
13
14
  border: '#96CBCB',
14
15
  warning: '#FFA500',
15
16
  success: '#34C759',
@@ -2,8 +2,19 @@
2
2
  * Type definitions for React Native Football Formation component
3
3
  */
4
4
 
5
+ /**
6
+ * Supported player statistics types
7
+ */
8
+ export type PlayerStatType =
9
+ | 'goals'
10
+ | 'yellowCard'
11
+ | 'redCard'
12
+ | 'goalAssist'
13
+ | 'totalSubOff'
14
+ | 'ownGoals';
15
+
5
16
  export interface PlayerStats {
6
- type: string;
17
+ type: string; // Accepts any string, but PlayerStatType provides supported values
7
18
  value: string | number;
8
19
  }
9
20
 
@@ -16,7 +27,7 @@ export interface Player {
16
27
  positionSide?: string;
17
28
  formationPosition?: string;
18
29
  formationPlace?: string;
19
- stats: PlayerStats[] | null[];
30
+ stats: (PlayerStats | null)[]; // Array can contain PlayerStats objects or null values
20
31
  }
21
32
 
22
33
  export interface TeamLineup {
@@ -7,6 +7,7 @@ export interface FormationThemeColors {
7
7
  blue: string;
8
8
  white: string;
9
9
  text: string;
10
+ playerName?: string;
10
11
  border: string;
11
12
  warning: string;
12
13
  success: string;