-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jeremy Voros
authored and
Jeremy Voros
committed
Oct 22, 2018
1 parent
f96bd4e
commit 4ba1be2
Showing
17 changed files
with
244 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import React from 'react'; | ||
import { | ||
Button, | ||
FlatList, | ||
Modal, | ||
Text, | ||
SafeAreaView, | ||
ScrollView, | ||
TouchableOpacity, | ||
View | ||
} from 'react-native'; | ||
|
||
import { getCategories } from './CardLibrary'; | ||
import { analyzeThis } from './utils'; | ||
import Colors from './colors'; | ||
|
||
const ListItem = (props) => | ||
<TouchableOpacity | ||
onPress={() => {props.onPress()}} | ||
> | ||
<View style={{borderBottomWidth: 1, borderColor: Colors.lightGray }}> | ||
<Text | ||
style={{ fontFamily: 'open-sans-regular', fontSize: 16, padding: 10 }} | ||
> | ||
{props.cat.name} | ||
</Text> | ||
</View> | ||
|
||
</TouchableOpacity> | ||
|
||
class CardsSortModal extends React.Component { | ||
|
||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
cats: getCategories() | ||
} | ||
} | ||
// componentDidMount() { | ||
// analyzeThis('HomeScreen'); | ||
// } | ||
|
||
render() { | ||
return ( | ||
|
||
<Modal | ||
animationType="fade" | ||
transparent={true} | ||
visible={this.props.visible} | ||
onRequestClose={() => { | ||
this.props.closeModal | ||
}}> | ||
<SafeAreaView | ||
style={{ | ||
flex: 1, | ||
padding: 20, | ||
backgroundColor: 'rgba(0,176,146,.8)', | ||
}}> | ||
<View style={{ flex: 1, margin: 30, padding: 20, backgroundColor: 'white', overflow: 'hidden'}}> | ||
<Button title="Cancel" onPress={() => { this.props.closeModal()} } /> | ||
<ScrollView> | ||
<ListItem key={99999999999} cat={{ name: 'All Categories' }} onPress={() => this.props.onPress(null)} /> | ||
{ this.state.cats.map((cat,index) => | ||
<ListItem | ||
key={index} | ||
cat={cat} | ||
onPress={() => this.props.onPress(cat)} | ||
/> | ||
)} | ||
</ScrollView> | ||
</View> | ||
</SafeAreaView> | ||
|
||
</Modal> | ||
|
||
); | ||
} | ||
} | ||
|
||
export default CardsSortModal; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from 'react'; | ||
import { Analytics, PageHit } from 'expo-analytics'; | ||
|
||
export const constants = { | ||
GA: 'UA-124875540-2' | ||
} | ||
|
||
export function analyzeThis(log) { | ||
const analytics = new Analytics(constants.GA, null, { debug: true }); | ||
analytics.hit(new PageHit(log)) | ||
.then(() => `logged ${log}`) | ||
.catch(e => console.log(e.message)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
import {AsyncStorage, Button, FlatList, Text, View} from 'react-native'; | ||
|
||
import { analyzeThis } from '../components/utils'; | ||
import { getCategories } from '../components/CardLibrary'; | ||
|
||
const cats = getCategories(); | ||
|
||
class About extends React.Component { | ||
|
||
componentDidMount() { | ||
analyzeThis('AboutScreen'); | ||
} | ||
|
||
render() { | ||
return ( | ||
<View> | ||
<FlatList | ||
horizontal | ||
data={cats} | ||
keyExtractor={(item) => item.slug} //each list item needs unique key | ||
renderItem={({item, index}) => <Text>{item.name}</Text>} | ||
/> | ||
<Text>About Screen</Text> | ||
{/* <Button title="clear storage" onPress={() => AsyncStorage.removeItem('FAVORITES', console.log('removed favorites'))} />\ | ||
<Button title="show storage" onPress={() => AsyncStorage.getItem('FAVORITES').then(fav => { console.log(fav)})} /> */} | ||
</View> | ||
); | ||
} | ||
} | ||
|
||
export default About; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React from 'react'; | ||
import { SafeAreaView, Text, TouchableOpacity, View } from 'react-native'; | ||
import { withNavigation } from 'react-navigation'; | ||
import { FontAwesome as Icon } from '@expo/vector-icons'; | ||
|
||
import CardList from '../components/CardList'; | ||
import CardListSection from '../components/CardListSection'; | ||
import CardsSortModal from '../components/CardsSortModal'; | ||
import { getSummaries } from '../components/CardLibrary'; | ||
import Colors from '../components/colors'; | ||
|
||
const FilterButton = (props) => | ||
<TouchableOpacity onPress={props.onPress} style={{ backgroundColor: Colors.lightGray }}> | ||
<View style={{ flex: 0, flexDirection: 'row', padding: 10 }}> | ||
<Icon name='sort' size={18} color={Colors.primary} style={{ marginRight: 8}}></Icon> | ||
<Text style={{ fontSize: 18, color: Colors.primary }}>Filter by Category</Text> | ||
</View> | ||
</TouchableOpacity> | ||
|
||
class CardsSortScreen extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
modalVisible: false | ||
} | ||
} | ||
|
||
toggleModal() { | ||
this.setState({ modalVisible: !this.state.modalVisible }) | ||
} | ||
|
||
selectCategory(cat) { | ||
this.setState({ selectedCategory: cat, modalVisible: !this.state.modalVisible }); | ||
} | ||
|
||
render() { | ||
return( | ||
<SafeAreaView style={{ flex: 1 }}> | ||
<FilterButton onPress={() => this.toggleModal()} /> | ||
<CardsSortModal | ||
visible={this.state.modalVisible} | ||
closeModal={() => this.toggleModal()} | ||
onPress={(cat) => this.selectCategory(cat) } | ||
/> | ||
{ this.state.selectedCategory == null && (<CardList cards={getSummaries()} />) } | ||
{ this.state.selectedCategory && ( | ||
<CardListSection sections={[{ title: this.state.selectedCategory.name, data: this.state.selectedCategory.cards }]}/> | ||
)} | ||
</SafeAreaView> | ||
); | ||
} | ||
} | ||
|
||
export default withNavigation(CardsSortScreen); |
Oops, something went wrong.