Skip to content

Commit e401a6f

Browse files
committed
first commit
1 parent 0e7ac7e commit e401a6f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+18368
-0
lines changed

.buckconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
[android]
3+
target = Google Inc.:Google APIs:23
4+
5+
[maven_repositories]
6+
central = https://repo1.maven.org/maven2

.eslintrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
root: true,
3+
extends: '@react-native-community',
4+
};

.flowconfig

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
[ignore]
2+
; We fork some components by platform
3+
.*/*[.]android.js
4+
5+
; Ignore "BUCK" generated dirs
6+
<PROJECT_ROOT>/\.buckd/
7+
8+
; Ignore polyfills
9+
node_modules/react-native/Libraries/polyfills/.*
10+
11+
; These should not be required directly
12+
; require from fbjs/lib instead: require('fbjs/lib/warning')
13+
node_modules/warning/.*
14+
15+
; Flow doesn't support platforms
16+
.*/Libraries/Utilities/LoadingView.js
17+
18+
[untyped]
19+
.*/node_modules/@react-native-community/cli/.*/.*
20+
21+
[include]
22+
23+
[libs]
24+
node_modules/react-native/Libraries/react-native/react-native-interface.js
25+
node_modules/react-native/flow/
26+
27+
[options]
28+
emoji=true
29+
30+
esproposal.optional_chaining=enable
31+
esproposal.nullish_coalescing=enable
32+
33+
module.file_ext=.js
34+
module.file_ext=.json
35+
module.file_ext=.ios.js
36+
37+
munge_underscores=true
38+
39+
module.name_mapper='^react-native$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/react-native/react-native-implementation'
40+
module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
41+
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'
42+
43+
suppress_type=$FlowIssue
44+
suppress_type=$FlowFixMe
45+
suppress_type=$FlowFixMeProps
46+
suppress_type=$FlowFixMeState
47+
48+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
49+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
50+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
51+
52+
[lints]
53+
sketchy-null-number=warn
54+
sketchy-null-mixed=warn
55+
sketchy-number=warn
56+
untyped-type-import=warn
57+
nonstrict-import=warn
58+
deprecated-type=warn
59+
unsafe-getters-setters=warn
60+
inexact-spread=warn
61+
unnecessary-invariant=warn
62+
signature-verification-failure=warn
63+
deprecated-utility=error
64+
65+
[strict]
66+
deprecated-type
67+
nonstrict-import
68+
sketchy-null
69+
unclear-type
70+
unsafe-getters-setters
71+
untyped-import
72+
untyped-type-import
73+
74+
[version]
75+
^0.105.0

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.pbxproj -text

.gitignore

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# Xcode
6+
#
7+
build/
8+
*.pbxuser
9+
!default.pbxuser
10+
*.mode1v3
11+
!default.mode1v3
12+
*.mode2v3
13+
!default.mode2v3
14+
*.perspectivev3
15+
!default.perspectivev3
16+
xcuserdata
17+
*.xccheckout
18+
*.moved-aside
19+
DerivedData
20+
*.hmap
21+
*.ipa
22+
*.xcuserstate
23+
project.xcworkspace
24+
25+
# Android/IntelliJ
26+
#
27+
build/
28+
.idea
29+
.gradle
30+
local.properties
31+
*.iml
32+
33+
# node.js
34+
#
35+
node_modules/
36+
npm-debug.log
37+
yarn-error.log
38+
39+
# BUCK
40+
buck-out/
41+
\.buckd/
42+
*.keystore
43+
!debug.keystore
44+
45+
# fastlane
46+
#
47+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
48+
# screenshots whenever they are needed.
49+
# For more information about the recommended setup visit:
50+
# https://docs.fastlane.tools/best-practices/source-control/
51+
52+
*/fastlane/report.xml
53+
*/fastlane/Preview.html
54+
*/fastlane/screenshots
55+
56+
# Bundle artifact
57+
*.jsbundle
58+
59+
# CocoaPods
60+
/ios/Pods/

.prettierrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
bracketSpacing: false,
3+
jsxBracketSameLine: true,
4+
singleQuote: true,
5+
trailingComma: 'all',
6+
};

.watchmanconfig

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

