-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25945 from fabioh8010/ts/style/addOutlineWidth
[No QA] [TS migration] Migrate 'addOutlineWidth' style to TypeScript
- Loading branch information
Showing
5 changed files
with
35 additions
and
39 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |