Skip to content

Commit

Permalink
Adding clarification in Docs Style
Browse files Browse the repository at this point in the history
In some cases React Native does not match how CSS works on the web
facebook/react-native#25441 (comment)
  • Loading branch information
fabOnReact committed Mar 9, 2021
1 parent c60929a commit e933355
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/style.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ title: Style

With React Native, you style your application using JavaScript. All of the core components accept a prop named `style`. The style names and [values](colors.md) usually match how CSS works on the web, except names are written using camel casing, e.g. `backgroundColor` rather than `background-color`.

> In some cases React Native does not match how CSS works on the web, for example the touch area never extends past the parent view bounds and on Android negative margin is not supported. [react-native#29308](https://github.com/facebook/react-native/issues/29308#issuecomment-792864162)
The `style` prop can be a plain old JavaScript object. That's what we usually use for example code. You can also pass an array of styles - the last style in the array has precedence, so you can use this to inherit styles.

As a component grows in complexity, it is often cleaner to use `StyleSheet.create` to define several styles in one place. Here's an example:
Expand Down

0 comments on commit e933355

Please sign in to comment.