Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
safetcut-app
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
atichat
safetcut-app
Commits
cc55a818
Commit
cc55a818
authored
Jul 12, 2019
by
Tonk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update style
parent
9a449b49
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
28 deletions
+83
-28
src/constants/Styles.js
+2
-0
src/screens/public/login.js
+64
-26
src/screens/public/register.js
+17
-2
No files found.
src/constants/Styles.js
View file @
cc55a818
...
@@ -32,6 +32,7 @@ export const theme = StyleSheet.create({
...
@@ -32,6 +32,7 @@ export const theme = StyleSheet.create({
marginLeft
:
5
,
marginLeft
:
5
,
color
:
color
.
grey1
,
color
:
color
.
grey1
,
marginTop
:
30
,
marginTop
:
30
,
fontSize
:
17
},
},
inputErrIcon
:
{
inputErrIcon
:
{
color
:
color
.
red1
,
color
:
color
.
red1
,
...
@@ -51,5 +52,6 @@ export const theme = StyleSheet.create({
...
@@ -51,5 +52,6 @@ export const theme = StyleSheet.create({
alignItems
:
'flex-end'
,
alignItems
:
'flex-end'
,
borderBottomColor
:
'#cfd7db'
,
borderBottomColor
:
'#cfd7db'
,
borderBottomWidth
:
1
,
borderBottomWidth
:
1
,
paddingBottom
:
5
},
},
});
});
src/screens/public/login.js
View file @
cc55a818
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
;
import
{
Container
,
Text
,
Content
,
Input
,
Radio
,
Form
,
Item
,
Left
,
Right
,
Button
,
Row
}
from
'native-base'
;
import
{
Container
,
Text
,
Content
,
Input
,
Radio
,
Item
,
Left
,
Right
,
Button
,
Row
,
CheckBox
}
from
'native-base'
;
import
{
theme
}
from
'../../constants/Styles'
;
import
{
theme
}
from
'../../constants/Styles'
;
import
{
Actions
}
from
'react-native-router-flux'
;
import
{
Actions
}
from
'react-native-router-flux'
;
import
{
LinearGradient
}
from
'expo-linear-gradient'
;
import
{
LinearGradient
}
from
'expo-linear-gradient'
;
import
{
Form
,
Field
}
from
'react-native-validate-form'
;
import
InputField
from
'../../components/layout/InputField'
const
required
=
value
=>
(
value
?
undefined
:
'This is a required field.'
);
const
minChar
=
value
=>
(
value
&&
!
/^.
{6,}
$/i
.
test
(
value
)
?
'At least 6 characters'
:
undefined
);
export
default
class
login
extends
Component
{
export
default
class
login
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
...
@@ -10,47 +15,82 @@ export default class login extends Component {
...
@@ -10,47 +15,82 @@ export default class login extends Component {
isCheck
:
false
,
isCheck
:
false
,
};
};
}
}
submitForm
()
{
let
submitResults
=
this
.
registerForm
.
validate
();
let
errors
=
[];
submitResults
.
forEach
(
item
=>
{
errors
.
push
({
field
:
item
.
fieldName
,
error
:
item
.
error
});
});
this
.
setState
({
errors
:
errors
});
}
submitSuccess
()
{
console
.
log
(
'Submit Success!'
);
Actions
.
HomePage
();
}
submitFailed
()
{
console
.
log
(
'Submit Failed!'
);
}
render
()
{
render
()
{
return
(
return
(
<
Container
>
<
Container
>
<
Content
style
=
{
theme
.
startContainer
}
>
<
Content
style
=
{
theme
.
startContainer
}
>
<
Text
style
=
{
theme
.
startTitle
}
>
Login
<
/Text
>
<
Text
style
=
{
theme
.
startTitle
}
>
Login
<
/Text
>
<
Form
style
=
{
theme
.
startFormContainer
}
>
<
Form
<
Item
>
ref
=
{
ref
=>
(
this
.
registerForm
=
ref
)}
<
Input
validate
=
{
true
}
placeholder
=
"Username"
submit
=
{
this
.
submitSuccess
.
bind
(
this
)}
placeholderTextColor
=
{
'#cacaca'
}
failed
=
{
this
.
submitFailed
.
bind
(
this
)}
style
=
{{
color
:
'#808080'
}}
errors
=
{
this
.
state
.
errors
}
/
>
style
=
{
theme
.
startFormContainer
}
<
/Item
>
>
<
Item
>
{
/* ---Username--- */
}
<
Input
<
Field
secureTextEntry
=
{
true
}
required
placeholder
=
"Password"
component
=
{
InputField
}
placeholderTextColor
=
{
'#cacaca'
}
validations
=
{[
required
]}
style
=
{{
color
:
'#808080'
}}
name
=
"Username"
/
>
value
=
{
this
.
state
.
username
}
<
/Item
>
onChangeText
=
{
val
=>
this
.
setState
({
username
:
val
})}
customStyle
=
{
theme
.
input
}
placeholder
=
"Username"
/>
{
/* ---password--- */
}
<
Field
required
component
=
{
InputField
}
validations
=
{[
required
,
minChar
]}
name
=
"password"
value
=
{
this
.
state
.
password
}
onChangeText
=
{
val
=>
this
.
setState
({
password
:
val
})}
customStyle
=
{
theme
.
input
}
placeholder
=
"Password"
isPass
=
{
true
}
/
>
<
/Form
>
<
/Form
>
<
Row
style
=
{{
marginTop
:
30
}}
>
<
Row
style
=
{{
marginTop
:
30
}}
>
<
Left
>
<
Left
>
<
Row
>
<
Row
style
=
{{
alignItems
:
'center'
}}
>
<
Radio
<
CheckBox
color
=
{
'#cacaca'
}
color
=
{
'#cacaca'
}
select
ed
=
{
this
.
state
.
isCheck
}
check
ed
=
{
this
.
state
.
isCheck
}
onPress
=
{()
=>
onPress
=
{()
=>
this
.
setState
(()
=>
{
this
.
setState
(()
=>
{
return
(
this
.
state
.
isCheck
=
!
this
.
state
.
isCheck
);
return
(
this
.
state
.
isCheck
=
!
this
.
state
.
isCheck
);
})
})
}
}
/
>
/
>
<
Text
style
=
{{
color
:
'#cacaca'
,
marginLeft
:
5
}}
>
Remember
me
<
/Text
>
<
Text
style
=
{{
color
:
'#cacaca'
,
marginLeft
:
12
,
fontSize
:
13
}}
>
Remember
me
<
/Text
>
<
/Row
>
<
/Row
>
<
/Left
>
<
/Left
>
<
Right
>
<
Right
>
<
Text
<
Text
style
=
{{
color
:
'#cacaca'
}}
style
=
{{
color
:
'#cacaca'
,
fontSize
:
13
,
marginRight
:
10
}}
onPress
=
{()
=>
{
onPress
=
{()
=>
{
Actions
.
ForgotPass
();
Actions
.
ForgotPass
();
}}
}}
...
@@ -68,9 +108,7 @@ export default class login extends Component {
...
@@ -68,9 +108,7 @@ export default class login extends Component {
<
Button
<
Button
full
full
transparent
transparent
onPress
=
{()
=>
{
onPress
=
{
this
.
submitForm
.
bind
(
this
)}
Actions
.
HomePage
();
}}
>
>
<
Text
style
=
{{
color
:
'white'
}}
>
LOGIN
<
/Text
>
<
Text
style
=
{{
color
:
'white'
}}
>
LOGIN
<
/Text
>
<
/Button
>
<
/Button
>
...
...
src/screens/public/register.js
View file @
cc55a818
...
@@ -5,6 +5,7 @@ import { Form, Field } from 'react-native-validate-form';
...
@@ -5,6 +5,7 @@ import { Form, Field } from 'react-native-validate-form';
import
InputField
from
'../../components/layout/InputField'
;
import
InputField
from
'../../components/layout/InputField'
;
import
{
LinearGradient
}
from
'expo-linear-gradient'
;
import
{
LinearGradient
}
from
'expo-linear-gradient'
;
import
{
Actions
}
from
'react-native-router-flux'
;
import
{
Actions
}
from
'react-native-router-flux'
;
import
{
Alert
}
from
'react-native'
// validations
// validations
const
required
=
value
=>
(
value
?
undefined
:
'This is a required field.'
);
const
required
=
value
=>
(
value
?
undefined
:
'This is a required field.'
);
...
@@ -43,6 +44,20 @@ export default class register extends Component {
...
@@ -43,6 +44,20 @@ export default class register extends Component {
submitSuccess
()
{
submitSuccess
()
{
console
.
log
(
'Submit Success!'
);
console
.
log
(
'Submit Success!'
);
Alert
.
alert
(
'Completed!'
,
'You have completed your registration'
,
[
// {text: 'Ask me later', onPress: () => console.log('Ask me later pressed')},
// {
// text: 'Cancel',
// onPress: () => console.log('Cancel Pressed'),
// style: 'cancel',
// },
{
text
:
'Go to Login'
,
onPress
:
()
=>
Actions
.
LoginPage
()},
],
{
cancelable
:
false
},
);
// Actions.LoginPage();
// Actions.LoginPage();
}
}
...
@@ -142,9 +157,9 @@ export default class register extends Component {
...
@@ -142,9 +157,9 @@ export default class register extends Component {
})
})
}
}
/
>
/
>
<
Text
style
=
{{
color
:
'#9ea0a5'
,
marginLeft
:
15
}}
>
<
Text
style
=
{{
color
:
'#9ea0a5'
,
marginLeft
:
15
,
fontSize
:
14
}}
>
I
have
read
the
{
' '
}
I
have
read
the
{
' '
}
<
Text
style
=
{{
textDecorationLine
:
'underline'
,
color
:
'#56575a'
}}
>
<
Text
style
=
{{
textDecorationLine
:
'underline'
,
color
:
'#56575a'
,
fontSize
:
14
}}
>
Terms
and
Conditions
Terms
and
Conditions
<
/Text
>
<
/Text
>
.
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment