( target: Array<Chunk | PrecomputedChunk>, props: Object, resumableState: ResumableState, renderState: RenderState, hoistableState: null | HoistableState, textEmbedded: boolean, formatContext: FormatContext, )
| 3056 | } |
| 3057 | |
| 3058 | function pushStyle( |
| 3059 | target: Array<Chunk | PrecomputedChunk>, |
| 3060 | props: Object, |
| 3061 | resumableState: ResumableState, |
| 3062 | renderState: RenderState, |
| 3063 | hoistableState: null | HoistableState, |
| 3064 | textEmbedded: boolean, |
| 3065 | formatContext: FormatContext, |
| 3066 | ): ReactNodeList { |
| 3067 | const noscriptTagInScope = formatContext.tagScope & NOSCRIPT_SCOPE; |
| 3068 | if (__DEV__) { |
| 3069 | if (hasOwnProperty.call(props, 'children')) { |
| 3070 | const children = props.children; |
| 3071 | |
| 3072 | const child = Array.isArray(children) |
| 3073 | ? children.length < 2 |
| 3074 | ? children[0] |
| 3075 | : null |
| 3076 | : children; |
| 3077 | |
| 3078 | if ( |
| 3079 | typeof child === 'function' || |
| 3080 | typeof child === 'symbol' || |
| 3081 | Array.isArray(child) |
| 3082 | ) { |
| 3083 | const childType = |
| 3084 | typeof child === 'function' |
| 3085 | ? 'a Function' |
| 3086 | : typeof child === 'symbol' |
| 3087 | ? 'a Sybmol' |
| 3088 | : 'an Array'; |
| 3089 | console.error( |
| 3090 | 'React expect children of <style> tags to be a string, number, or object with a `toString` method but found %s instead. ' + |
| 3091 | 'In browsers style Elements can only have `Text` Nodes as children.', |
| 3092 | childType, |
| 3093 | ); |
| 3094 | } |
| 3095 | } |
| 3096 | } |
| 3097 | const precedence = props.precedence; |
| 3098 | const href = props.href; |
| 3099 | const nonce = props.nonce; |
| 3100 | |
| 3101 | if ( |
| 3102 | formatContext.insertionMode === SVG_MODE || |
| 3103 | noscriptTagInScope || |
| 3104 | props.itemProp != null || |
| 3105 | typeof precedence !== 'string' || |
| 3106 | typeof href !== 'string' || |
| 3107 | href === '' |
| 3108 | ) { |
| 3109 | // This style tag is not able to be turned into a Style Resource |
| 3110 | return pushStyleImpl(target, props); |
| 3111 | } |
| 3112 | |
| 3113 | if (__DEV__) { |
| 3114 | if (href.includes(' ')) { |
| 3115 | console.error( |
no test coverage detected