Skip to content

Commit acc67f8

Browse files
committed
feat(utils): add createShadow utility for consistent shadow styling
refactor(components): replace inline shadow styles with createShadow utility fix(components): remove redundant pointerEvents in disabled states style(components): clean up and standardize component styles
1 parent 89e8fdb commit acc67f8

File tree

25 files changed

+352
-524
lines changed

25 files changed

+352
-524
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ node_modules
1616
*.launch
1717
.settings/
1818
*.sublime-workspace
19+
.vscode
1920

2021
# IDE - VSCode
2122
.vscode/*

apps/example/app/ui/list/index.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
HFlashList,
1414
Typography,
1515
useTheme,
16+
utils,
1617
VFlashList,
1718
} from 'rnc-theme';
1819

@@ -348,14 +349,7 @@ const styles = StyleSheet.create({
348349
},
349350
postItem: {
350351
marginBottom: 16,
351-
shadowColor: '#000',
352-
shadowOffset: {
353-
width: 0,
354-
height: 2,
355-
},
356-
shadowOpacity: 0.1,
357-
shadowRadius: 4,
358-
elevation: 3,
352+
...utils.createShadow(3)
359353
},
360354
postHeader: {
361355
flexDirection: 'row',

apps/example/app/ui/modal/index.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
Typography,
1414
Box,
1515
Switcher,
16+
utils,
1617
} from 'rnc-theme';
1718

1819
export default function ModalScreen() {
@@ -434,11 +435,7 @@ export default function ModalScreen() {
434435
style={{
435436
flex: 1,
436437
borderRadius: theme.components.borderRadius.lg,
437-
shadowColor: '#ef4444',
438-
shadowOffset: { width: 0, height: 4 },
439-
shadowOpacity: 0.3,
440-
shadowRadius: 8,
441-
elevation: 6,
438+
...utils.createShadow(6)
442439
}}
443440
>
444441
<ButtonText>Delete</ButtonText>

apps/example/app/ui/scroll/index.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
ToggleMode,
2222
AnimatedVScroll,
2323
useScrollToHide,
24+
utils,
2425
} from 'rnc-theme';
2526

2627
interface Product {
@@ -387,11 +388,7 @@ const createStyles = (theme: Theme) =>
387388
right: 0,
388389
zIndex: 1000,
389390
backgroundColor: theme.colors.background,
390-
shadowColor: 'black',
391-
shadowOffset: { width: 0, height: 2 },
392-
shadowOpacity: 0.1,
393-
shadowRadius: 8,
394-
elevation: 5,
391+
...utils.createShadow(5)
395392
},
396393
headerContent: {
397394
height: HEADER_HEIGHT,
@@ -429,11 +426,7 @@ const createStyles = (theme: Theme) =>
429426
maxWidth: 80,
430427
},
431428
productCard: {
432-
shadowColor: 'black',
433-
shadowOffset: { width: 0, height: 2 },
434-
shadowOpacity: 0.1,
435-
shadowRadius: 8,
436-
elevation: 2,
429+
...utils.createShadow(2)
437430
},
438431
productImage: {
439432
width: '100%',

apps/example/app/ui/tooltip/index.tsx

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
useThemedStyles,
2020
Box,
2121
VScroll,
22+
utils,
2223
} from 'rnc-theme';
2324
import { Settings, Star, Heart, AlertCircle } from 'lucide-react-native';
2425

@@ -474,29 +475,15 @@ const createStyles = (theme: Theme) =>
474475
padding: theme.spacing.xl,
475476
borderRadius: theme.components.borderRadius.lg,
476477
margin: theme.spacing.lg,
477-
shadowColor: '#000',
478-
shadowOffset: {
479-
width: 0,
480-
height: 4,
481-
},
482-
shadowOpacity: 0.3,
483-
shadowRadius: 4.65,
484-
elevation: 8,
478+
...utils.createShadow(8)
485479
},
486480
modalContent: {
487481
backgroundColor: theme.colors.surface,
488482
padding: theme.spacing.xl,
489483
borderRadius: theme.components.borderRadius.lg,
490484
margin: theme.spacing.lg,
491485
maxWidth: 300,
492-
shadowColor: '#000',
493-
shadowOffset: {
494-
width: 0,
495-
height: 2,
496-
},
497-
shadowOpacity: 0.25,
498-
shadowRadius: 3.84,
499-
elevation: 5,
486+
...utils.createShadow(5)
500487
},
501488
hostContainer: {
502489
borderWidth: 2,

libs/rnc-theme/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rnc-theme",
3-
"version": "0.1.11",
3+
"version": "0.1.12",
44
"funding": {
55
"type": "github",
66
"url": "https://github.com/masumrpg/react-native-components"

0 commit comments

Comments
 (0)