1.3.3 • Published 6 years ago
styletron-react-core v1.3.3
styletron-react-core
React bindings for Styletron, inspired by styled-components.
This package provides the core implementation that is agnostic of the shape style objects and the engine interface.
Installation
yarn add styletron-react-core
API
The styletron-react-core
package consists of the following named exports:
Customizing styled
createStyled
import {createStyled} from "styletron-react-core";
Returns a styled
function.
Params
opts
opts.getInitialStyle
: (void => Style
)opts.driver
: ((Style, Engine) => string
)opts.wrapper
: (StatelessFunctionalComponent<*> => StatelessFunctionalComponent<*>
)
Examples
import {createStyled} from "styletron-react-core";
type customStyleT = $Shape<{
angle?: number,
velocity?: number
}>;
interface CustomEngine {
someMethod: customStyleT => string;
}
function driver(style: customStyleT, engine: CustomEngine): string {
return engine.someMethod(style);
}
function getInitialStyle(): customStyleT {
return {};
}
const wrapper = StyledComponent => props => (
<div>
<StyledComponent {...props} />
</div>
);
const styled = createStyled({getInitialStyle, driver, wrapper});
1.3.4-canary.1
6 years ago
1.3.3
6 years ago
1.3.2
6 years ago
1.3.1
6 years ago
1.3.0
6 years ago
1.2.2
6 years ago
1.2.1
6 years ago
1.2.0
6 years ago
1.1.0
6 years ago
1.0.0
6 years ago
1.0.0-beta.7
6 years ago
1.0.0-beta.6
6 years ago
1.0.0-beta.5
6 years ago
1.0.0-beta.4
6 years ago
1.0.0-beta.3
6 years ago
1.0.0-beta.2
6 years ago
1.0.0-beta.1
6 years ago
1.0.0-beta.0
6 years ago