Skip to content

Commit

Permalink
Merge pull request #25945 from fabioh8010/ts/style/addOutlineWidth
Browse files Browse the repository at this point in the history
[No QA] [TS migration] Migrate 'addOutlineWidth' style to TypeScript
  • Loading branch information
yuwenmemon authored Aug 31, 2023
2 parents a672b32 + 363793b commit 6c1f358
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 39 deletions.
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;

0 comments on commit 6c1f358

Please sign in to comment.