First prototype of image upload working. IO-397 IO-398
This commit is contained in:
@@ -3,37 +3,44 @@ import React from "react";
|
||||
import { FlatList, SafeAreaView, Text } from "react-native";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { removeAllPhotos } from "../../redux/photos/photos.actions";
|
||||
import {
|
||||
removeAllPhotos,
|
||||
uploadAllPhotos,
|
||||
} 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()),
|
||||
uploadAllphotos: () => dispatch(uploadAllPhotos()),
|
||||
});
|
||||
|
||||
export function ScreenMediaCache({ photos, removeAllPhotos }) {
|
||||
export function ScreenMediaCache({ photos, removeAllPhotos, uploadAllphotos }) {
|
||||
return (
|
||||
<SafeAreaView style={{ display: "flex", flex: 1 }}>
|
||||
<Text>This is the media cache screen.</Text>
|
||||
<Button block onPress={() => removeAllPhotos()}>
|
||||
<NBText>Delete all</NBText>
|
||||
</Button>
|
||||
<Button block onPress={() => uploadAllphotos()}>
|
||||
<NBText>Upload all</NBText>
|
||||
</Button>
|
||||
<Text>{photos.length}</Text>
|
||||
|
||||
<FlatList
|
||||
style={{ flex: 1, backgroundColor: "tomato" }}
|
||||
style={{ flex: 1 }}
|
||||
data={photos}
|
||||
keyExtractor={(item) => item.id}
|
||||
renderItem={(object) => (
|
||||
<View>
|
||||
<Text>{object.item.uri}</Text>
|
||||
<Thumbnail square large source={{ uri: object.item.uri }} />
|
||||
{!object.item.video && (
|
||||
<Thumbnail square large source={{ uri: object.item.uri }} />
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
//ItemSeparatorComponent={FlatListItemSeparator}
|
||||
/>
|
||||
</SafeAreaView>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user