Every line of 'conditional style react' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
21 function renderStyles(props) { 22 return TestRenderer.create( 23 24 ); 25 }
23 function renderStyles(props) { 24 return TestRenderer.create( 25 26 ); 27 }
94 var toggleStyle = function toggleStyle() { 95 return setEditorState(draftJs.RichUtils.toggleInlineStyle(editorState, inlineStyle)); 96 };
173 render() { 174 // As some components will depend on previous styles in 175 // the component tree, we provide the option of flushing the 176 // buffered styles (i.e. to a style tag) **before** the rendering 177 // cycle begins. 178 // 179 // The interfaces provide the optional "flush" method which 180 // is run in turn by ThemedStyleSheet.flush. 181 if (flushBefore) { 182 ThemedStyleSheet.flush(); 183 } 184 185 const { 186 resolveMethod, 187 styleDef, 188 } = this.state; 189 190 return ( 191 192 ); 193 }
93 renderStyle(...args) { 94 return ; 95 }
178 static reactStyle(str) { 179 if (!~str.indexOf("-")) return str; 180 let retVal = ""; 181 for (let block of str.split("-")) { 182 if (retVal) { 183 retVal += block[0].toUpperCase() + block.substr(1); 184 } else { 185 retVal += block; 186 } 187 } 188 return retVal; 189 }
76 function style(props) { 77 Object.keys(props).forEach((prop) => { 78 el.style[prop] = props[prop]; 79 }); 80 }
40 function testClassComponents() { 41 class Class extends React.Component<{hello: string}> { 42 render() { 43 return <div>{this.props.hello}</div>; 44 } 45 } 46 47 ; 48 49 // $ExpectError 50 ; 51 52 let StyledClass = style(Class, { 53 base: { 54 color: 'red', 55 }, 56 }); 57 58 ; 59 60 // $ExpectError 61 ; 62 63 // $ExpectError 64 style(Class, { 65 base: { 66 olor: 'red', 67 }, 68 }); 69 }
56 function makeReactStyleObject (env) { 57 const style = {} 58 59 // If an error causes `env` to be undefined, return an empty object. 60 if (!env) return style 61 62 const background = [] 63 64 if (env.backgroundGradient) { 65 background.push(makeCSSGradientDeclaration(env.backgroundGradient)) 66 } 67 68 if (env.backgroundImage) { 69 background.push(makeCSSBackgroundImageDeclaration(env.backgroundImage)) 70 } 71 72 // Background colors must occur last in the `background` list 73 if (env.backgroundColor) { 74 background.push(env.backgroundColor) 75 } 76 77 style.background = background.join(', ') 78 79 return style 80 }
34 function mergeStyleState(props: { ['style-state']: StateMap }, from: StateMap) { 35 const to = props['style-state'] = props['style-state'] || {}; 36 Object.keys(from).forEach((stateName: string) => { 37 to[stateName] = to[stateName] || from[stateName]; 38 }); 39 }