Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-090 frontend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-090
2021-090 frontend
Commits
4d0f1d0a
Commit
4d0f1d0a
authored
Nov 25, 2021
by
pramod.nichelabs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add bid functionality addded
parent
3d36ff1c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
5 deletions
+52
-5
components/add_bid_button.component.js
components/add_bid_button.component.js
+11
-3
screen/Auction.Detail.Screen.js
screen/Auction.Detail.Screen.js
+41
-2
No files found.
components/add_bid_button.component.js
View file @
4d0f1d0a
import
React
from
'
react
'
;
import
React
,
{
useState
}
from
'
react
'
;
import
{
StyleSheet
,
TouchableOpacity
,
View
,
TextInput
}
from
'
react-native
'
;
import
themeColors
from
'
../assets/colors
'
;
import
{
MaterialIcons
}
from
"
@expo/vector-icons
"
;
export
const
AppAddBid
=
(
props
)
=>
{
const
[
bid
,
setBid
]
=
useState
(
''
);
const
handleChange
=
(
val
)
=>
{
setBid
(
val
);
}
return
(
<
View
style
=
{
styles
.
bidContainer
}
>
<
TextInput
style
=
{
styles
.
input
}
keyboardType
=
'
number-pad
'
placeholder
=
'
Enter bid
'
/>
<
TouchableOpacity
onPress
=
{
props
.
onPress
}
style
=
{
styles
.
bid
}
>
<
TextInput
style
=
{
styles
.
input
}
keyboardType
=
'
number-pad
'
placeholder
=
'
Enter bid
'
onChangeText
=
{(
val
)
=>
handleChange
(
val
)}
/
>
<
TouchableOpacity
onPress
=
{()
=>
props
.
onPress
(
bid
)}
style
=
{
styles
.
bid
}
>
<
MaterialIcons
name
=
"
add
"
size
=
{
16
}
color
=
{
themeColors
.
WHITE
}
/
>
<
/TouchableOpacity
>
<
/View
>
...
...
screen/Auction.Detail.Screen.js
View file @
4d0f1d0a
import
React
,
{
useEffect
,
useState
}
from
'
react
'
;
import
axios
from
'
axios
'
;
import
{
View
,
StyleSheet
,
Text
,
ScrollView
}
from
'
react-native
'
;
import
{
AppStakeItem
}
from
'
../components/auction.stake.component
'
;
import
{
AppContainer
}
from
'
../container/container
'
;
...
...
@@ -6,8 +7,9 @@ import themeColors from '../assets/colors';
import
{
AuctionBottomTab
}
from
'
../Navigations/AuctionBottomTab
'
;
import
AppCarousel
from
'
../components/carousel.component
'
;
import
{
AppAddBid
}
from
'
../components/add_bid_button.component
'
;
import
Toast
from
'
react-native-root-toast
'
;
const
AuctionDetailScreen
=
({
route
})
=>
{
const
AuctionDetailScreen
=
({
route
,
navigation
})
=>
{
const
[
auction
,
setAuction
]
=
useState
({
bids
:
[]});
const
[
bids
,
setBids
]
=
useState
([]);
console
.
log
(
route
.
params
.
auctionObject
.
bids
);
...
...
@@ -17,6 +19,43 @@ const AuctionDetailScreen = ({route}) => {
useEffect
(()
=>
{
setBids
(
auction
.
bids
)
},
[
auction
])
const
handleAddBid
=
(
bidPrice
)
=>
{
const
bidObj
=
{
id
:
0
,
name
:
auction
.
name
,
owner
:
auction
.
owner
,
bidprice
:
bidPrice
}
const
url
=
"
http://127.0.0.1:8085/bids/
"
+
auction
.
_id
axios
.
post
(
url
,
bidObj
)
.
then
(
async
function
(
response
)
{
console
.
log
(
response
.
data
);
if
(
response
.
data
.
message
===
'
Created
'
)
{
const
successMsg
=
Toast
.
show
(
'
Your bid has been placed successfully
'
,
{
duration
:
Toast
.
durations
.
LONG
,
});
setTimeout
(
function
hideToast
()
{
Toast
.
hide
(
successMsg
);
},
1000
);
navigation
.
navigate
(
'
AuctionHomeScreen
'
);
}
else
{
const
errMsg
=
Toast
.
show
(
'
Bid Creation Failed
'
,
{
duration
:
Toast
.
durations
.
LONG
,
});
setTimeout
(
function
hideToast
()
{
Toast
.
hide
(
errMsg
);
},
1000
);
}
})
.
catch
(
function
(
error
)
{
const
errMsg
=
Toast
.
show
(
'
Bid Creation Failed
'
,
{
duration
:
Toast
.
durations
.
LONG
,
});
setTimeout
(
function
hideToast
()
{
Toast
.
hide
(
errMsg
);
},
1000
);
});
}
return
(
<
View
style
=
{
styles
.
wrapper
}
>
<
View
style
=
{
styles
.
header
}
>
...
...
@@ -41,7 +80,7 @@ const AuctionDetailScreen = ({route}) => {
})}
<
/View
>
<
/ScrollView
>
<
AppAddBid
/>
<
AppAddBid
onPress
=
{(
bidPrice
)
=>
handleAddBid
(
bidPrice
)}
/
>
<
/AppContainer
>
<
AuctionBottomTab
/>
<
/View
>
...
...
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