styled-components#StyleSheetManager TypeScript Examples

The following examples show how to use styled-components#StyleSheetManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StylesInjection.tsx    From symphony-ui-toolkit with Apache License 2.0 6 votes vote down vote up
StylesInjection = (props: Props) => {

  // @emotion/cache only accept alpha characters
  // Don't use shortid because it doesn't support less than 64 unique characters (See https://github.com/dylang/shortid#shortidcharactersstring)
  // Later we will use nanoid
  const uniqueAlphaCharacterId = Math.random().toString(36).replace(/[^a-z]+/g, '').substring(0, 10);

  const emotionCache = createCache({
    key: uniqueAlphaCharacterId,
    container: props.injectionPoint
  });

  return (
    <StyleSheetManager target={props.injectionPoint}>
      <CacheProvider value={emotionCache} >
        {props.children}
      </CacheProvider>
    </StyleSheetManager>
  )
}
Example #2
Source File: main.tsx    From ali-react-table with MIT License 5 votes vote down vote up
ReactDOM.render(
  <StyleSheetManager disableVendorPrefixes>
    <DemoApp />
  </StyleSheetManager>,
  document.getElementById('container'),
)