Commit 3150c4e7 authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo
parents 6951cc5b 4d782529
...@@ -419,7 +419,7 @@ class Auth extends React.Component { ...@@ -419,7 +419,7 @@ class Auth extends React.Component {
}, },
title: 'REGISTER' title: 'REGISTER'
}} /> }} />
<Stack.Screen name="TopUpInfo" component={TopUpInfo} /> <Stack.Screen name="TopUpInfo" component={TopUpInfo} options={{ headerShown: false }}/>
<Stack.Screen name="Reward Detail" component={RewardDetail} /> <Stack.Screen name="Reward Detail" component={RewardDetail} />
<Stack.Screen name="Reward Select" component={RewardSelect} <Stack.Screen name="Reward Select" component={RewardSelect}
options={{ options={{
......
...@@ -30,7 +30,6 @@ export default class NewsDetail extends React.Component { ...@@ -30,7 +30,6 @@ export default class NewsDetail extends React.Component {
get_news_detail(slug) { get_news_detail(slug) {
Axios.get('https://excelsocrm.ravintoladev.com/cms/v2/detail/' + slug).then(res => { Axios.get('https://excelsocrm.ravintoladev.com/cms/v2/detail/' + slug).then(res => {
// console.log(JSON.stringify(res.data))
const detail = res.data; const detail = res.data;
this.setState({ this.setState({
title: detail.title, title: detail.title,
...@@ -43,7 +42,6 @@ export default class NewsDetail extends React.Component { ...@@ -43,7 +42,6 @@ export default class NewsDetail extends React.Component {
} }
render() { render() {
console.log('Image : ' + this.state.image)
return ( return (
<View style={styles.container(this.state.statusbar_height)}> <View style={styles.container(this.state.statusbar_height)}>
<View style={styles.header}> <View style={styles.header}>
......
import React from 'react';
import {
View,
StyleSheet,
Text,
StatusBar,
Image,
ScrollView,
TouchableOpacity,
Alert,
ImageBackground,
} from 'react-native';
import { CheckBox, Separator, Grid, Row, Card, Button, Icon, CardItem, Body } from 'native-base';
import { Collapse, CollapseHeader, CollapseBody, AccordionList } from 'accordion-collapse-react-native'
import Axios from 'axios'; import Axios from 'axios';
import React from 'react';
import { ScrollView, StyleSheet, Text, View, Image } from 'react-native';
import { TouchableOpacity } from 'react-native-gesture-handler';
import HTML from 'react-native-render-html'; import HTML from 'react-native-render-html';
import { getStatusBarHeight } from 'react-native-status-bar-height';
export default class TopUpInfo extends React.Component { export default class TopUpInfo extends React.Component {
constructor(props){ constructor(props) {
super(props); super(props);
this.state = { this.state = {
content:"" topup_info: [],
statusbar_height: 50
} }
} }
componentDidMount(){ componentDidMount() {
Axios.get('https://excelsocrm.ravintoladev.com/cms/v2/detail/topup-info').then(res => { const statusBarHeight = getStatusBarHeight();
this.setState({
let data = res.data statusbar_height: statusBarHeight
let contents = data.content })
Axios.get('https://excelsocrm.ravintoladev.com/cms/v2/list/topup-info').then(res => {
let data = res.data;
this.setState({ this.setState({
topup_info: data.contents
content:contents
}) })
}).catch(error => {
let response = error.response.data;
// console.log(response.msg)
Alert.alert(response.msg);
}) })
} }
render() { render() {
const htmlContent = this.state.content;
return ( return (
<ScrollView style={{ backgroundColor:'white'}}> <View style={styles.container(this.state.statusbar_height)}>
<View style={{ flex: 1 }}> <View style={styles.header}>
<Text style={styles.headerTitle}>TOPUP INFO</Text>
<Collapse> </View>
<CollapseHeader> <ScrollView>
<Separator bordered style={{backgroundColor:'white'}}> <View style={styles.content}>
<Text style={{ fontSize: 12, fontWeight: 'bold' }}>Bank BCA</Text> {
</Separator> this.state.topup_info.map((item, i) => {
</CollapseHeader> return (
<CollapseBody> <View style={styles.item_container} key={i}>
<Card style={{ marginLeft: 10, marginRight: 10 }}> <View style={{flexDirection: 'row', height: 24, marginBottom: 16}}>
<CardItem> <Text style={styles.item_title}>{item.title}</Text>
<Body style={{ marginLeft: 5 }}> <Image style={styles.item_image} source={item.title_thumb ? { uri: item.title_thumb } : null}/>
<HTML html={this.state.content} /> </View>
</Body> <HTML html={item.content} tagsStyles={{ p: { fontFamily: 'Gotham-Light', marginTop: 8, marginBottom: 8, color: '#adadad' }, blockquote: { backgroundColor: "#f1f1f1", padding: 12, paddingBottom: 0, marginTop: 6, color: '#adadad' }, ul: { fontFamily: 'Gotham-Light', marginLeft: 0, color: '#adadad', paddingLeft: 0 }, li: { fontFamily: 'Gotham-Light', marginLeft: 0, color: '#adadad', paddingLeft: 0 } }} />
</CardItem> </View>
</Card> )
</CollapseBody> })
</Collapse> }
<Collapse>
<CollapseHeader>
<Separator bordered style={{backgroundColor:'white'}}>
<Text style={{ fontSize: 12, fontWeight: 'bold' }}>Bank BNI</Text>
</Separator>
</CollapseHeader>
<CollapseBody>
<Card style={{ marginLeft: 10, marginRight: 10 }}>
<CardItem>
<Body style={{ marginLeft: 5 }}>
<HTML html={this.state.content} />
</Body>
</CardItem>
</Card>
</CollapseBody>
</Collapse>
<Collapse>
<CollapseHeader>
<Separator bordered style={{backgroundColor:'white'}}>
<Text style={{ fontSize: 12, fontWeight: 'bold' }}>Bank MANDIRI</Text>
</Separator>
</CollapseHeader>
<CollapseBody>
<Card style={{ marginLeft: 10, marginRight: 10 }}>
<CardItem>
<Body style={{ marginLeft: 5 }}>
<HTML html={this.state.content} />
</Body>
</CardItem>
</Card>
</CollapseBody>
</Collapse>
</View> </View>
</ScrollView>
</ScrollView> </View>
) )
} }
} }
\ No newline at end of file
const styles = StyleSheet.create({
container: (marginTop) => ({
flex: 1,
marginTop: marginTop,
backgroundColor: 'white',
}),
header: {
height: 60,
paddingHorizontal: 10,
flexDirection: 'row',
backgroundColor: '#CFB368',
alignItems: 'center'
},
headerTitle: {
flex: 1,
textAlign: 'center',
margin: 20,
fontSize: 23,
alignSelf: 'center',
color: 'white',
fontFamily: 'Gotham-Black'
},
image_container: (height) => ({
height: height,
backgroundColor: 'gray'
}),
image: (height) => ({
width: '100%',
height: height
}),
title: {
textAlign: 'center',
fontFamily: 'Gotham-Black',
fontSize: 22,
marginBottom: 10,
color: '#CFB368'
},
content: {
paddingHorizontal: 20,
paddingVertical: 25
},
item_container: {
borderColor: 'gray',
borderWidth: 1,
borderRadius: 10,
padding: 20,
marginBottom: 20,
color: '#adadad'
},
item_title: {
fontSize: 18,
color: '#adadad',
fontFamily: 'Gotham-Black',
flex: 1,
alignSelf: 'center',
},
item_image: {
width: 96,
height: 24,
alignItems: 'flex-end'
}
})
\ 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