45 lines
1.4 KiB
JavaScript
45 lines
1.4 KiB
JavaScript
import { Button, Text as NBText, Thumbnail, View } from "native-base";
|
|
import React from "react";
|
|
import { SafeAreaView, Text } from "react-native";
|
|
|
|
import { connect } from "react-redux";
|
|
import { createStructuredSelector } from "reselect";
|
|
import { removeAllPhotos } from "../../redux/photos/photos.actions";
|
|
import { selectPhotos } from "../../redux/photos/photos.selectors";
|
|
const mapStateToProps = createStructuredSelector({
|
|
photos: selectPhotos,
|
|
});
|
|
const mapDispatchToProps = (dispatch) => ({
|
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
|
removeAllPhotos: () => dispatch(removeAllPhotos()),
|
|
});
|
|
|
|
export function ScreenMediaCache({ photos, removeAllPhotos }) {
|
|
return (
|
|
<SafeAreaView style={{ display: "flex", flex: 1 }}>
|
|
<Text>This is the media cache screen.</Text>
|
|
<Button block onPress={() => removeAllPhotos()}>
|
|
<NBText>Delete all</NBText>
|
|
</Button>
|
|
<Text>{photos.length}</Text>
|
|
<View
|
|
style={{
|
|
flex: 1,
|
|
display: "flex",
|
|
direction: "row",
|
|
backgroundColor: "tomato",
|
|
}}
|
|
>
|
|
<Text>The View</Text>
|
|
{photos.map((i, idx) => (
|
|
<View>
|
|
<Text>{i.uri}</Text>
|
|
<Thumbnail square large key={idx} source={{ uri: i.uri }} />
|
|
</View>
|
|
))}
|
|
</View>
|
|
</SafeAreaView>
|
|
);
|
|
}
|
|
export default connect(mapStateToProps, mapDispatchToProps)(ScreenMediaCache);
|