Commit b342b15e authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'didam' into 'master'

update

See merge request !35
parents 649131b9 7b4e31e0
import React, { Component } from 'react'
import { ScrollView, Text, KeyboardAvoidingView, BackHandler } from 'react-native'
import { ScrollView, Text, KeyboardAvoidingView, BackHandler, Dimensions, View } from 'react-native'
import { connect } from 'react-redux'
import HTML from 'react-native-render-html';
// Add Actions - replace 'Your' with whatever your reducer is called :)
// import YourActions from '../Redux/YourRedux'
// Styles
import styles from './Styles/AboutAppScreenStyle'
import BaseHeader from '../Components/BaseHeader';
import Api from '../Services/Api';
class AboutAppScreen extends Component {
constructor(props) {
super(props)
this.state = {
data: null
}
}
backAction = () => {
// alert('asdkladsjkl')
this.props.navigation.goBack()
return true;
};
componentWillUnmount() {
BackHandler.removeEventListener("hardwareBackPress", this.backAction);
}
componentDidMount() {
// alert(JSON.stringify(this.props))
this.getView()
BackHandler.addEventListener("hardwareBackPress", this.backAction);
}
componentWillUnmount() {
BackHandler.removeEventListener("hardwareBackPress", this.backAction);
getView() {
Api.create().aboutUs().then((response) => {
this.setState({data: response.data})
})
}
render () {
return (
<ScrollView style={styles.container}>
<KeyboardAvoidingView behavior='position'>
<Text>AboutAppScreen</Text>
</KeyboardAvoidingView>
</ScrollView>
<View style={{flex: 1, backgroundColor: '#4cc9f0'}}>
<BaseHeader onBackPress={() => this.props.navigation.goBack()} leftText={'Tentang Kami'}/>
{/* <WebView style={{width: '50%', height: '50%'}} source={{ uri: this.state.data }} /> */}
<View style={{borderTopLeftRadius: 32, borderTopRightRadius: 32, backgroundColor: 'white', flex: 1, alignItems: 'center', paddingHorizontal: 25, paddingTop: 20}}>
<HTML html={`${this.state.data}`} imagesMaxWidth={Dimensions.get('window').width} />
</View>
</View>
)
}
}
......
import React, { Component } from 'react'
import { ScrollView, Text, KeyboardAvoidingView, BackHandler } from 'react-native'
import { ScrollView, Text, KeyboardAvoidingView, BackHandler, View, Dimensions } from 'react-native'
import { connect } from 'react-redux'
// Add Actions - replace 'Your' with whatever your reducer is called :)
// import YourActions from '../Redux/YourRedux'
// Styles
import styles from './Styles/AppContactScreenStyle'
import BaseHeader from '../Components/BaseHeader'
import HTML from 'react-native-render-html';
import Api from '../Services/Api'
class AppContactScreen extends Component {
constructor(props) {
super(props)
this.state = {
data: null
}
}
backAction = () => {
// alert('asdkladsjkl')
this.props.navigation.goBack()
return true;
};
componentWillUnmount() {
BackHandler.removeEventListener("hardwareBackPress", this.backAction);
}
componentDidMount() {
// alert(JSON.stringify(this.props))
this.getView()
BackHandler.addEventListener("hardwareBackPress", this.backAction);
}
componentWillUnmount() {
BackHandler.removeEventListener("hardwareBackPress", this.backAction);
getView() {
Api.create().contactUs().then((response) => {
this.setState({data: response.data})
})
}
render () {
return (
<ScrollView style={styles.container}>
<KeyboardAvoidingView behavior='position'>
<Text>AppContactScreen</Text>
</KeyboardAvoidingView>
</ScrollView>
<View style={{flex: 1, backgroundColor: '#4cc9f0'}}>
<BaseHeader onBackPress={() => this.props.navigation.goBack()} leftText={'Kontak Kami'}/>
{/* <WebView style={{width: '50%', height: '50%'}} source={{ uri: this.state.data }} /> */}
<View style={{borderTopLeftRadius: 32, borderTopRightRadius: 32, backgroundColor: 'white', flex: 1, alignItems: 'center', paddingHorizontal: 25, paddingTop: 20}}>
<HTML html={`${this.state.data}`} imagesMaxWidth={Dimensions.get('window').width} />
</View>
</View>
)
}
}
......
......@@ -111,7 +111,7 @@ class CartScreen extends Component {
render () {
return (
<View style={{flex: 1, backgroundColor: '#4cc9f0'}}>
<BaseHeader onBackPress={() => this.props.navigation.goBack()} leftText={'Keranjang'} rightText={'1 item'} />
<BaseHeader onBackPress={() => this.props.navigation.goBack()} leftText={'Keranjang'} />
<ScrollView showsVerticalScrollIndicator={false} style={[styles.scrollContent, {zIndex: 1}]}>
{this.state.listCart.map((item,index) => {
return (
......@@ -139,7 +139,7 @@ class CartScreen extends Component {
<BaseText text={item.product_name} type={"bold"} style={{opacity: .6}}/>
</View>
<View style={{alignItems: 'flex-end', width: '40%', flexGrow: 1}}>
<BaseText text={String(formatRp(item.price))} type={"bold"} style={{opacity: .8, color: '#4cc9f0'}}/>
<BaseText text={String(formatRp(this.state.currency, item.price))} type={"bold"} style={{opacity: .8, color: '#4cc9f0'}}/>
<BaseText text={"Grosir"} type={"bold"} style={{opacity: .5, fontSize: 12}}/>
</View>
</View>
......
import React, { Component } from 'react'
import { ScrollView, Text, KeyboardAvoidingView, BackHandler, View, Image } from 'react-native'
import { ScrollView, Text, KeyboardAvoidingView, BackHandler, View, Image, TouchableOpacity } from 'react-native'
import { connect } from 'react-redux'
// Add Actions - replace 'Your' with whatever your reducer is called :)
// import YourActions from '../Redux/YourRedux'
......@@ -45,9 +45,9 @@ class CategoryScreen extends Component {
<ScrollView showsVerticalScrollIndicator={false} style={[styles.scrollContent, {paddingHorizontal: 25, paddingTop: 25}]}>
{this.state.listCategory.map((item, index) => {
return (
<View style={{marginTop: index == 0? 0 : 15, marginBottom: index == this.state.listCategory.length -1? 50 : 0, elevation: 2, borderRadius: 15}} key={index}>
<TouchableOpacity onPress={() => this.props.navigation.navigate('ListSearchScreen')} style={{marginTop: index == 0? 0 : 15, marginBottom: index == this.state.listCategory.length -1? 50 : 0, elevation: 2, borderRadius: 15}} key={index}>
<Image source={item} style={{width: '100%', height: 100, borderRadius: 10, resizeMode: 'stretch'}}/>
</View>
</TouchableOpacity>
)
})}
</ScrollView>
......
......@@ -14,6 +14,8 @@ import BaseText from '../Components/BaseText';
import Api from '../Services/Api';
import Constant from '../Lib/Constant';
import { formatRp, titleCase } from '../Lib/Utils';
import BaseButton from '../Components/BaseButton';
import Modal from 'react-native-modal';
class DetailProductScreen extends Component {
constructor(props) {
......@@ -25,7 +27,9 @@ class DetailProductScreen extends Component {
dataProduct: {},
currency: '',
varient: [],
varientId: 0,
opacity: 0,
varientModal: false,
auth: this.props.auth
}
}
......@@ -41,8 +45,7 @@ class DetailProductScreen extends Component {
}
getProductDetail() {
// console.log(this.state.productId)
let payload = {"user_id": this.props.auth != null? 0 : 1}
let payload = {"user_id": this.props.auth != null? this.props.auth.user.data.user_id : 0}
Api.create().getProductDetail(this.state.productId, payload).then((response) => {
if (response.data.status == 'success') {
this.setState({dataProduct: response.data.data, varient: response.data.data.varient})
......@@ -78,6 +81,21 @@ class DetailProductScreen extends Component {
console.log(value)
}
handleAddCart(item) {
if (this.state.auth.user != null) {
let payload = {
"product_id": item.product_id,
"varient_id": item.varientId,
"quantity": 1,
"price": this.state.dataProduct.price,
"total_price": this.state.dataProduct.price
}
Api.create().addCart(payload).then((response) => {
this.setState({varientModal: false})
})
}
}
handleWishlist() {
let payload = {"product_id": this.state.dataProduct.product_id}
if (this.state.auth.user != null) {
......@@ -92,15 +110,34 @@ class DetailProductScreen extends Component {
this.getProductDetail()
})
}
} else {
}
}
render () {
return (
<View style={{flex: 1}}>
<Modal
animationOut='slideOutDown'
// animationOutTiming={1000}
isVisible={this.state.varientModal} onBackButtonPress={() => this.setState({ varientModal: false })} onBackdropPress={() => this.setState({varientModal: false})} style={{ paddingHorizontal: 10 }}>
<View style={{ backgroundColor: 'white', width: '90%', alignSelf: 'center', borderRadius: 5}}>
<View style={{ height: 50, borderBottomColor: '#4cc9f0', borderBottomWidth: 1, justifyContent: 'center', paddingHorizontal: 20 }}>
<BaseText type={"bold"} text={'Pilih Variant'} style={{ fontSize: 16, color: '#4cc9f0' }} />
</View>
{this.state.varient.map((item, index) => {
return (
<TouchableOpacity
key={index}
style={{ flexDirection: 'row', justifyContent: this.state.varientId == item.varient_id? 'space-between' : 'flex-start', alignItems:'center', backgroundColor: this.state.varientId == item.varient_id? 'rgba(76, 201, 240, .1)' : 'transparent', paddingHorizontal: 20, paddingVertical: 15, borderBottomColor: 'black', borderBottomWidth: this.state.varient.length -1 == index? 0 : .4, }}
onPress={() => this.handleAddCart(item)}>
<BaseText type={"regular"} text={titleCase(String(item.varient_size).toLocaleLowerCase())} style={{ fontSize: 16, color: 'black' }} />
{this.state.varientId == item.varient_id && <Image source={Images.radioOn} style={{width: 20, height: 20,}}/>}
</TouchableOpacity>)
})}
</View>
</Modal>
<StatusBar backgroundColor={this.state.opacity >= .5? '#4cc9f0' : 'transparent'} translucent={true} barStyle={this.state.opacity >= .5? 'dark-content' : 'light-content'}/>
<View style={{zIndex: 1, flexGrow: 1, alignItems: 'center', width: '100%', elevation: 0, position: 'absolute', top: 0, paddingBottom: 10, paddingHorizontal: 25, paddingTop: STATUSBAR_HEIGHT + 10, flexDirection: 'row', justifyContent: 'space-between', backgroundColor:`rgba(255, 255, 255, ${this.state.opacity})`}}>
<TouchableOpacity onPress={() => this.props.navigation.goBack()}>
......@@ -110,7 +147,7 @@ class DetailProductScreen extends Component {
<Image source={Images.icon_chartbulat} style={{width: 50, height: 50}}/>
</TouchableOpacity>
</View>
<View>
<View style={{flex: 1}}>
<ScrollView style={{backgroundColor:'white'}} onScroll={this.handleScroll} showsVerticalScrollIndicator={false}>
<View style={{height: 450, width: '100%', backgroundColor:'white'}}>
<Carousel
......@@ -173,6 +210,19 @@ class DetailProductScreen extends Component {
<View style={{width: '100%', backgroundColor:'white', marginTop: -25, borderTopLeftRadius: 32, borderTopRightRadius: 32, paddingTop: 20, paddingBottom: 40, paddingHorizontal: 25}}>
</View>
</ScrollView>
<View style={{padding: 20, alignSelf:'flex-end', justifyContent: 'flex-end', backgroundColor: 'white', elevation: 5, width: '100%', borderTopWidth: .5, borderTopColor: '#d8d8d8'}}>
<View style={{flexDirection: 'row', justifyContent: 'space-between',}}>
<TouchableOpacity style={{width: '10%', alignItems:'center'}}>
<Image source={Images.icon_chat} style={{width: 50, height: 50}}/>
</TouchableOpacity>
<View style={{width: '40%'}}>
<BaseButton text={'Beli'} onPress={() => null} fontSizeText={12}/>
</View>
<View style={{width: '40%'}}>
<BaseButton text={'+ Keranjang'} onPress={() => this.setState({varientModal: true})} fontSizeText={12} color={'white'} textColor={'#4cc9f0'} style={{borderWidth: 1, borderColor: '#4cc9f0'}}/>
</View>
</View>
</View>
</View>
</View>
)
......
......@@ -128,7 +128,7 @@ class ListSearchScreen extends Component {
})
}}
onClose={() => {
this.setState({listData: []}, () => {
this.setState({listData: [], search: ''}, () => {
this.refreshState()
this.getAllProduct()
})
......
......@@ -9,6 +9,7 @@ import { connect } from 'react-redux'
import styles from './Styles/TermsConditionScreenStyle'
import WebView from 'react-native-webview'
import Api from '../Services/Api'
import BaseHeader from '../Components/BaseHeader';
const htmlContent = `
<h1>This HTML snippet is now rendered with native components !</h1>
......@@ -41,16 +42,19 @@ class TermsConditionScreen extends Component {
}
getView() {
Api.create().contactUs().then((response) => {
Api.create().termsCondition().then((response) => {
this.setState({data: response.data})
})
}
render () {
return (
<View style={{flex: 1, padding: 20, alignItems:'center', justifyContent: 'center'}}>
<View style={{flex: 1, backgroundColor: '#4cc9f0'}}>
<BaseHeader onBackPress={() => this.props.navigation.goBack()} leftText={'Ketentuan dan Privasi'}/>
{/* <WebView style={{width: '50%', height: '50%'}} source={{ uri: this.state.data }} /> */}
<HTML html={`${this.state.data}`} imagesMaxWidth={Dimensions.get('window').width} />
<View style={{borderTopLeftRadius: 32, borderTopRightRadius: 32, backgroundColor: 'white', flex: 1, alignItems: 'center', paddingHorizontal: 25, paddingTop: 20}}>
<HTML html={`${this.state.data}`} imagesMaxWidth={Dimensions.get('window').width} />
</View>
</View>
)
}
......
......@@ -124,7 +124,7 @@ class WishlistScreen extends Component {
</View>
<View style={{ paddingHorizontal: 10, marginVertical: 10, justifyContent: 'space-between', flex: 1 }}>
<BaseText type={"regular"} text={item.product_name} style={{ fontSize: 14, color: 'black', textAlign: 'left', }} ellipsizeMode={"tail"} numberOfLines={2} />
<BaseText type={"regular"} text={this.number(item.price)} style={{ fontSize: 10, color: 'black', textAlign: 'left', marginTop: 5 }} />
<BaseText type={"regular"} text={item.price} style={{ fontSize: 10, color: 'black', textAlign: 'left', marginTop: 5 }} />
</View>
</TouchableOpacity>
</View>
......
......@@ -44,6 +44,7 @@ const images = {
icon_guarantee: require('../Images/Icons/icon_guarantee.png'),
icon_wishlistgray: require('../Images/Icons/icon_wishlistgray.png'),
icon_sharegray: require('../Images/Icons/icon_sharegray.png'),
icon_chat: require('../Images/Icons/icon_chat.png'),
// big image
letter: require('../Images/letter.png'),
......
......@@ -45,3 +45,14 @@ allprojects {
maven { url 'https://jitpack.io' }
}
}
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
}
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment