Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can we access specific item by clicking on it #22

Closed
ZakaMohyudDin opened this issue Mar 14, 2024 · 2 comments
Closed

How can we access specific item by clicking on it #22

ZakaMohyudDin opened this issue Mar 14, 2024 · 2 comments

Comments

@ZakaMohyudDin
Copy link

I want to show detail of specific item in modal when I click on specific item but onPress event of item is not working

@dorkyboi
Copy link
Owner

If you want your cards to be pressable, you should create them as such.
A modified example component from readme file would look like this:

export default function YourComponent({style, item, dayIndex, daysTotal}) {
    const onPress = () => {
        // do something with `item` given from props
    };

    return (
        <TouchableOpacity 
            style={{
                ...style, // apply calculated styles, be careful not to override these accidentally (unless you know what you are doing)
                backgroundColor: 'red',
                borderRadius: 10,
                elevation: 5,
            }}
            onPress={onPress}
        >
            <Text>{item.title}</Text>
            <Text>{dayIndex} of {daysTotal}</Text>
        </View>
    );
}

@ZakaMohyudDin
Copy link
Author

Thanks @dorkyboi .

It works for me when I set zIndex: 1 on the item container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants