简体   繁体   中英

How to add text only on my profile picture?

I wanna add the word "cover" on the current profile pic of my FlatList .

On my FlatList I have a few pictures, when I clicked and I change my current profile epic, I want just the word "cover".

I tried to add a condition, but it doesn't work properly.


  const { firstName, lastName, profilePictureURL } = currentUser;
  const userLastName = currentUser && lastName ? lastName : ' ';
  const userfirstName = currentUser && firstName ? firstName : ' ';


{myphotos.map((photos, i) => (
                    <View key={'photos' + i} style={styles.slide}>
                      <View style={styles.slideActivity}>
                        <FlatList
                          horizontal={false}
                          numColumns={2}
                          data={photos}
                          scrollEnabled={true}
                          renderItem={
                            (({ item, index }) =>
                              item.add ? (
                                <TouchableOpacity
                                  key={'item' + index}
                                  style={[
                                    styles.myphotosItemView,
                                    {
                                      borderWidth: 1,
                                      borderColor: '#5DD6FF',
                                    },
                                  ]}
                                  onPress={onSelectAddPhoto}>
                                  <Icon
                                    style={styles.icon}
                                    name="add"
                                    size={40}
                                    color="#5DD6FF"
                                  />
                                </TouchableOpacity>
                              ) : (
                                <TouchableOpacity
                                  key={'item' + index}
                                  style={styles.myphotosItemView}
                                  onPress={() =>
                                    onSelectDelPhoto(i * 6 + index)
                                  }>
                                  <FastImage
                                    style={{ width: '100%', height: '100%' }}
                                    source={{ uri: item }}
                                  />
                                </TouchableOpacity>
                              ),
                            photos  ===
                              profilePictureURL(<Text>Couverture</Text>))
                          }
                        />
                                <TouchableOpacity
                                  key={'item' + index}
                                  style={styles.myphotosItemView}
                                  onPress={() =>
                                    onSelectDelPhoto(i * 6 + index)
                                  }>
                                  <FastImage
                                    style={{ width: '100%', height: '100%' }}
                                    source={{ uri: item }}
                                  />
                                  <Text
                                  style={styles.watermark}
                                  >STARK</Text>
                                </TouchableOpacity>
                                


const styles=StyleSheet.create(
{
    watermark:
    {
        alignself:"center",
        position:"absolute"
    }

    myphotosItemView:
    {
        justifycontent:"center",
        alignItems:"center"
    }
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM