Commit 7b4e31e0 authored by d.arizona's avatar d.arizona

update

parent 649131b9
import React, { Component } from 'react' 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 { connect } from 'react-redux'
import HTML from 'react-native-render-html';
// Add Actions - replace 'Your' with whatever your reducer is called :) // Add Actions - replace 'Your' with whatever your reducer is called :)
// import YourActions from '../Redux/YourRedux' // import YourActions from '../Redux/YourRedux'
// Styles // Styles
import styles from './Styles/AboutAppScreenStyle' import styles from './Styles/AboutAppScreenStyle'
import BaseHeader from '../Components/BaseHeader';
import Api from '../Services/Api';
class AboutAppScreen extends Component { class AboutAppScreen extends Component {
constructor(props) {
super(props)
this.state = {
data: null
}
}
backAction = () => { backAction = () => {
// alert('asdkladsjkl')
this.props.navigation.goBack() this.props.navigation.goBack()
return true; return true;
}; };
componentWillUnmount() {
BackHandler.removeEventListener("hardwareBackPress", this.backAction);
}
componentDidMount() { componentDidMount() {
// alert(JSON.stringify(this.props)) this.getView()
BackHandler.addEventListener("hardwareBackPress", this.backAction); BackHandler.addEventListener("hardwareBackPress", this.backAction);
} }
componentWillUnmount() { getView() {
BackHandler.removeEventListener("hardwareBackPress", this.backAction); Api.create().aboutUs().then((response) => {
this.setState({data: response.data})
})
} }
render () { render () {
return ( return (
<ScrollView style={styles.container}> <View style={{flex: 1, backgroundColor: '#4cc9f0'}}>
<KeyboardAvoidingView behavior='position'> <BaseHeader onBackPress={() => this.props.navigation.goBack()} leftText={'Tentang Kami'}/>
<Text>AboutAppScreen</Text> {/* <WebView style={{width: '50%', height: '50%'}} source={{ uri: this.state.data }} /> */}
</KeyboardAvoidingView> <View style={{borderTopLeftRadius: 32, borderTopRightRadius: 32, backgroundColor: 'white', flex: 1, alignItems: 'center', paddingHorizontal: 25, paddingTop: 20}}>
</ScrollView> <HTML html={`${this.state.data}`} imagesMaxWidth={Dimensions.get('window').width} />
</View>
</View>
) )
} }
} }
......
import React, { Component } from 'react' 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' import { connect } from 'react-redux'
// Add Actions - replace 'Your' with whatever your reducer is called :) // Add Actions - replace 'Your' with whatever your reducer is called :)
// import YourActions from '../Redux/YourRedux' // import YourActions from '../Redux/YourRedux'
// Styles // Styles
import styles from './Styles/AppContactScreenStyle' 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 { class AppContactScreen extends Component {
constructor(props) {
super(props)
this.state = {
data: null
}
}
backAction = () => { backAction = () => {
// alert('asdkladsjkl')
this.props.navigation.goBack() this.props.navigation.goBack()
return true; return true;
}; };
componentWillUnmount() {
BackHandler.removeEventListener("hardwareBackPress", this.backAction);
}
componentDidMount() { componentDidMount() {
// alert(JSON.stringify(this.props)) this.getView()
BackHandler.addEventListener("hardwareBackPress", this.backAction); BackHandler.addEventListener("hardwareBackPress", this.backAction);
} }
componentWillUnmount() { getView() {
BackHandler.removeEventListener("hardwareBackPress", this.backAction); Api.create().contactUs().then((response) => {
this.setState({data: response.data})
})
} }
render () { render () {
return ( return (
<ScrollView style={styles.container}> <View style={{flex: 1, backgroundColor: '#4cc9f0'}}>
<KeyboardAvoidingView behavior='position'> <BaseHeader onBackPress={() => this.props.navigation.goBack()} leftText={'Kontak Kami'}/>
<Text>AppContactScreen</Text> {/* <WebView style={{width: '50%', height: '50%'}} source={{ uri: this.state.data }} /> */}
</KeyboardAvoidingView> <View style={{borderTopLeftRadius: 32, borderTopRightRadius: 32, backgroundColor: 'white', flex: 1, alignItems: 'center', paddingHorizontal: 25, paddingTop: 20}}>
</ScrollView> <HTML html={`${this.state.data}`} imagesMaxWidth={Dimensions.get('window').width} />
</View>
</View>
) )
} }
} }
......
...@@ -111,7 +111,7 @@ class CartScreen extends Component { ...@@ -111,7 +111,7 @@ class CartScreen extends Component {
render () { render () {
return ( return (
<View style={{flex: 1, backgroundColor: '#4cc9f0'}}> <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}]}> <ScrollView showsVerticalScrollIndicator={false} style={[styles.scrollContent, {zIndex: 1}]}>
{this.state.listCart.map((item,index) => { {this.state.listCart.map((item,index) => {
return ( return (
...@@ -139,7 +139,7 @@ class CartScreen extends Component { ...@@ -139,7 +139,7 @@ class CartScreen extends Component {
<BaseText text={item.product_name} type={"bold"} style={{opacity: .6}}/> <BaseText text={item.product_name} type={"bold"} style={{opacity: .6}}/>
</View> </View>
<View style={{alignItems: 'flex-end', width: '40%', flexGrow: 1}}> <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}}/> <BaseText text={"Grosir"} type={"bold"} style={{opacity: .5, fontSize: 12}}/>
</View> </View>
</View> </View>
......
import React, { Component } from 'react' 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' import { connect } from 'react-redux'
// Add Actions - replace 'Your' with whatever your reducer is called :) // Add Actions - replace 'Your' with whatever your reducer is called :)
// import YourActions from '../Redux/YourRedux' // import YourActions from '../Redux/YourRedux'
...@@ -45,9 +45,9 @@ class CategoryScreen extends Component { ...@@ -45,9 +45,9 @@ class CategoryScreen extends Component {
<ScrollView showsVerticalScrollIndicator={false} style={[styles.scrollContent, {paddingHorizontal: 25, paddingTop: 25}]}> <ScrollView showsVerticalScrollIndicator={false} style={[styles.scrollContent, {paddingHorizontal: 25, paddingTop: 25}]}>
{this.state.listCategory.map((item, index) => { {this.state.listCategory.map((item, index) => {
return ( 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'}}/> <Image source={item} style={{width: '100%', height: 100, borderRadius: 10, resizeMode: 'stretch'}}/>
</View> </TouchableOpacity>
) )
})} })}
</ScrollView> </ScrollView>
......
...@@ -14,6 +14,8 @@ import BaseText from '../Components/BaseText'; ...@@ -14,6 +14,8 @@ import BaseText from '../Components/BaseText';
import Api from '../Services/Api'; import Api from '../Services/Api';
import Constant from '../Lib/Constant'; import Constant from '../Lib/Constant';
import { formatRp, titleCase } from '../Lib/Utils'; import { formatRp, titleCase } from '../Lib/Utils';
import BaseButton from '../Components/BaseButton';
import Modal from 'react-native-modal';
class DetailProductScreen extends Component { class DetailProductScreen extends Component {
constructor(props) { constructor(props) {
...@@ -25,7 +27,9 @@ class DetailProductScreen extends Component { ...@@ -25,7 +27,9 @@ class DetailProductScreen extends Component {
dataProduct: {}, dataProduct: {},
currency: '', currency: '',
varient: [], varient: [],
varientId: 0,
opacity: 0, opacity: 0,
varientModal: false,
auth: this.props.auth auth: this.props.auth
} }
} }
...@@ -41,8 +45,7 @@ class DetailProductScreen extends Component { ...@@ -41,8 +45,7 @@ class DetailProductScreen extends Component {
} }
getProductDetail() { getProductDetail() {
// console.log(this.state.productId) let payload = {"user_id": this.props.auth != null? this.props.auth.user.data.user_id : 0}
let payload = {"user_id": this.props.auth != null? 0 : 1}
Api.create().getProductDetail(this.state.productId, payload).then((response) => { Api.create().getProductDetail(this.state.productId, payload).then((response) => {
if (response.data.status == 'success') { if (response.data.status == 'success') {
this.setState({dataProduct: response.data.data, varient: response.data.data.varient}) this.setState({dataProduct: response.data.data, varient: response.data.data.varient})
...@@ -78,6 +81,21 @@ class DetailProductScreen extends Component { ...@@ -78,6 +81,21 @@ class DetailProductScreen extends Component {
console.log(value) 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() { handleWishlist() {
let payload = {"product_id": this.state.dataProduct.product_id} let payload = {"product_id": this.state.dataProduct.product_id}
if (this.state.auth.user != null) { if (this.state.auth.user != null) {
...@@ -92,7 +110,6 @@ class DetailProductScreen extends Component { ...@@ -92,7 +110,6 @@ class DetailProductScreen extends Component {
this.getProductDetail() this.getProductDetail()
}) })
} }
} else { } else {
} }
...@@ -101,6 +118,26 @@ class DetailProductScreen extends Component { ...@@ -101,6 +118,26 @@ class DetailProductScreen extends Component {
render () { render () {
return ( return (
<View style={{flex: 1}}> <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'}/> <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})`}}> <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()}> <TouchableOpacity onPress={() => this.props.navigation.goBack()}>
...@@ -110,7 +147,7 @@ class DetailProductScreen extends Component { ...@@ -110,7 +147,7 @@ class DetailProductScreen extends Component {
<Image source={Images.icon_chartbulat} style={{width: 50, height: 50}}/> <Image source={Images.icon_chartbulat} style={{width: 50, height: 50}}/>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
<View> <View style={{flex: 1}}>
<ScrollView style={{backgroundColor:'white'}} onScroll={this.handleScroll} showsVerticalScrollIndicator={false}> <ScrollView style={{backgroundColor:'white'}} onScroll={this.handleScroll} showsVerticalScrollIndicator={false}>
<View style={{height: 450, width: '100%', backgroundColor:'white'}}> <View style={{height: 450, width: '100%', backgroundColor:'white'}}>
<Carousel <Carousel
...@@ -173,6 +210,19 @@ class DetailProductScreen extends Component { ...@@ -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 style={{width: '100%', backgroundColor:'white', marginTop: -25, borderTopLeftRadius: 32, borderTopRightRadius: 32, paddingTop: 20, paddingBottom: 40, paddingHorizontal: 25}}>
</View> </View>
</ScrollView> </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>
</View> </View>
) )
......
...@@ -128,7 +128,7 @@ class ListSearchScreen extends Component { ...@@ -128,7 +128,7 @@ class ListSearchScreen extends Component {
}) })
}} }}
onClose={() => { onClose={() => {
this.setState({listData: []}, () => { this.setState({listData: [], search: ''}, () => {
this.refreshState() this.refreshState()
this.getAllProduct() this.getAllProduct()
}) })
......
...@@ -9,6 +9,7 @@ import { connect } from 'react-redux' ...@@ -9,6 +9,7 @@ import { connect } from 'react-redux'
import styles from './Styles/TermsConditionScreenStyle' import styles from './Styles/TermsConditionScreenStyle'
import WebView from 'react-native-webview' import WebView from 'react-native-webview'
import Api from '../Services/Api' import Api from '../Services/Api'
import BaseHeader from '../Components/BaseHeader';
const htmlContent = ` const htmlContent = `
<h1>This HTML snippet is now rendered with native components !</h1> <h1>This HTML snippet is now rendered with native components !</h1>
...@@ -41,17 +42,20 @@ class TermsConditionScreen extends Component { ...@@ -41,17 +42,20 @@ class TermsConditionScreen extends Component {
} }
getView() { getView() {
Api.create().contactUs().then((response) => { Api.create().termsCondition().then((response) => {
this.setState({data: response.data}) this.setState({data: response.data})
}) })
} }
render () { render () {
return ( 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 }} /> */} {/* <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} /> <HTML html={`${this.state.data}`} imagesMaxWidth={Dimensions.get('window').width} />
</View> </View>
</View>
) )
} }
} }
......
...@@ -124,7 +124,7 @@ class WishlistScreen extends Component { ...@@ -124,7 +124,7 @@ class WishlistScreen extends Component {
</View> </View>
<View style={{ paddingHorizontal: 10, marginVertical: 10, justifyContent: 'space-between', flex: 1 }}> <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={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> </View>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
......
...@@ -44,6 +44,7 @@ const images = { ...@@ -44,6 +44,7 @@ const images = {
icon_guarantee: require('../Images/Icons/icon_guarantee.png'), icon_guarantee: require('../Images/Icons/icon_guarantee.png'),
icon_wishlistgray: require('../Images/Icons/icon_wishlistgray.png'), icon_wishlistgray: require('../Images/Icons/icon_wishlistgray.png'),
icon_sharegray: require('../Images/Icons/icon_sharegray.png'), icon_sharegray: require('../Images/Icons/icon_sharegray.png'),
icon_chat: require('../Images/Icons/icon_chat.png'),
// big image // big image
letter: require('../Images/letter.png'), letter: require('../Images/letter.png'),
......
...@@ -45,3 +45,14 @@ allprojects { ...@@ -45,3 +45,14 @@ allprojects {
maven { url 'https://jitpack.io' } 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