Inspired by styled-components for the web this interface allows to merge dynamic styles together with tags and reuse them. Regular React Native stylesheets can't be updated anymore without rerendering the whole tree. Using the Styled interface however doesn't require a full rerender through the <Rerender /> component anymore. The linked styles will directly be updated whenever the viewport or the orientation changes. Additionally, styles for props can be added which also dynamically update the component's styles.
As the first argument the Styled method takes the component to extend. This can be a string representation of a React Native element or the element itself. The second argument takes the styles just like createStyles does. Scaleable values will automatically adapt linearly based on the viewport and adaptive values can be used to specify values for specific breakpoints or orientations. An optional third argument takes an object which can contain styles which will dynamically be applied if a truthy prop, a breakpoint, the operating system or the orientation matches a key.
When a function is passed and MobX is installed the styles will automatically adapt whenever any of the state accessed inside changes. The Styled method interface stays the same except that for the second and third argument a method returning base styles or conditional styles has to be passed.
When the state changes and this results in different styles being returned the styles will adapt without any React component themselves having to rerender.