Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

styled-components and emotion package #7

Open
macintoshhelper opened this issue May 16, 2020 · 0 comments
Open

styled-components and emotion package #7

macintoshhelper opened this issue May 16, 2020 · 0 comments

Comments

@macintoshhelper
Copy link
Member

macintoshhelper commented May 16, 2020

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;
@macintoshhelper macintoshhelper changed the title styled-components primitives react-dom substitute styled-components primitives react-dom substitute May 16, 2020
@macintoshhelper macintoshhelper changed the title styled-components primitives react-dom substitute styled-components and emotion package May 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant