Skip to content

Commit

Permalink
Add/Delete clip
Browse files Browse the repository at this point in the history
  • Loading branch information
takahi5 committed Feb 15, 2020
1 parent 5b733fa commit 8c6d4db
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions screens/ArticleScreen.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from 'react';
import {StyleSheet, SafeAreaView, Text} from 'react-native';
import {StyleSheet, SafeAreaView, Text, TouchableOpacity} from 'react-native';
import {WebView} from 'react-native-webview';
import {connect} from 'react-redux';
import {addClip, deleteClip} from '../store/actions/user';

const styles = StyleSheet.create({
container: {
Expand All @@ -9,11 +11,34 @@ const styles = StyleSheet.create({
},
});

export default ArticleScreen = ({route}) => {
const ArticleScreen = props => {
const {route, addClip, deleteClip} = props;
const {article} = route.params;
return (
<SafeAreaView style={styles.container}>
<TouchableOpacity
onPress={() => {
addClip({clip: article});
}}>
<Text style={{margin: 10, fontSize: 30}}>Fav</Text>
</TouchableOpacity>

<TouchableOpacity
onPress={() => {
deleteClip({clip: article});
}}>
<Text style={{margin: 10, fontSize: 30}}>Del</Text>
</TouchableOpacity>
<WebView source={{uri: article.url}} />
</SafeAreaView>
);
};

const mapStateProps = state => {
return {
user: state.user,
};
};

const mapDispatchToProps = {addClip, deleteClip};
export default connect(mapStateProps, mapDispatchToProps)(ArticleScreen);

0 comments on commit 8c6d4db

Please sign in to comment.