Skip to content

Commit

Permalink
[NEW] Image Viewer (#1479)
Browse files Browse the repository at this point in the history
  • Loading branch information
djorkaeffalexandre authored and diegolmello committed Dec 18, 2019
1 parent 3f02552 commit 66d2140
Show file tree
Hide file tree
Showing 89 changed files with 9,342 additions and 7,788 deletions.
144 changes: 92 additions & 52 deletions __tests__/__snapshots__/Storyshots.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10718,39 +10718,59 @@ exports[`Storyshots Message list 1`] = `
style={
Array [
Object {
"overflow": "hidden",
"borderRadius": 4,
"borderWidth": 1,
"minHeight": 200,
"width": "100%",
},
Object {
"borderColor": "#e1e5e8",
},
]
}
>
<View
style={
Array [
Object {
"borderRadius": 4,
"borderWidth": 1,
"minHeight": 200,
"width": "100%",
"overflow": "hidden",
},
Array [
Object {
"bottom": 0,
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
},
undefined,
],
]
}
>
<FastImageView
onFastImageError={[Function]}
onFastImageLoad={[Function]}
onFastImageLoadEnd={[Function]}
onFastImageLoadStart={[Function]}
onFastImageProgress={[Function]}
resizeMode="cover"
source={
Object {
"borderColor": "#e1e5e8",
},
],
]
}
>
<FastImageView
resizeMode="cover"
source={
Object {
"uri": "https://open.rocket.chat/file-upload/2ZrxuwcGeTrsoh376/Clipboard%252520-%252520September%2525205,%2525202018%2525204:10%252520PM?rc_uid=y8bd77ptZswPj3EW8&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz",
"uri": "https://open.rocket.chat/file-upload/2ZrxuwcGeTrsoh376/Clipboard%252520-%252520September%2525205,%2525202018%2525204:10%252520PM?rc_uid=y8bd77ptZswPj3EW8&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz",
}
}
}
style={
Object {
"bottom": 0,
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
style={
Object {
"bottom": 0,
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
}
}
}
/>
/>
</View>
</View>
<Text
style={
Expand Down Expand Up @@ -10995,39 +11015,59 @@ exports[`Storyshots Message list 1`] = `
style={
Array [
Object {
"overflow": "hidden",
"borderRadius": 4,
"borderWidth": 1,
"minHeight": 200,
"width": "100%",
},
Object {
"borderColor": "#e1e5e8",
},
]
}
>
<View
style={
Array [
Object {
"borderRadius": 4,
"borderWidth": 1,
"minHeight": 200,
"width": "100%",
"overflow": "hidden",
},
Array [
Object {
"bottom": 0,
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
},
undefined,
],
]
}
>
<FastImageView
onFastImageError={[Function]}
onFastImageLoad={[Function]}
onFastImageLoadEnd={[Function]}
onFastImageLoadStart={[Function]}
onFastImageProgress={[Function]}
resizeMode="cover"
source={
Object {
"borderColor": "#e1e5e8",
},
],
]
}
>
<FastImageView
resizeMode="cover"
source={
Object {
"uri": "https://open.rocket.chat/file-upload/sxLXBzjwuqxMnebyP/Clipboard%252520-%25252029%252520de%252520Agosto%252520de%2525202018%252520%2525C3%2525A0s%25252018:10?rc_uid=y8bd77ptZswPj3EW8&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz",
"uri": "https://open.rocket.chat/file-upload/sxLXBzjwuqxMnebyP/Clipboard%252520-%25252029%252520de%252520Agosto%252520de%2525202018%252520%2525C3%2525A0s%25252018:10?rc_uid=y8bd77ptZswPj3EW8&rc_token=79q6lH40W4ZRGLOshDiDiVlQaCc4f_lU9HNdHLAzuHz",
}
}
}
style={
Object {
"bottom": 0,
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
style={
Object {
"bottom": 0,
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
}
}
}
/>
/>
</View>
</View>
<Text
style={
Expand Down
132 changes: 0 additions & 132 deletions app/containers/FileModal.js

This file was deleted.

10 changes: 10 additions & 0 deletions app/containers/HeaderButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ export const MoreButton = React.memo(({ onPress, testID }) => (
</CustomHeaderButtons>
));

export const SaveButton = React.memo(({ onPress, testID }) => (
<CustomHeaderButtons>
<Item title='save' iconName='Download' onPress={onPress} testID={testID} />
</CustomHeaderButtons>
));

export const LegalButton = React.memo(({ navigation, testID }) => (
<MoreButton onPress={() => navigation.navigate('LegalView')} testID={testID} />
));
Expand All @@ -80,6 +86,10 @@ MoreButton.propTypes = {
onPress: PropTypes.func.isRequired,
testID: PropTypes.string.isRequired
};
SaveButton.propTypes = {
onPress: PropTypes.func.isRequired,
testID: PropTypes.string.isRequired
};
LegalButton.propTypes = {
navigation: PropTypes.object.isRequired,
testID: PropTypes.string.isRequired
Expand Down
8 changes: 4 additions & 4 deletions app/containers/message/Attachments.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ import Video from './Video';
import Reply from './Reply';

const Attachments = React.memo(({
attachments, timeFormat, user, baseUrl, useMarkdown, onOpenFileModal, getCustomEmoji, theme
attachments, timeFormat, user, baseUrl, useMarkdown, showAttachment, getCustomEmoji, theme
}) => {
if (!attachments || attachments.length === 0) {
return null;
}

return attachments.map((file, index) => {
if (file.image_url) {
return <Image key={file.image_url} file={file} user={user} baseUrl={baseUrl} onOpenFileModal={onOpenFileModal} getCustomEmoji={getCustomEmoji} useMarkdown={useMarkdown} theme={theme} />;
return <Image key={file.image_url} file={file} user={user} baseUrl={baseUrl} showAttachment={showAttachment} getCustomEmoji={getCustomEmoji} useMarkdown={useMarkdown} theme={theme} />;
}
if (file.audio_url) {
return <Audio key={file.audio_url} file={file} user={user} baseUrl={baseUrl} getCustomEmoji={getCustomEmoji} useMarkdown={useMarkdown} theme={theme} />;
}
if (file.video_url) {
return <Video key={file.video_url} file={file} user={user} baseUrl={baseUrl} onOpenFileModal={onOpenFileModal} getCustomEmoji={getCustomEmoji} useMarkdown={useMarkdown} theme={theme} />;
return <Video key={file.video_url} file={file} user={user} baseUrl={baseUrl} showAttachment={showAttachment} getCustomEmoji={getCustomEmoji} useMarkdown={useMarkdown} theme={theme} />;
}

// eslint-disable-next-line react/no-array-index-key
Expand All @@ -36,7 +36,7 @@ Attachments.propTypes = {
user: PropTypes.object,
baseUrl: PropTypes.string,
useMarkdown: PropTypes.bool,
onOpenFileModal: PropTypes.func,
showAttachment: PropTypes.func,
getCustomEmoji: PropTypes.func,
theme: PropTypes.string
};
Expand Down
Loading

0 comments on commit 66d2140

Please sign in to comment.