import React, { Component } from 'react';
import { View, ScrollView,TouchableHighlight } from 'react-native';
import { WebView } from 'react-native-webview';
class Product {
constructor(name, category, hexCode, color,uid) {
this.name = name;
this.category = category;
this.hexCode = hexCode;
this.color = color;
this.uid = uid
}
}
const p1 = new Product("Pulpoar Lipstick 01", "Lipstick","l01", "#8d2152", "product_code");
const p2 = new Product("Pulpoar Lipstick 02", "Lipstick","l02", "#A4585E", "product_code");
const p3 = new Product("Pulpoar Lipstick 3","Lipstick","l03","#7f081d","product_code");
const p4 = new Product("Pulpoar Blusher 01","Blusher","b01","#f27a51","product_code");
const p5 = new Product("Pulpoar Eyeliner 01","Eyeliner","e01", "#000000", "product_code");
const p6 = new Product("Pulpoar Foundation 01", "Foundation", "f01", "#DFBBA1", "product_code");
const initialCommand =
`
origin = origin = 'http://127.0.0.1:8000';
initProducts('WRITE_YOUR_WEBSITE_UID', origin);
activeProduct = {"Lipstick": "Pulpoar Lipstick 01", "makeupType":["Lipstick"], "makeupMode":0}
set_active_products(JSON.stringify(activeProduct))
`;
const url = 'https://devphotomakeup.pulpoar.com/'
let products = [
p1,p2,p3,p4,p5,p6,
];
class DemoPulpoAr extends Component {
render(){
return (
<View
style={{
flexDirection: "column",
flex: 1,
justifyContent: 'space-between'
}}>
<View
style={{
flexDirection: "column",
flex: 0.8,
justifyContent: 'space-between'
}}>
<WebView
source={{ uri: url }}
injectedJavaScript= {initialCommand}
ref={(ref) => (this.webview = ref)}
/>
</View>
<View
style = {{
flexDirection: "row",
flex: 0.2,
justifyContent: 'space-around',
}}>
<ScrollView
horizontal ={true}
>
<TouchableHighlight
onPress = {()=>{
this.webview.injectJavaScript("applyProductWithCode('********')")
}}
>
<View
style ={{
margin : 20,
padding : 30,
borderRadius : 40,
backgroundColor: products[0].color
}}
>
</View>
</TouchableHighlight>
<TouchableHighlight
onPress = {()=>{
this.webview.injectJavaScript("applyProductWithCode('********')")
}}
>
<View
style ={{
margin : 20,
padding : 30,
borderRadius : 40,
backgroundColor: products[1].color
}}
>
</View>
</TouchableHighlight>
<TouchableHighlight
onPress = {()=>{
this.webview.injectJavaScript("applyProductWithCode('********')")
}}
>
<View
style ={{
margin : 20,
padding : 30,
borderRadius : 40,
backgroundColor: products[2].color
}}
>
</View>
</TouchableHighlight>
<TouchableHighlight
onPress = {()=>{
this.webview.injectJavaScript("applyProductWithCode('********')")
}}
>
<View
style ={{
margin : 20,
padding : 30,
borderRadius : 40,
backgroundColor: products[3].color
}}
>
</View>
</TouchableHighlight>
<TouchableHighlight
onPress = {()=>{
this.webview.injectJavaScript("applyProductWithCode('********')")
}}
>
<View
style ={{
margin : 20,
padding : 30,
borderRadius : 40,
backgroundColor: products[4].color
}}
>
</View>
</TouchableHighlight>
<TouchableHighlight
onPress = {()=>{
this.webview.injectJavaScript("applyProductWithCode('********')")
}}
>
<View
style ={{
margin : 20,
padding : 30,
borderRadius : 40,
backgroundColor: products[5].color
}}
>
</View>
</TouchableHighlight>
</ScrollView>
</View>
</View>
);
}
}
export default DemoPulpoAr;