commit d6f95790f1f9cc2e280e8b74581b7501cdc131f3 parent 359f10964822d1fd2f8eb73d450699a755b5288f Author: Yohanes Bandung <bandungpenting@gmail.com> Date: Tue, 10 Mar 2020 12:27:09 +0700 hotfix(Text): disable styled-components' vendor prefix Diffstat:
| M | src/Components/Text.js | | | 17 | ++++++++++++++--- |
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/Components/Text.js b/src/Components/Text.js @@ -1,6 +1,10 @@ // @flow import React from 'react'; -import styled, {css, type StyledComponent} from 'styled-components'; +import styled, { + css, + StyleSheetManager, + type StyledComponent, +} from 'styled-components'; import theme from 'styled-theming'; import {colors} from '../Theme/colors'; @@ -60,6 +64,7 @@ const headingTagResolver = (as?: string) => { type TextProps = { as?: string, + children: React$Node, variant?: 'default' | 'red' | 'green' | 'blue', }; @@ -86,13 +91,19 @@ const TextBase: StyledComponent<TextProps, {}, {}> = styled.p` : css``} `; -const Text = (props: TextProps) => { +const Text = ({children, ...props}: TextProps) => { let {as, variant: baseVariant} = props; let variant = baseVariant ?? 'default'; if (as && as[0] === 'h') { variant = 'green'; } - return <TextBase {...props} as={as} variant={baseVariant ?? variant} />; + return ( + <StyleSheetManager disableVendorPrefixes> + <TextBase {...props} as={as} variant={baseVariant ?? variant}> + {children} + </TextBase> + </StyleSheetManager> + ); }; export default Text;