Can't pass value as function in React Navite Element Button

Can't pass value as function in React Navite Element Button

I want to display model with the key value from array, but I can't do it, and I don't understand the problem.

I want to display model with the key value from array, but I can't do it, and I don't understand the problem.

this is react native in Expo and I have used react native elements

import React, {Component} from "react";
import { ScrollView, Text, Linking, View, Modal } from "react-native";
import { Card, Button } from "react-native-elements";
import PriceDetail from "./PriceDetail";

const images = [ { key: 1, name: "Nathan Anderson", image: require("../images/1.jpg"), url: "" }, { key: 2, name: "Jamison McAndie", image: require("../images/2.jpg"), url: "" }, { key: 3, name: "Alberto Restifo", image: require("../images/3.jpg"), url: "" }, { key: 4, name: "John Towner", image: require("../images/4.jpg"), url: "" } ];

class Home extends Component {

state = { selectedItem : null, mvisible : false }

modalClosedHandler = () => { this.setState({ mvisible: false, selectedItem: null }); };

productSelectedHandler = key => { this.setState(prevState => { return { selectedItem: prevState.images.find(image => { return image.key === key; }) }; }); console.log(selectedItem); };

showModal = (key) => { this.setState({ mvisible: true, selectedItem: key }); }

render () { return ( <View style={{ flex: 1 }}> <Modal visible={this.state.mvisible} onRequestClose={this.modalClosedHandler}> <View style={{flex : 1, alignItems: 'center', justifyContent: 'center'}}> <Text>Hello this is modal{this.state.selectedItem}</Text> <Button title="Close" onPress={this.modalClosedHandler}/> </View> </Modal> <ScrollView contentContainerStyle={{ paddingVertical: 20 }}> {{ name, image, url, key }) => ( <Card title={Product ${key}} image={image} key={key}> <Text style={{ marginBottom: 10 }}> Photo by {name}. </Text> <Button backgroundColor="#03A9F4" title="VIEW NOW" onPress={(key)=>this.showModal(key)} /> </Card> ))} </ScrollView> </View> );
} }

export default Home;


What's new in Bootstrap 5 and when Bootstrap 5 release date?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Random Password Generator Online

HTML Color Picker online | HEX Color Picker | RGB Color Picker

Hire Dedicated React Native Developer

Have you ever thought of having your own app that runs smoothly over multiple platforms? React Native is an open-source cross-platform mobile application framework which is a great option to create mobile apps for both Android and iOS. **[Hire...

Build a simple React Native Pokemon app with React-Navigation

As we start learning new technologies we want to start building something or work on a simple project to get a better understanding of the technology.

Hire Dedicated React Native Developer in India | React Native Development

Hire dedicated React Native developers for your next project. As the top react native development company we offer you the best service as per your business needs.

Top React Native Mobile App Development Companies in USA

Looking for top React Native mobile app development company in USA for Startups & Enterprise? Find out the top list of React Native mobile app development company in USA.

Which Kind of Apps Are Most Suitable for React Native? -

React Native is beneficial to develop custom mobile apps and in addition to that the cross-platform app development framework is best suited for the apps of various types.