mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-06-01 01:59:10 +00:00
Refactor StyleSheet to support arrays
This commit is contained in:
+16
-1
@@ -9,6 +9,8 @@ outside of the render loop and are applied as inline styles. Read more about to
|
||||
|
||||
**create**(obj: {[key: string]: any})
|
||||
|
||||
Each key of the object passed to `create` must define a style object.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
@@ -24,12 +26,25 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
activeTitle: {
|
||||
color: 'red',
|
||||
},
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
Use styles:
|
||||
|
||||
```js
|
||||
<View style={styles.container}>
|
||||
<Text
|
||||
style={[
|
||||
styles.title,
|
||||
this.props.isActive && styles.activeTitle
|
||||
]}
|
||||
/>
|
||||
</View>
|
||||
```
|
||||
|
||||
Or:
|
||||
|
||||
```js
|
||||
<View style={styles.container}>
|
||||
<Text
|
||||
|
||||
Reference in New Issue
Block a user