Skip to content

Commit 15f8d3e

Browse files
AkashDhimangnprice
authored andcommitted
sharing: Display file name under content preview.
This makes it more clear which preview belongs to which file.
1 parent bdddc44 commit 15f8d3e

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

src/sharing/ShareToPm.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* @flow strict-local */
22
import React from 'react';
3-
import { View, Image, ScrollView, Modal, FlatList } from 'react-native';
3+
import { View, ImageBackground, ScrollView, Modal, FlatList, Text } from 'react-native';
44
import type { RouteProp } from '../react-navigation';
55
import type { SharingNavigationProp } from './SharingScreen';
66
import * as NavigationService from '../nav/NavigationService';
@@ -55,6 +55,15 @@ const styles = createStyleSheet({
5555
borderColor: 'whitesmoke',
5656
padding: 5,
5757
},
58+
previewText: {
59+
color: 'white',
60+
textAlign: 'center',
61+
backgroundColor: '#000000a0',
62+
position: 'absolute',
63+
bottom: 0,
64+
left: 0,
65+
right: 0,
66+
},
5867
});
5968

6069
type Props = $ReadOnly<{|
@@ -157,7 +166,9 @@ class ShareToPm extends React.Component<Props, State> {
157166

158167
renderItem = ({ item, index, separators }) =>
159168
item.type.startsWith('image') ? (
160-
<Image source={{ uri: item.url }} style={styles.imagePreview} />
169+
<ImageBackground source={{ uri: item.url }} style={styles.imagePreview}>
170+
<Text style={styles.previewText}>{item.fileName}</Text>
171+
</ImageBackground>
161172
) : (
162173
<></>
163174
);

src/sharing/ShareToStream.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* @flow strict-local */
22
import React from 'react';
3-
import { View, Image, ScrollView, FlatList } from 'react-native';
3+
import { View, ImageBackground, ScrollView, FlatList, Text } from 'react-native';
44
import type { SharingNavigationProp } from './SharingScreen';
55
import type { RouteProp } from '../react-navigation';
66
import * as NavigationService from '../nav/NavigationService';
@@ -40,6 +40,15 @@ const styles = createStyleSheet({
4040
flex: 1,
4141
margin: 8,
4242
},
43+
previewText: {
44+
color: 'white',
45+
textAlign: 'center',
46+
backgroundColor: '#000000a0',
47+
position: 'absolute',
48+
bottom: 0,
49+
left: 0,
50+
right: 0,
51+
},
4352
});
4453

4554
type Props = $ReadOnly<{|
@@ -158,7 +167,9 @@ class ShareToStream extends React.Component<Props, State> {
158167

159168
renderItem = ({ item, index, separators }) =>
160169
item.type.startsWith('image') ? (
161-
<Image source={{ uri: item.url }} style={styles.imagePreview} />
170+
<ImageBackground source={{ uri: item.url }} style={styles.imagePreview}>
171+
<Text style={styles.previewText}>{item.fileName}</Text>
172+
</ImageBackground>
162173
) : (
163174
<></>
164175
);

0 commit comments

Comments
 (0)