Skip to content

Commit

Permalink
fix: minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
koko57 committed Nov 30, 2023
1 parent e2a0dbf commit ac50070
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/styles/addOutlineWidth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@
* Web and desktop platforms support the "addOutlineWidth" property, so it
* can be added to the object
*/
import themeDefault from '@styles/themes/default';
import AddOutlineWidth from './types';

/**
* Adds the addOutlineWidth property to an object to be used when styling
*/
const addOutlineWidth: AddOutlineWidth = (obj, val, hasError = false) => ({
const addOutlineWidth: AddOutlineWidth = (obj, theme, val, hasError = false) => ({
...obj,
outlineWidth: val,
outlineStyle: val ? 'auto' : 'none',
boxShadow: val !== 0 ? `0px 0px 0px ${val}px ${hasError ? themeDefault.danger : themeDefault.borderFocus}` : 'none',
boxShadow: val !== 0 ? `0px 0px 0px ${val}px ${hasError ? theme?.danger : theme?.borderFocus}` : 'none',
});

export default addOutlineWidth;
3 changes: 2 additions & 1 deletion src/styles/addOutlineWidth/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {TextStyle} from 'react-native';
import {ThemeColors} from "@styles/themes/types";

type AddOutlineWidth = (obj: TextStyle, val?: number, hasError?: boolean) => TextStyle;
type AddOutlineWidth = (obj: TextStyle, theme?: ThemeColors, val?: number, hasError?: boolean) => TextStyle;

export default AddOutlineWidth;
6 changes: 4 additions & 2 deletions src/styles/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ const styles = (theme: ThemeColors) =>
flexDirection: 'row',
},

textInputDesktop: addOutlineWidth({}, 0),
textInputDesktop: addOutlineWidth({}, theme, 0),

textInputIconContainer: {
paddingHorizontal: 11,
Expand Down Expand Up @@ -1133,7 +1133,7 @@ const styles = (theme: ThemeColors) =>
color: theme.icon,
},

noOutline: addOutlineWidth({}, 0),
noOutline: addOutlineWidth({}, theme, 0),

textLabelSupporting: {
fontFamily: fontFamily.EXP_NEUE,
Expand Down Expand Up @@ -1799,6 +1799,7 @@ const styles = (theme: ThemeColors) =>
alignSelf: 'center',
verticalAlign: 'middle',
},
theme,
0,
),

Expand Down Expand Up @@ -2625,6 +2626,7 @@ const styles = (theme: ThemeColors) =>
padding: 0,
lineHeight: undefined,
},
theme,
0,
),

Expand Down

0 comments on commit ac50070

Please sign in to comment.