Skip to content

styled-components and emotion package #7

Open
@macintoshhelper

Description

@macintoshhelper

Create styled-components package wrapper that lets you use components without react-native-web.

This may be necessary for styled-components/primitives SSR support, or for use cases where react-native-web isn't installed.

We should encourage the use of styled-components/primitives instead, in documentation.

This could be a new package like @react-platform/styled

Pseudo-code for the wrapper:

const styled = Platform.select({
  web: () => require('styled-components'),
  default: () => require('styled-components/primitives'),
})();

if (Platform.OS === 'web') {
  styled.View = styled.div;
  styled.Text = styled.span;
  styled.Image = styled.img;
} else {
  styled.div = styled.View;
  styled.img = styled.Image;
  styled.span = styled.Text;
}

module.exports = styled;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions