Skip to content

Commit ce85178

Browse files
George JoseGeorge Jose
authored andcommitted
Add ts
1 parent 5a0cb44 commit ce85178

File tree

15 files changed

+208
-74
lines changed

15 files changed

+208
-74
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
22
root: true,
33
extends: '@react-native-community',
4-
};
4+
}

.prettierrc.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
module.exports = {
2-
bracketSpacing: false,
3-
jsxBracketSameLine: true,
2+
printWidth: 80,
3+
semi: false,
44
singleQuote: true,
5-
trailingComma: 'all',
65
arrowParens: 'avoid',
7-
};
6+
trailingComma: 'all',
7+
jsxBracketSameLine: true,
8+
}

.watchmanconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
{}

App.js renamed to App.tsx

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
1-
/**
2-
* Sample React Native App
3-
* https://github.com/facebook/react-native
4-
*
5-
* @format
6-
* @flow strict-local
7-
*/
8-
9-
import React from 'react';
10-
import type {Node} from 'react';
1+
import React from 'react'
112
import {
123
SafeAreaView,
134
ScrollView,
@@ -16,18 +7,18 @@ import {
167
Text,
178
useColorScheme,
189
View,
19-
} from 'react-native';
10+
} from 'react-native'
2011

2112
import {
2213
Colors,
2314
DebugInstructions,
2415
Header,
2516
LearnMoreLinks,
2617
ReloadInstructions,
27-
} from 'react-native/Libraries/NewAppScreen';
18+
} from 'react-native/Libraries/NewAppScreen'
2819

29-
const Section = ({children, title}): Node => {
30-
const isDarkMode = useColorScheme() === 'dark';
20+
const Section = ({ children, title }) => {
21+
const isDarkMode = useColorScheme() === 'dark'
3122
return (
3223
<View style={styles.sectionContainer}>
3324
<Text
@@ -36,7 +27,8 @@ const Section = ({children, title}): Node => {
3627
{
3728
color: isDarkMode ? Colors.white : Colors.black,
3829
},
39-
]}>
30+
]}
31+
>
4032
{title}
4133
</Text>
4234
<Text
@@ -45,31 +37,34 @@ const Section = ({children, title}): Node => {
4537
{
4638
color: isDarkMode ? Colors.light : Colors.dark,
4739
},
48-
]}>
40+
]}
41+
>
4942
{children}
5043
</Text>
5144
</View>
52-
);
53-
};
45+
)
46+
}
5447

55-
const App: () => Node = () => {
56-
const isDarkMode = useColorScheme() === 'dark';
48+
const App = () => {
49+
const isDarkMode = useColorScheme() === 'dark'
5750

5851
const backgroundStyle = {
5952
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
60-
};
53+
}
6154

6255
return (
6356
<SafeAreaView style={backgroundStyle}>
6457
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
6558
<ScrollView
6659
contentInsetAdjustmentBehavior="automatic"
67-
style={backgroundStyle}>
60+
style={backgroundStyle}
61+
>
6862
<Header />
6963
<View
7064
style={{
7165
backgroundColor: isDarkMode ? Colors.black : Colors.white,
72-
}}>
66+
}}
67+
>
7368
<Section title="Step One">
7469
Edit <Text style={styles.highlight}>App.js</Text> to change this
7570
screen and then come back to see your edits.
@@ -87,8 +82,8 @@ const App: () => Node = () => {
8782
</View>
8883
</ScrollView>
8984
</SafeAreaView>
90-
);
91-
};
85+
)
86+
}
9287

9388
const styles = StyleSheet.create({
9489
sectionContainer: {
@@ -107,6 +102,6 @@ const styles = StyleSheet.create({
107102
highlight: {
108103
fontWeight: '700',
109104
},
110-
});
105+
})
111106

112-
export default App;
107+
export default App

__tests__/App-test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
* @format
33
*/
44

5-
import 'react-native';
6-
import React from 'react';
7-
import App from '../App';
5+
import 'react-native'
6+
import React from 'react'
7+
import App from '../App'
88

99
// Note: test renderer must be required after react-native.
10-
import renderer from 'react-test-renderer';
10+
import renderer from 'react-test-renderer'
1111

1212
it('renders correctly', () => {
13-
renderer.create(<App />);
14-
});
13+
renderer.create(<App />)
14+
})

app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"name": "HackerNews",
33
"displayName": "HackerNews"
4-
}
4+
}

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
22
presets: ['module:metro-react-native-babel-preset'],
3-
};
3+
}

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
* @format
33
*/
44

5-
import {AppRegistry} from 'react-native';
6-
import App from './App';
7-
import {name as appName} from './app.json';
5+
import { AppRegistry } from 'react-native'
6+
import App from './App'
7+
import { name as appName } from './app.json'
88

9-
AppRegistry.registerComponent(appName, () => App);
9+
AppRegistry.registerComponent(appName, () => App)
Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
{
2-
"images" : [
2+
"images": [
33
{
4-
"idiom" : "iphone",
5-
"size" : "29x29",
6-
"scale" : "2x"
4+
"idiom": "iphone",
5+
"size": "29x29",
6+
"scale": "2x"
77
},
88
{
9-
"idiom" : "iphone",
10-
"size" : "29x29",
11-
"scale" : "3x"
9+
"idiom": "iphone",
10+
"size": "29x29",
11+
"scale": "3x"
1212
},
1313
{
14-
"idiom" : "iphone",
15-
"size" : "40x40",
16-
"scale" : "2x"
14+
"idiom": "iphone",
15+
"size": "40x40",
16+
"scale": "2x"
1717
},
1818
{
19-
"idiom" : "iphone",
20-
"size" : "40x40",
21-
"scale" : "3x"
19+
"idiom": "iphone",
20+
"size": "40x40",
21+
"scale": "3x"
2222
},
2323
{
24-
"idiom" : "iphone",
25-
"size" : "60x60",
26-
"scale" : "2x"
24+
"idiom": "iphone",
25+
"size": "60x60",
26+
"scale": "2x"
2727
},
2828
{
29-
"idiom" : "iphone",
30-
"size" : "60x60",
31-
"scale" : "3x"
29+
"idiom": "iphone",
30+
"size": "60x60",
31+
"scale": "3x"
3232
}
3333
],
34-
"info" : {
35-
"version" : 1,
36-
"author" : "xcode"
34+
"info": {
35+
"version": 1,
36+
"author": "xcode"
3737
}
38-
}
38+
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"info" : {
3-
"version" : 1,
4-
"author" : "xcode"
2+
"info": {
3+
"version": 1,
4+
"author": "xcode"
55
}
66
}

0 commit comments

Comments
 (0)