'Not able to use relative values in React Native Styled Components

From the react native styled-components documentation, I've seen EM values being used in place of the usual px. However, when I try compiling my project which uses REM values, it fails and gives me an error "expected number got string".
Is there something I'm missing? Does styled-components not support REM values? Here's my code

const TitleG1_1 = styled.Text`
    font-size: 1.2rem;
    padding: 0;
    margin: 0;
    color: #3a3e59;
`;

Thank you.



Solution 1:[1]

For sure the styled components supports the rem as measure. The problem should be how you defined the Title. I'll explain, try this:

const TitleG1_1 = styled(Text)`
    font-size: 1.2rem;
    padding: 0;
    margin: 0;
    color: #3a3e59;
`

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 GiorgioCapaccio