Skip to main content

Notify Prompt component

Effect demonstration

1. Message prompt

<Button 
title="info"
onPress={() => Notify.info({ content: 'You have received a rush sale message, please check it' })} />
notify-ios1.gif

2. With closing effect

<Button
title="close"
onPress={() =>
Notify.info({
content: 'You have received a rush purchase message, please check it carefully',
autoClose: false,
onClose: () => console.log(222),
})
}
/>
notify-ios2.gif

3. With click jump effect

<Button
title="press"
onPress={() =>
Notify.info({
content: 'You have received a rush purchase message, please check it carefully',
onPress: () => navigation.navigate('BoxDemo'),
autoClose: false,
})
}
/>
notify-ios3.gif

4. Success Tips

<Button title="success" onPress={() => Notify.success({ content: 'Purchase successful' })} />
notify-ios4.gif

5. Failure prompt

<Button title="fail" onPress={() => Notify.fail({ content: 'Sorry, the operation failed' })} />
notify-ios5.gif

API

PropertiesRequiredDescriptionTypeDefault Value
autoClosefalseWhether to automatically close the promptbooleantrue
durationfalsePrompt display duration (milliseconds)number3000
contentfalsePrompt box contentReactNode
activeOpacityfalseOpacity when pressednumber0.6
onClosefalseCallback after the prompt box is closed() => void
onPressfalseCallback after clicking the prompt box() => void

duration has two constant values:

  • Notify.SHORT=3000
  • Notify.LONG = 5000