about summary refs log tree commit diff
path: root/src/view/com/util/images/ImageHorzList.tsx
blob: bed13406c08b0bfcc17b54cd41323b4063898162 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import React from 'react'
import {
  StyleProp,
  StyleSheet,
  TouchableWithoutFeedback,
  View,
  ViewStyle,
} from 'react-native'
import Image from 'view/com/util/images/Image'

export function ImageHorzList({
  uris,
  onPress,
  style,
}: {
  uris: string[]
  onPress?: (index: number) => void
  style?: StyleProp<ViewStyle>
}) {
  return (
    <View style={[styles.flexRow, style]}>
      {uris.map((uri, i) => (
        <TouchableWithoutFeedback key={i} onPress={() => onPress?.(i)}>
          <Image source={{uri}} style={styles.image} />
        </TouchableWithoutFeedback>
      ))}
    </View>
  )
}

const styles = StyleSheet.create({
  flexRow: {flexDirection: 'row'},
  image: {
    width: 100,
    height: 100,
    borderRadius: 4,
    marginRight: 5,
  },
})