The backbone of every web page. Public standard created by World Wide Web Consortium (W3C).
Extra tags ("components") that come with React Native.
Custom tags ("components") you create for use with React Native.
1. Close every tag with an "end angle" >
<div>
2a. Close start tags with an "end tag" that has a slash /
<div>Welcome to my page!</div>
or
2b. Close a tag that has no children with a slash / before the final end angle.
<img src="puppy.jpg" />
2-dimensional layout standard that can be used in any web page. Can't be used in React Native.
1-dimensional layout standard that can be used in any web page. Can be used in React Native.
Work on web pages, not in React Native.
div {...}
.cat {...}
#grumpy {...}
CSS written as JavaScript objects, used in React Native.
const styles = StyleSheet.create({
container: {
backgroundColor: 'cadetblue',
...
}
});
Runs almost every web page. Public standard created by World Wide Web Consortium (W3C).
Runs many websites that require updated data. Made by Facebook, but open source.
Runs a number of prominent mobile apps. Made by Facebook, but open source.
A powerful JavaScript engine that can act like a server, even on your own computer.
Installs essential files.
Format for data passed over the Internet.
JSON stored on a server. Used in databases like Google's Firebase.
Used to make ordinary websites.
JavaScript variables in JSX have {}s.
Uses ordinary HTML tags like <div>, but you can make custom tag combinations, called "components."
Used to make mobile apps.
No HTML tags--only React Native tags like <View> or custom components.
Each custom component is typically defined in a dedicated JavaScript file, eg
The master file is typically App.js.
Note both parentheses ( ) and braces { } in StyleSheet definition.
const styles = StyleSheet.create( {...} ) ;
Object keys replace id or class selectors, so you need a colon :
const styles = StyleSheet.create( {
textStyle: {
}
} )
Properties are CamelCase.
const styles = StyleSheet.create( {
textStyle: {
backgroundColor: "darkcyan"
}
} )
Strings are quoted and case sensitive
const styles = StyleSheet.create( {
textStyle: {
backgroundColor: "darkcyan"
}
} )
Semicolons turn into commas, with none for last line.
const styles = StyleSheet.create( {
card: {
backgroundColor: "darkcyan",
color: "paleturquoise"
}
} )
Numbers have no units and don't need quotes, except for percentages.
They represent viewport sizes independent of pixel density.
An iPhone XR viewport is 414 by 896.
Percentage support is still iffy, but you can fake it with flex.
const styles = StyleSheet.create( {
heading: {
backgroundColor: "darkcyan",
width: 300,
height: 30
}
} )
The style attribute takes { }s instead of ""s.
<Text style = {textStyle} >Hi there!</Text>
Flex works better than absolute or relative positioning.
You can't easily refer to a style in a different JavaScript component, unlike external CSS stylesheets.
/