Skip to content

Commit ac7149e

Browse files
committed
fix(native): remove invalid box shadow and use default font family in react native
1 parent f477279 commit ac7149e

5 files changed

Lines changed: 29 additions & 23 deletions

File tree

docs/CustomizeTheme.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ const getButtonStyles = buttonVariables => (appearance, color, ...componentProps
113113
return {
114114
buttonStyle: {
115115
backgroundColor: buttonVariables[appearance],
116-
boxShadow: '1 1 1 1 blue'
117116
},
118117
focusColor: { ... },
119118
textStyle: { ... },

src/components/Layout/Box.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,21 @@ const shapeMap = {
5858
};
5959

6060
const propToFn = {
61-
elevation: (elevation: Elevation, theme: ITheme) => ({
62-
boxShadow: theme.themeVariables.elevations[elevation],
63-
}),
61+
elevation: (elevation: Elevation, theme: ITheme) => {
62+
// TODO: Add different shadows for different elevations
63+
switch (elevation) {
64+
case 0:
65+
case 1:
66+
case 2:
67+
default:
68+
return {
69+
shadowColor: theme.themeVariables.colors.text.dark,
70+
shadowOffset: { width: 1, height: 1 },
71+
shadowOpacity: 0.15,
72+
shadowRadius: 8,
73+
};
74+
}
75+
},
6476
marginX: (marginX: number) => ({
6577
marginLeft: marginX,
6678
marginRight: marginX,

src/theme/component-variables/buttonVariables.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export interface IButtonVariables {
4848
color: string;
4949
};
5050
sizes: IButtonSizes;
51-
boxShadow: string;
5251
}
5352

5453
export const getButtonVariables = (
@@ -168,7 +167,6 @@ export const getButtonVariables = (
168167
},
169168
},
170169
},
171-
boxShadow: 'none',
172170
disabled: {
173171
backgroundColor: themeVariables.colors.background.disabled,
174172

src/theme/component-variables/pickerVariables.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { IThemeVariables } from '../ThemeInterface';
55
export type IPickerAppearanceStyles = ViewStyle & {
66
backgroundColor: string;
77
borderColor: string;
8-
boxShadow: string;
98
color: string;
109
};
1110

@@ -47,7 +46,6 @@ export const getPickerVariables = (
4746
backgroundColor: themeVariables.colors.background.plain,
4847
borderColor: themeVariables.colors.border.default,
4948
borderWidth: 1,
50-
boxShadow: 'none',
5149
color: themeVariables.colors.text.default,
5250
},
5351
disabled: {
Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
export default {
2-
/**
3-
* @property {string} heading - Used for headings larger than 20px.
4-
*/
5-
heading: `"SF UI Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"`,
1+
import { Platform } from 'react-native';
62

7-
/**
8-
* @property {string} text - Used for text and UI (which includes almost anything).
9-
*/
10-
text: `"SF UI Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"`,
11-
12-
/**
13-
* @property {string} mono - Used for code and sometimes numbers in tables.
14-
*/
15-
mono: `"SF Mono", "Monaco", "Inconsolata", "Fira Mono", "Droid Sans Mono", "Source Code Pro", monospace`,
16-
};
3+
export default (Platform.OS === 'web'
4+
? // Use system font
5+
{
6+
heading: `"SF UI Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"`,
7+
mono: `"SF Mono", "Monaco", "Inconsolata", "Fira Mono", "Droid Sans Mono", "Source Code Pro", monospace`,
8+
text: `"SF UI Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"`,
9+
}
10+
: // Use default font families by React Native by default
11+
{
12+
heading: undefined,
13+
mono: undefined,
14+
text: undefined,
15+
});

0 commit comments

Comments
 (0)