I'm working with styled-components on my react-native project and I wonder how can I get the parent prop from a child element .. here is an example, I've 2 styled-components
const First = styled.View`
display: flex;
width: 50px;
height: 50px;
background-color: ${props => props.selected ? 'blue' : 'red'};
`
const Second = styled.Text`
// here I want to check if First has the selected prop.
color: ${props => props.selected ? '#fff' : '#000'};
`
and my own React component
const Test = () = (
<First selected>
<Second>Test</Second>
</First>
)
now how can I check if Seconds father (which is First) has the selected prop ?
I know it will work if i'll give the selected attr to Second but it's not what I'm trying to achieve ... there must be a way because they nested, I tried to console log and props arg but I couldn't find the parent value in the object that the child returns.
thanks
styled-componentsthat would help in these kind of situations. - greW