import { Text, View, Image, Pressable } from 'react-native'; import { gStyle } from…
- User
import { Text, View, Image, Pressable } from 'react-native'; import { gStyle } from '../styles/style'; import React from 'react';
export default function Result({ item }) {
return ( <View style={[gStyle.bookedMK, {flex:1}]}> <View style={{ flexDirection: 'column' }}> {item.name} {item.description.length > 100 ? item.description.substring(0, 100)+'...' : item.description } Читать далее
); }
i need to show details of PastMK or FutureMK, so how to do that?
- Assistant
You can pass a prop to the
Resultcomponent to indicate whether it is a past or future event. Then, you can conditionally render the details based on the value of the prop.For example, you can create a prop called
typeand pass it to theResultcomponent when you use it in your code:code<Result item={item} type="past" />Then, in the
Resultcomponent, you can use anifstatement to check the value of thetypeprop and render the appropriate details:code