StyleSheet

The StyleSheet API from React Native can also be used in React 360 to define several styles in one place rather than adding styles to individual components:

const styles = StyleSheet.create({  subView: {    width: 10,    borderColor: '#d6d7da',  },  text: {    fontSize: '1em',    fontWeight: 'bold',  }})

The defined styles can be added to components as required:

<View style={styles.subView}>  <Text style={styles.text}>hello</Text></View>
The default distance units for CSS properties, such as width and height, are in meters when mapping to 3D space in React 360, whereas the default distance units are in pixels for 2D interfaces, as in React Native.

Get Full-Stack React Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.