Skip to content

Commit aec60ac

Browse files
author
Ethan Neff
committed
style: relocated up code
1 parent 61b1acb commit aec60ac

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

src/components/Hello/index.tsx

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
11
import * as React from "react";
22
import { Button, StyleSheet, Text, View } from "react-native";
33

4+
// styles
5+
const styles = StyleSheet.create({
6+
root: {
7+
alignItems: "center",
8+
alignSelf: "center"
9+
},
10+
buttons: {
11+
flexDirection: "row"
12+
},
13+
button: {
14+
flex: 1,
15+
paddingVertical: 0
16+
},
17+
greeting: {
18+
color: "#999",
19+
fontWeight: "bold"
20+
}
21+
});
22+
423
export interface IProps {
524
name: string;
625
enthusiasmLevel?: number;
@@ -10,26 +29,26 @@ interface IState {
1029
enthusiasmLevel: number;
1130
}
1231

13-
export default class Hello extends React.Component<IProps, IState> {
32+
class Hello extends React.Component<IProps, IState> {
1433
constructor(props: IProps) {
1534
super(props);
16-
1735
if ((props.enthusiasmLevel || 0) <= 0) {
1836
throw new Error("You could be a little more enthusiastic. :D");
1937
}
20-
2138
this.state = {
2239
enthusiasmLevel: props.enthusiasmLevel || 1
2340
};
2441
}
2542

2643
public onIncrement = () =>
2744
this.setState({ enthusiasmLevel: this.state.enthusiasmLevel + 1 });
45+
2846
public onDecrement = () =>
2947
this.setState({
3048
enthusiasmLevel:
3149
this.state.enthusiasmLevel - 1 > 0 ? this.state.enthusiasmLevel - 1 : 0
3250
});
51+
3352
public getExclamationMarks = (numChars: number) =>
3453
Array(numChars + 1).join("!");
3554

@@ -64,21 +83,4 @@ export default class Hello extends React.Component<IProps, IState> {
6483
}
6584
}
6685

67-
// styles
68-
const styles = StyleSheet.create({
69-
root: {
70-
alignItems: "center",
71-
alignSelf: "center"
72-
},
73-
buttons: {
74-
flexDirection: "row"
75-
},
76-
button: {
77-
flex: 1,
78-
paddingVertical: 0
79-
},
80-
greeting: {
81-
color: "#999",
82-
fontWeight: "bold"
83-
}
84-
});
86+
export default Hello;

0 commit comments

Comments
 (0)