I believe that a satisfactory solution would be to create a Theme and use in Styles-Components.
So imagine you have a Heme like this
export default {
colors: {
primary: '#000',
}
}
using the Styled Components theme, you will be able to access it like this
import styled from 'styled-components/native'
export const Container = styled.View`
background: ${({ theme }) => theme.colors.primary;
`;
It’s pretty cool this approach, I usually add some very useful things like, colors, font family name and whatever else I find necessary.
At the end it’s kind of like this :)
export default {
colors: {
primary: '#000',
},
font: {
family: {
black: 'Poppins-Black',
blackItalic: 'Poppins-BlackItalic',
bold: 'Poppins-Bold',
boldItalic: 'Poppins-BoldItalic',
extraBold: 'Poppins-ExtraBold',
},
metrics: {
window: {
width,
height,
},
statusBarHeight: Platform.select({
android: 0,
ios: getStatusBarHeight(),
default: 0,
}),
bottomSpace: Platform.select({
android: 0,
ios: getBottomSpace(),
default: 0,
}),
}
}
}
How so increment? You mean use within the style of
Container
?– Cmte Cardeal
Exactly that
– Developer2002
Just pass as string template doesn’t work? Something like
color: ${ ColorPrimary }
within thestyled.view
.– Cmte Cardeal