Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions src/styles/addOutlineWidth/index.js

This file was deleted.

14 changes: 0 additions & 14 deletions src/styles/addOutlineWidth/index.native.js

This file was deleted.

10 changes: 10 additions & 0 deletions src/styles/addOutlineWidth/index.native.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Native platforms don't support the "addOutlineWidth" property, so this
* function is a no-op
*/

import AddOutlineWidth from './types';

const addOutlineWidth: AddOutlineWidth = (obj) => obj;

export default addOutlineWidth;
19 changes: 19 additions & 0 deletions src/styles/addOutlineWidth/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Web and desktop platforms support the "addOutlineWidth" property, so it
* can be added to the object
*/

import themeDefault from '../themes/default';
import AddOutlineWidth from './types';

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

export default addOutlineWidth;
6 changes: 6 additions & 0 deletions src/styles/addOutlineWidth/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import {CSSProperties} from 'react';
import {TextStyle} from 'react-native';

type AddOutlineWidth = (obj: TextStyle | CSSProperties, val?: number, error?: boolean) => TextStyle | CSSProperties;

export default AddOutlineWidth;