Comments (8)
What might that look like? styled(x)
y:z;`` for some x y and z
from styled-components.
Same API, except with ReactNative
primitives?
styled.View`
border: 1px solid red;
`;
(see here for more info on RN styling)
from styled-components.
From discussion, the idea is to provide the same API at two endpoints
import styled, { css, ... } from 'styled-components'
import styled, { css, ... } from 'styled-components/native'
The difference is that the DOM one supports nesting, media queries etc, and generates className
. The native one doesn't and generates a styles
object. We could even not call it the 'native' endpoint but 'inline' instead, since that's all it's doing...
from styled-components.
Just thinking about this, if we are going to supply styled.View
(as apposed to only allowing styled(View)
that means our project is going to depend on react-native
just so we can match up our imported symbols. Is there any way around that, or is that not too much of a problem?
from styled-components.
Is there any way around that, or is that not too much of a problem?
Why not make it a peerDep
?
Also, I've been thinking about this – we could not only have /native
, but also /choo
, /glimmer
, even /dom
. What if we returned a representation of a generic component from styled
calls, and then we could (or collaborators could contribute) more adapters for this thing?
from styled-components.
Yeah right that's what peerDeps are for, right? I just thought they would complain if they were unfulfilled, so every time you npm i
you get a warning that you're missing react-native
?
from styled-components.
I just thought they would complain if they were unfulfilled, so every time you npm i you get a warning that you're missing react-native?
Ah yeah crap, good point. It's an optionalDependency
!
from styled-components.
Closing in favour of #53
from styled-components.
Related Issues (20)
- Missing types in dist of release 6.1.2 HOT 2
- Could not find a declaration file for module 'styled-components' HOT 4
- Font reloads on state change HOT 2
- Dynamic styles applied when it shouldn't be HOT 5
- Using a generic component results in TS error for the generic argument HOT 6
- Overriding DefaultTheme with custom ThemeType only affects ThemeProvider and not styled components themselves. HOT 2
- Custom property names are changed to kebab case
- StyleSheetManager `shouldForwardProp` does not prevent prop forwarding HOT 2
- Additional closing brackets result in globally applied css rules
- Bug: DefaultTheme type allows any key, even when defining explicit type for theme HOT 5
- react-is not included as a dependency
- Popover property being removed from attributes HOT 1
- `react-dom` should be an optional peerDependency
- Add Support for Easily Configuring a Nonce. HOT 2
- Use the `node:` protocol in ServerStyleSheet.tsx
- Provide setup guide for React Native + Typescript HOT 1
- Update options css for text-wrap HOT 4
- Examples React Native HOT 1
- Having to explicitly set the 'children' prop for EVERY component? HOT 3
- Will styled-components ever support latest react features (server components, streaming, concurrent redering) ? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from styled-components.