Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/aka4rKO/GoEve
Browse files Browse the repository at this point in the history
  • Loading branch information
amjadnzr committed May 11, 2019
2 parents 35b2131 + 2822ffa commit adce5ed
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 10 deletions.
24 changes: 24 additions & 0 deletions Nasif/goeve_final/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Nasif/goeve_final/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"native-base": "^2.12.1",
"react": "16.8.3",
"react-native": "0.59.4",
"react-native-axios": "^0.17.1",
"react-native-cardview": "^2.0.2",
"react-native-circle-checkbox": "^0.1.6",
"react-native-elements": "^1.1.0",
Expand Down
3 changes: 2 additions & 1 deletion Nasif/goeve_final/src/Route.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { LoginButton } from 'react-native-fbsdk';

import Home from './components/Home';
import Interets from './components/Interets'
import InterestsCards from './components/InterestsCards'
import Login from './components/Login';

const { width: widthDim } = Dimensions.get('window');
Expand Down Expand Up @@ -108,7 +109,7 @@ const HomeStack = createStackNavigator({

const InterestsStack = createStackNavigator({
Interets: {
screen: Interets,
screen: InterestsCards,
navigationOptions: ({ navigation }) => ({
headerStyle: { backgroundColor: '#FB6600' },
headerTitleStyle: {
Expand Down
22 changes: 14 additions & 8 deletions Nasif/goeve_final/src/components/InterestsCards.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,24 @@ export default class App extends Component {
this.handleChange = this.handleChange.bind(this);
}

componentDidMount() {
fetch(`http://35.186.155.252:4000/categories/`)
.then(res => res.json())
.then(json => this.setState({ data: json.categories }));
}

handleChange = (key,checked) => {
console.log("Key "+key+" Checked "+checked)
const newArray = [...this.state.data];
newArray[key].status = checked;
this.setState({data:newArray})
console.log("Length "+this.state.data.length)
this.state.data.map((item,key)=>{console.log(item.name+" "+item.status)})
this.state.data.map((item,key)=>{console.log(item.category+" "+item.status)})
}

componentWillMount (){
/* componentWillMount (){
this.setState({data:this.props.data})
}
} */
renderItem = ({ item, index }) => {
if (item.empty === true) {
return (
Expand All @@ -48,10 +54,10 @@ export default class App extends Component {
cornerRadius={0}
style={styles.itemInvisible}
>
<ImageBackground source={item.url} style={styles.containerImg} resizeMode={'cover'}>
<ImageBackground source={{uri:item.imageURL}} style={styles.containerImg} resizeMode={'cover'}>
<View style={styles.check}>
</View>
<Text style={styles.text}>{item.name}</Text>
<Text style={styles.text}>{item.category}</Text>
</ImageBackground>
</CardView>);
}
Expand All @@ -62,7 +68,7 @@ export default class App extends Component {
cornerRadius={8}
style={styles.card}
>
<ImageBackground source={item.url} style={styles.containerImg} resizeMode={'cover'}>
<ImageBackground source={{uri:item.imageURL}} style={styles.containerImg} resizeMode={'cover'}>
<View style={styles.check}>
<CircleCheckBox
checked={item.status}
Expand All @@ -75,7 +81,7 @@ export default class App extends Component {
filterSize={30}
/>
</View>
<Text style={styles.text}>{item.name}</Text>
<Text style={styles.text}>{item.category}</Text>
</ImageBackground>
</CardView>
);
Expand Down Expand Up @@ -148,7 +154,7 @@ const styles = StyleSheet.create({
height: 110
},
text: {
color: "#000",
color: "#fff",
textAlign: 'center',
textAlignVertical: "center",
marginTop: 17,
Expand Down
34 changes: 33 additions & 1 deletion Nasif/goeve_final/src/components/Interets.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,42 @@ import React, { Component } from 'react';
import InterestsCards from './InterestsCards';
import { Button } from 'react-native-elements';
import { View } from 'native-base';
import axios from 'axios';

export default class Interests extends Component {
constructor() {
super();
this.state = { data: [] };
}

/* componentWillMount() {
this.fetchData();
}
fetchData = async () => {
const res = await fetch(`http://35.186.155.252:4000/categories/`);
const json = await res.json();
this.setState({ data: json.categories });
} */

/* componentDidMount() {
fetch(`http://35.186.155.252:4000/categories/`)
.then(res => res.json())
.then(json => this.setState({ data: json.categories }));
} */

render() {
console.log(this.state.data);

/* let events = [];
const eventType = this.state.datacomponentDidMount() {
fetch(`http://35.186.155.252:4000/categories/`)
.then(res => res.json())
.then(json => this.setState({ data: json.categories }));
}.categories;
eventType.forEach(element => {
events.push(element);
}); */
const eventType = [
{
key: 1,
Expand Down Expand Up @@ -43,7 +75,7 @@ export default class Interests extends Component {
]

return (
<InterestsCards data={eventType} />
<InterestsCards data={/* this.state.data */eventType} />
);
}
}

0 comments on commit adce5ed

Please sign in to comment.