-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[add] Image support for blurRadius, tintColor, and shadows
- Loading branch information
Showing
7 changed files
with
136 additions
and
18 deletions.
There are no files selected for viewing
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
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
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
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
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
27 changes: 27 additions & 0 deletions
27
packages/react-native-web/src/exports/StyleSheet/resolveShadowValue.js
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,27 @@ | ||
/** | ||
* Copyright (c) 2018-present, Nicolas Gallagher. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
*/ | ||
|
||
import normalizeColor from '../../modules/normalizeColor'; | ||
import normalizeValue from './normalizeValue'; | ||
|
||
const defaultOffset = { height: 0, width: 0 }; | ||
|
||
const resolveShadowValue = (style: Object) => { | ||
const { shadowColor, shadowOffset, shadowOpacity, shadowRadius } = style; | ||
const { height, width } = shadowOffset || defaultOffset; | ||
const offsetX = normalizeValue(null, width); | ||
const offsetY = normalizeValue(null, height); | ||
const blurRadius = normalizeValue(null, shadowRadius || 0); | ||
const color = normalizeColor(shadowColor || 'black', shadowOpacity); | ||
if (color) { | ||
return `${offsetX} ${offsetY} ${blurRadius} ${color}`; | ||
} | ||
}; | ||
|
||
export default resolveShadowValue; |
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