MCPcopy
hub / github.com/styletron/styletron / withWrapper

Function withWrapper

packages/styletron-react/src/index.tsx:261–287  ·  view source on GitHub ↗
(component, wrapper)

Source from the content-addressed store, hash-verified

259export const withStyle = withStyleDeep;
260
261export const withWrapper: WithWrapperFn = (component, wrapper) => {
262 const styletron = component.__STYLETRON__;
263
264 if (__DEV__) {
265 if (!styletron) {
266 /* eslint-disable no-console */
267 console.warn(
268 "The first parameter to `withWrapper` must be a styled component (without extra wrappers).",
269 );
270 /* eslint-enable no-console */
271 }
272 }
273
274 const composed = {
275 getInitialStyle: styletron.getInitialStyle,
276 base: styletron.base,
277 driver: styletron.driver,
278 wrapper: wrapper,
279 reducers: styletron.reducers,
280 };
281
282 if (__BROWSER__ && __DEV__) {
283 addDebugMetadata(composed, 2);
284 }
285
286 return createStyledElementComponent(composed);
287};
288
289export function autoComposeShallow<Props>(
290 styletron: Styletron,

Calls 2

addDebugMetadataFunction · 0.90

Tested by

no test coverage detected