All notable changes to this project will be documented in this file. The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
Headers are one of:
Added
,Changed
,Removed
,Fixed
orBreaking
.
- chore(deps): bump ansi-regex from 4.1.0 to 4.1.1 by dependabot in #343
- chore(deps): bump minimist from 1.2.5 to 1.2.6 by dependabot in #338
-
After a Toast is shown within a Modal, the main instance outside of Modal doesn't work anymore (#293)
-
A previously set timer is not cleared when
autoHide
changes fromtrue
tofalse
. This can make a newly shown Toast auto hide (even if it was shown withautoHide: false
) (#294)Big thanks go to jstheoriginal for all the work on fixing the two issues above 🙌.
-
Flexbox not working for setting Toast width or alignment (3400f00)
BaseToastProps
style types allows passing an array of styles nowstyle={[styles.one, styles.two]}
(#243 was ported to v2)- Peer deps no longer require a min version (e91ed21)
- Fast swipe up re-creates the toast #280
ansi-regex
vulnerability by upgrading to@testing-library/jest-native v4.0.4
(#277)
-
Setting the
ref
is no longer required when rendering theToast
component in your app's entry point. Ref storage is now handled internally using React.createRef. This should improve ref access reliability at runtime.// App.jsx import Toast from 'react-native-toast-message'; export function App(props) { return ( <> {/* ... */} <Toast /> </> ); }
-
When you want to have the Toast visible inside a Modal, you no longer need to set a separate
ref
.Simply render the
Toast
component inside the Modal, as well as in your app's entry point. When the Modal is visible, theref
from inside the Modal will be automatically used. -
onHide
callback is now always called when the Toast hides (does not matter ifautoHide
wastrue
/false
). -
inProgress
state has been removed and can no longer be relied upon in a custom Toast config. -
style
andheight
props from the Toast component were removed; with the purpose of achieving a cleaner API design. The only way to change the style / layout of different Toast types is through theconfig
prop (fixes #204).
-
on the
BaseToast
component, the following props were added:touchableContainerProps
,contentContainerProps
,text1Props
,text2Props
,text1NumberOfLines
,text2NumberOfLines
(fixes #112, #133). -
on the
Toast
component, the following callbacks were added as props:onShow
,onHide
andonPress
(fixes #143). -
A new
ToastShowParams
type is exported (fixes #192).
topOffset
andbottomOffset
are now by default40px
- New test ids on
BaseToast
component:toastTouchableContainer
,toastContentContainer
,toastText1
andtoastText2
.
-
Success, error and info leading icons were removed from the package (to make it as lightweight as possible).
It's now possible to pass them via render functions (for more flexibility, see issues regarding svg support, using components as icons, etc) on
BaseToast
component, example below:const toastConfig = { success: (props) => ( <BaseToast {...props} renderLeadingIcon={() => <Image />} renderTrailingIcon={() => <Image />} /> ) }
-
Trailing close icon has been removed from default components
BaseToast
,SuccessToast
,ErrorToast
andInfoToast
. Fixes #167.
- Failed prop type: Invalid props.text2Style key fontSize supplied to BaseToast #174.
- Changing Font Family does not work #176
- Text1 not showing on Android #194
- Toast background is Transparent #219
- TypeError: Cannot read property 'show' of null #232
- textStyle1 styles not been applied #233
- Typescript-class component toast message in modal usage #172
- Getting last toast along with native prompt #149
- When modal request permission appear then the modal toast on the previous screen also appears -> android #226
- autoHide: false crashes on android #256
- Export all default Toast components (
BaseToast
,SuccessToast
,InfoToast
,ErrorToast
) to be able to reuse them with custom props (#225)
- Move
show
method options to separateToastShowOptions
interface (#242) - Use
StyleProp
in type definition file, to allow different types of style to be used (eg.style={[styles.one, styles.two]}
) (#243)
- Fix Keyboard pushing Toast too much on Android when displayed with position
bottom
(#161)
- Add types for
text1NumberOfLines
andtext2NumberOfLines
(#152)
- Fix proptype regression (#151)
- Fix type declaration file (#148)
- Remove dependency on ViewPropTypes (#147)
- Move eslint-plugin-prettier to dev dependencies (#135)
- Increase the threshold to register a swipe on the toast container (#144)
- Fix
onPress
handler for custom components
- Fix type declaration file
- Add
onPress
toToast.show
method - Export
BaseToast
component to allow styling - Add
topOffset
,bottomOffset
andvisibilityTime
as instance props - When shown with
position: bottom
, Toast is now Keyboard aware
- Add Typescript declaration file (#94)
- Allow style prop to style the base component (#93)
- Custom render props are now part of the initial state. This removes the need to use optional chaining when defining a custom toast
config
- Allow arbitrary data to be passed into Toasts (#81)
- In case of RTL the text will start from the right (#84)
- null is not an object (evaluating 'this._ref.show') (#90)
- Shadows not visible on Android (#51)
position: bottom
, damping value must be grater than 0 error (#48)
- Given texts
text1
andtext2
are rendered conditionally now (#40)
- Custom toast does not hide completely if its
height
is greater than the default 60
- Fix typescript import err
- Render custom toast types using a
config
prop - A default
info
type toast onShow
andonHide
callbacks when usingToast.show({ onShow, onHide })
autoHide
is nowtrue
by default
renderSuccessToast
andrenderErrorToast
props are no longer relevant, so they were removed
onHide
is called when the toast is dismissed by a swipe gesture
- Android status bar has bottom shadow
- Swipe to dismiss gesture