We're running styled-components within metro for react native - and metro runs it's babel plugins before ours. One of the plugins that runs is the HMR module (react-refresh), which changes our styled components from:
const Test = styled.View``;
into the following:
const Test = _c0 = styled.View``;
In this case this plugin assigns the view the name of _c0 and it's preferred to use Test. So I've patched the getName function to keep traversing if it's the the inner assignment and prefer the outer name. It still falls back to the inner name however.
We're running styled-components within metro for react native - and metro runs it's babel plugins before ours. One of the plugins that runs is the HMR module (react-refresh), which changes our styled components from:
into the following:
In this case this plugin assigns the view the name of _c0 and it's preferred to use
Test
. So I've patched thegetName
function to keep traversing if it's the the inner assignment and prefer the outer name. It still falls back to the inner name however.