react-native-carousel-control icon indicating copy to clipboard operation
react-native-carousel-control copied to clipboard

onPress() not working in dynamic carousel child

Open davidcort opened this issue 7 years ago • 2 comments

`<Carousel pageStyle={{ overflow: Platform.OS == 'android' ? 'hidden' : 'visible', height: 285, elevation: 8, shadowColor: '#666666', shadowRadius: 9, shadowOpacity: 0.2, shadowOffset: { width: 0, height: 3 }, borderBottomLeftRadius: 20, borderBottomRightRadius: 20 }} pageWidth={width - 80} swipeThreshold={0.1}> { dataMagazine.map((item, i) => ( <View key={i} style={{flex: 1, height: 'auto'}} onPress={()=> alert('clicked !!') }>

                        <Image 
                            style={{
                                    flex: 1, 
                                    resizeMode: 'stretch',
                                    backgroundColor: '#FFFFFF'
                                }}
                            source={{uri: `${uri}${item.imagen_principal}`}}
                            onPress={() => this.goToNote(item)}
                        />
                        <MagazineTextContainer>
                            <LabelCategory>
                                {item.desc_categoria.toUpperCase()}
                            </LabelCategory>
                            <MagazineText>{item.titulo}</MagazineText>
                        </MagazineTextContainer>
                    
                    </View>
                ))
            }
            </Carousel>`

davidcort avatar Jan 21 '19 19:01 davidcort

Im guessing you've moved on but onPress doesn't work with views.

rollsroyc3 avatar Jun 04 '20 13:06 rollsroyc3

@rollsroyc3 you are right. This needed a TouchableOpacity or HighlitOpacity

davidcort avatar Jun 04 '20 17:06 davidcort