v5.0.0
Changelog
Overview
<DropdownAlert />
has been refactored to a functional Typescript component. In doing so, there was opportunity to add props, change props and refocus to a single animation flow.
That single animation flow is to start off screen from the top then animate downward onto the screen. This resulted in a decision to remove the complexity behind and usage of the startDelta
and endDelta
props and where there was logic to keep it on screen.
Moreover, props were added that give more access and control over built-in components. In addition, the children
prop was added and this provides the ability to build your own alert (BYOA), for example, <DropdownAlert><Text>{'Alert'}</Text></DropdownAlert>
.
Lastly, prop name changes for the most part are to realign them with the associated type and component name. For example, wrapperStyle
renamed to animatedViewStyle
.
New
onDismissAutomatic
callback function added and invoked when alert is dismissed by timeout the time can customized withdismissInterval
prop orinterval
data property and defaults to 4000ms.onDismissPanResponder
callback function added and invoked when alert is dismissed by pan gesture.onDismissProgrammatic
callback function added and invoked when alert is dismissed bydismiss
function prop.onDismissCancel
callback function added and invoked when alert is cancelled typically when usingshowCancel
prop.onDismissPress
callback function added and invoked when alert is dismissed by tapping on alert view.panResponderDismissDistance
number added and is the distance on the y-axis the alert needs to travel to be dismissed.animatedViewProps
ViewProps added and allows control over props forAnimated.View
parent component.alertTouchableOpacityProps
TouchableOpacityProps added and allows control over props forTouchableOpacity
child component.safeViewProps
ViewProps added and allows control over props forSafeView
child component toTouchableOpacity
.textViewProps
ViewProps added and allows control over props forView
component that holds title and message text components.imageProps
ImageProps added and allows control over props for theImage
left side child component toTouchableOpacity
.cancelTouchableOpacityProps
TouchableOpacityProps added and allows control over props for the cancel TouchableOpacity component.cancelImageProps
ImageProps added and allows control over props for the cancel Image component.children
ReactNode
added and if provided are rendered inside theAnimated.View
instead of the built-in components.springAnimationConfig
added and used inAnimated.spring()
.DropdownAlertType
enum added.DropdownAlertDismissAction
enum added.DropdownAlertColor
enum added.DropdownAlertData
object type added.DropdownAlertToValue
enum added.DropdownAlertImage
enum added.DropdownAlertTestID
object added.
Changes
isOpen
state variable removed. This results in the alert always rendered. It's visibility is based ontop
position of theAnimated.View
parent component.- Removed dependency
prop-types
. imageSrc
,infoImageSrc
,warnImageSrc
,errorImageSrc
,successImageSrc
propType changed toImageSourcePropType
.infoColor
,warnColor
,errorColor
,successColor
,activeStatusBarBackgroundColor
,inactiveStatusBarBackgroundColor
propType changed toColorValue
.imageStyle
propType changed toImageStyle
.
Breaking changes
dropDownAlertRef.alertWithType(...)
replaced byalert(data?: DropdownAlertData)
promise function prop.payload
removed andsource
is part of data.dropDownAlertRef.closeAction()
replaced bydismiss()
function prop.closeInterval
renamed todismissInterval
.startDelta
andendDelta
removed.wrapperStyle
renamed toanimatedViewStyle
and propType changed toViewStyle
.containerStyle
renamed toalertViewStyle
and propType changed toViewStyle
.contentContainerStyle
renamed tosafeViewStyle
and propType changed toViewStyle
.titleStyle
renamed totitleTextStyle
and propType changed toTextStyle
.messageStyle
renamed tomessageTextStyle
and propType changed toTextStyle
.cancelBtnImageStyle
renamed tocancelImageStyle
and propType changed toImageStyle
.titleNumOfLines
renamed totitleNumberOfLines
.messageNumOfLines
renamed tomessageNumberOfLines
.onClose
replaced by callback functions based on action taken. See:onDismissAutomatic
,onDismissCancel
,onDismissPress
,onDismissPanResponder
oronDismissProgrammatic
.onCancel
renamed toonDismissCancel
.tapToCloseEnabled
renamed toonDismissPressDisabled
to matchTouchableOpacity
disabled prop and default changed tofalse
.useNativeDriver
andisInteraction
moved intospringAnimationConfig
object and defaults changed to false.activeStatusBarStyle
andinactiveStatusBarStyle
propTypes changed toStatusBarStyle
.sensitivity
renamed topanResponderMoveDistance
. It serves as the distance gesture needs to travel before alert should move.testID
,accessibleLabel
andaccessible
removed. Use new prop objects to set these attributes on the specific components.onTap
renamed toonDismissPress
.defaultContainer
removed.defaultTextContainer
renamed totextViewStyle
and propType changed toViewStyle
.cancelBtnImageSrc
renamed tocancelImageSrc
and propType changed toImageSourcePropType
.