Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getStyleDef(direction, wrappedComponentName) {
const currentTheme = getCurrentTheme(direction);
let styleDef = direction === DIRECTIONS.LTR
? styleDefLTR
: styleDefRTL;
const registeredTheme = ThemedStyleSheet.get();
// Return the existing styles if they've already been defined
// and if the theme used to create them corresponds to the theme
// registered with ThemedStyleSheet
if (styleDef && currentTheme === registeredTheme) {
return styleDef;
}
if (
process.env.NODE_ENV !== 'production'
&& typeof performance !== 'undefined'
&& performance.mark !== undefined && typeof performance.clearMarks === 'function'
function getCurrentTheme(direction) {
return direction === DIRECTIONS.LTR
? currentThemeLTR
: currentThemeRTL;
}
function getResolveMethod(direction) {
return direction === DIRECTIONS.LTR
? ThemedStyleSheet.resolveLTR
: ThemedStyleSheet.resolveRTL;
}
if (pureComponent) {
if (!React.PureComponent) {
throw new ReferenceError('withStyles() pureComponent option requires React 15.3.0 or later');
}
return React.PureComponent;
}
return React.Component;
}
const contextTypes = {
[CHANNEL]: brcastShape,
};
const defaultDirection = DIRECTIONS.LTR;
export function withStyles(
styleFn,
{
stylesPropName = 'styles',
themePropName = 'theme',
cssPropName = 'css',
flushBefore = false,
pureComponent = false,
} = {},
) {
let styleDefLTR;
let styleDefRTL;
let currentThemeLTR;
let currentThemeRTL;
const BaseClass = baseClass(pureComponent);