setToastConfig

You can change some configs globally.

bgColor

You can change the default bgColors for each type of toast.

The default colors are:

  • #7890f0 Info: #7890f0

  • #35d0ba Success: #35d0ba

  • #ff9100 Warning: #ff9100

  • #d92027 Error: #d92027

An example changing the default success' bgColor to olive:

import { useToast } from 'react-native-rooster';
const { setToastConfig } = useToast();
setToastConfig({
bgColor: {
success: 'olive',
},
})

font

You can change the custom fontFamily for the texts.

optionrequireddefaultDescription
fontFamilyRegularNoReact-Native default fontChanges the regular font used within toasts
fontFamilyBoldNoReact-Native default fontChanges the bold font used within toasts

Note: You must have previously configured the desired custom font in your project.

An example changing fontFamilyBold to Montserrat family:

import { useToast } from 'react-native-rooster';
const { setToastConfig } = useToast();
setToastConfig({
font: {
fontFamilyBold: 'Montserrat-Bold',
},
})

timeToDismiss

You can change the default toast's time to dismiss.

optionrequireddefault (ms)
timeToDismissNo1500

To change this to 4000ms you can just do:

import { useToast } from 'react-native-rooster';
const { setToastConfig } = useToast();
setToastConfig({
timeToDismiss: 4000
})
Last updated on by Mateus Andrade