App.js

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
import React, { Component } from "react";
2+
import {
3+
Alert,
4+
View,
5+
StyleSheet,
6+
Text,
7+
ScrollView,
8+
TouchableOpacity
9+
} from "react-native";
10+
import TextField from "./TextField.js";
11+
import Robot from './assets/images/GiantRobotLTD_Logo.svg';
12+
import Arrow from './assets/images/White_Arrow.svg';
13+
14+
export default class App extends Component {
15+
constructor(props) {
16+
super(props);
17+
this.state = {
18+
firstName:'',
19+
lastName:'',
20+
addressOne:'',
21+
addressTwo:'',
22+
validate:true
23+
};
24+
}
25+
26+
handleChange(name) {
27+
return (text) => {
28+
this.setState({ [name]:text })
29+
}
30+
}
31+
32+
check=()=>{
33+
let {firstName, lastName, addressOne, addressTwo} = this.state;
34+
this.setState({
35+
validate:false
36+
})
37+
if(firstName.length > 0 && lastName.length > 0 && addressOne.length > 0){
38+
Alert.alert(
39+
'HI!',
40+
`Welcome ${firstName} ${lastName}, residing at ${addressOne} ${addressTwo}`,
41+
{text: 'OK', onPress: () => console.log('OK Pressed')},
42+
{cancelable: false},
43+
);
44+
}
45+
}
46+
47+
validate=(param)=>{
48+
if(!this.state.validate){
49+
return param !== '' ? false : true;
50+
}
51+
}
52+
53+
render() {
54+
let {firstName, lastName, addressOne, addressTwo} = this.state;
55+
return (
56+
<View style={styles.container}>
57+
<ScrollView>
58+
59+
<View style={styles.headContainer}>
60+
<View style={styles.headSvgWrapper}>
61+
<Robot width={177} height={26} />
62+
</View>
63+
<Text style={styles.headTextWelcome}>Welcome</Text>
64+
<Text style={styles.headText}>Please tell us a little about yourself to get started.</Text>
65+
</View>
66+
67+
<View style={styles.inputContainer}>
68+
<TextField
69+
title={'FIRST NAME'}
70+
value={firstName}
71+
onTextChange={this.handleChange('firstName')}
72+
isRequired={this.validate(firstName)}/>
73+
<TextField
74+
title={'LAST NAME'}
75+
value={lastName}
76+
onTextChange={this.handleChange('lastName')}
77+
isRequired={this.validate(lastName)}/>
78+
<TextField
79+
title={'ADDRESS'}
80+
value={addressOne}
81+
onTextChange={this.handleChange('addressOne')}
82+
isRequired={this.validate(addressOne)}/>
83+
<TextField
84+
title={'ADDRESS 2 (OPTIONAL)'}
85+
value={addressTwo}
86+
onTextChange={this.handleChange('addressTwo')}
87+
/>
88+
</View>
89+
</ScrollView>
90+
91+
<View style={styles.button}>
92+
<TouchableOpacity style={styles.buttonWrapper} onPress={this.check}>
93+
<Text style={styles.buttonText}>NEXT</Text>
94+
<Arrow/>
95+
</TouchableOpacity>
96+
</View>
97+
</View>
98+
);
99+
}
100+
}
101+
102+
const styles = StyleSheet.create({
103+
container: {
104+
flex: 1
105+
},
106+
headContainer: {
107+
paddingTop: 32,
108+
paddingBottom: 32,
109+
marginBottom:32,
110+
paddingHorizontal:10,
111+
backgroundColor: "#585858"
112+
},
113+
headSvgWrapper: {
114+
paddingVertical:32,
115+
},
116+
headTextWelcome:{
117+
fontFamily: "Roboto-Bold",
118+
color: "#FFFFFF",
119+
paddingBottom:20,
120+
fontSize:24
121+
},
122+
headText: {
123+
fontFamily: "Merriweather-Regular",
124+
color: "#EAEAEA",
125+
fontSize:14
126+
},
127+
inputContainer:{
128+
padding: 10
129+
},
130+
inputTitleWrapper:{
131+
display: 'flex'
132+
},
133+
inputTitle: {
134+
paddingBottom:5
135+
},
136+
input: {
137+
borderWidth: 1,
138+
borderColor: "black",
139+
padding: 12,
140+
borderRadius:6,
141+
fontSize:14,
142+
marginBottom: 15,
143+
alignSelf: "stretch"
144+
},
145+
button: {
146+
marginHorizontal:20,
147+
marginBottom: 20
148+
},
149+
buttonWrapper:{
150+
backgroundColor: "#FFAB44",
151+
justifyContent:'center',
152+
flexDirection:"row",
153+
alignItems:'center',
154+
paddingVertical:15,
155+
borderRadius:6
156+
},
157+
buttonText:{
158+
color: "#FFFFFF",
159+
fontFamily:'Roboto-Bold',
160+
fontSize: 16,
161+
paddingRight:8
162+
}
163+
});

TextField.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import React, { Component } from "react";
2+
import {
3+
View,
4+
StyleSheet,
5+
Text,
6+
TextInput
7+
} from "react-native";
8+
9+
export default class TextField extends Component {
10+
11+
handleChange = (event = {}) => {
12+
const value = event.nativeEvent.text;
13+
this.props.onTextChange(value);
14+
}
15+
16+
render() {
17+
return (
18+
<View style={styles.inputContainer}>
19+
<View style={styles.headerWrapper}>
20+
<Text style={styles.inputTitle}>{this.props.title}</Text>
21+
{this.props.isRequired && <Text style={[styles.inputTitle, {color:'red'}]}> REQUIRED</Text>}
22+
</View>
23+
<TextInput
24+
style={[styles.input, this.props.value && {borderColor:'blue'}, this.props.isRequired && {borderColor:'red'}]}
25+
value={this.props.value}
26+
onChange={this.handleChange}
27+
/>
28+
</View>
29+
);
30+
}
31+
}
32+
33+
const styles = StyleSheet.create({
34+
inputContainer:{
35+
padding: 10
36+
},
37+
headerWrapper:{
38+
display: "flex",
39+
flexDirection: "row"
40+
},
41+
inputTitle: {
42+
fontFamily: "Merriweather-Regular",
43+
paddingBottom:5
44+
},
45+
input: {
46+
borderWidth: 1,
47+
backgroundColor: "#EAEAEA",
48+
borderColor: "transparent",
49+
padding: 12,
50+
borderRadius:6,
51+
fontSize:14,
52+
marginBottom: 15,
53+
alignSelf: "stretch"
54+
}
55+
});

__tests__/App-test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @format
3+
*/
4+
5+
import 'react-native';
6+
import React from 'react';
7+
import App from '../App';
8+
9+
// Note: test renderer must be required after react-native.
10+
import renderer from 'react-test-renderer';
11+
12+
it('renders correctly', () => {
13+
renderer.create(<App />);
14+
});

0 commit comments

Comments
 (0)