Skip to content

Commit

Permalink
Merge pull request #34 from bothrs/thgh-patch-1
Browse files Browse the repository at this point in the history
fix: make deprecation message more constructive
  • Loading branch information
thgh authored Apr 20, 2022
2 parents 19feb53 + a0b4cd8 commit 02c0c4c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { PaddingOrMarginProps } from '../../types/generic-props'
export interface ContainerProps {
type: 'padding' | 'margin'
amount: PaddingOrMarginProps
/** @deprecated use `style={{ backgroundColor: "red" }}` instead */
backgroundColor?: string
style?: ViewStyle
onLayout?: (e: LayoutChangeEvent) => void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ const Container: FunctionComponent<ContainerProps & TestableComponent> = ({
useEffect(() => {
if (backgroundColor !== 'transparent') {
console.warn(
'[@bothrs/react-native-layout]: backgroundColor has been deprecated and will be removed in a later version.'
'[@bothrs/react-native-layout]: backgroundColor has been deprecated, use style={{ backgroundColor: ' +
JSON.stringify(backgroundColor) +
' }} instead.'
)
}
}, [backgroundColor])
Expand Down

0 comments on commit 02c0c4c

Please sign in to comment.