-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode-snippets.js
More file actions
52 lines (46 loc) · 1 KB
/
Copy pathcode-snippets.js
File metadata and controls
52 lines (46 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// #Button
<Button
color="orange"
title="Click me"
onPress={() =>
//can also do Alert.prompt for IOS
Alert.alert("My Title", "My message", [
{ text: "Yes", onPress: () => console.log("yes") },
{ text: "No", onPress: () => console.log("no") },
])
}
/>;
// #Device #Orientation #Dimensions
console.log(Dimensions.get("screen"));
import {
useDimensions,
useDeviceOrientation,
} from "@react-native-community/hooks";
const { landscape } = useDeviceOrientation();
height: landscape ? "100%" : "30%";
// #Flexbox
//Too much to type...just google it
export default function App() {
return (
<View
style={{
backgroundColor: "dodgerblue",
//flex 1: the view grows to fill screen flex .5: fills half screen
flex: 2,
}}
>
<View
style={{
backgroundColor: "gold",
flex: 1,
}}
/>
<View
style={{
backgroundColor: "tomato",
flex: 1,
}}
/>
</View>
);
}