Reactjs 禁用带有react Native中条件的按钮
我在我的应用程序中有一个带有onPress功能的按钮,如果日期已过,我会尝试将其设置为禁用,但我不知道该怎么做。 我正在使用相同的条件设置另一个不透明度及其工作状态Reactjs 禁用带有react Native中条件的按钮,reactjs,react-native,Reactjs,React Native,我在我的应用程序中有一个带有onPress功能的按钮,如果日期已过,我会尝试将其设置为禁用,但我不知道该怎么做。 我正在使用相同的条件设置另一个不透明度及其工作状态 renderItem={({ item }) => ( <Meetup data={item} refreshing={refreshing} past={parseISO(item.date)
renderItem={({ item }) => (
<Meetup
data={item}
refreshing={refreshing}
past={parseISO(item.date) < new Date()} <-- **its working**
>
<Banner source={{ uri: item.picture.url }} />
<Description>
<Title>{item.title}</Title>
<About>
{format(parseISO(item.date), "d 'de' MMMM', ás 'H'h'", {
locale: pt,
})}
</About>
<About>{item.location}</About>
<About>{`Organizador: ${item.User.name}`}</About>
</Description>
<SubscriptionButton
onPress={() => handleSubscription(item.id)}
disabled={parseISO(item.date) < new Date()} <--- **not working.**
>
Realizar inscrição
</SubscriptionButton>
</Meetup>
renderItem={({item})=>(
尝试使用newdate
而不是parseISO
:
past={new Date(item.date) < new Date()}
pass={new Date(item.Date)
在过去的道具中它可以工作,但在button中,handleSubscription功能仍在工作,我想禁用它::/DoesSubscriptionButton
甚至接受disabled
prop?这是完美的破解:∆