elemental-design / elemental-design/react-platform

styled-components and emotion package

Open
#7 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
17
Forks
0
PR merge metrics
No merged PRs in 30d

Description

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:

```jsx
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;
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.