Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs Emotion.js如何在react native中进行合成/条件造型?_Reactjs_React Native_Emotion - Fatal编程技术网

Reactjs Emotion.js如何在react native中进行合成/条件造型?

Reactjs Emotion.js如何在react native中进行合成/条件造型?,reactjs,react-native,emotion,Reactjs,React Native,Emotion,举例说明 style={css` border-radius: 10px; `} 但是,我不知道如何才能像react native中那样进行合成 <div css={[danger, base]}> 即使我能做到,他们也会使用两种不同的方法,一种是使用css,另一种是使用styled。如何使用react-native同时获得这两种功能?问题1:如何在react-native中使用情绪/本族语进行合成 const Description = st

举例说明

    style={css`
      border-radius: 10px;
    `}
但是,我不知道如何才能像react native中那样进行
合成

    <div css={[danger, base]}>

即使我能做到,他们也会使用两种不同的方法,一种是使用
css
,另一种是使用
styled
。如何使用react-native同时获得这两种功能?

问题1:如何在react-native中使用情绪/本族语进行
合成

const Description = styled.Text`
    font-size: ${props =>  props.fontSize !== undefined ? props.fontSize : "40px"};
  color: hotpink;
`

<Description fontSize={"60px"}>
Change code in the editor and watch it change on your phone! Save to get a shareable url.
</Description>
非常简单,只需使用样式属性,如下所示:

const style1 = css`
  font-size: 40px;
`

const color = css`
  color: red;
`

// And then in your component you can pass the all your style objects 
// in an array to style property
<Text style={[fontSize, color]}>Hello world</Text>
这里有一个工作实例作为一个例子

const Description = styled.Text`
    font-size: ${props =>  props.fontSize !== undefined ? props.fontSize : "40px"};
  color: hotpink;
`

<Description fontSize={"60px"}>
Change code in the editor and watch it change on your phone! Save to get a shareable url.
</Description>