Releases: testshallpass/react-native-dropdownalert
v5.1.0
Changelog
Overview
Introducing the alertPosition
prop, it dictates where the alert animation flow begins. It accepts either top or bottom (default: top). To note, if set to bottom then update status bar does not happen and pan responder interaction is adjusted. #234
Breaking change
panResponderMoveDistance
prop removed in favor of settingonMoveShouldSetPanResponder
topanResponderEnabled
. This was based on: "Called for every touch move on the View when it is not the responder: does this view want to "claim" touch responsiveness?" for this case yes when enabled (Pan responder lifecycle).
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
.
4.5.1
Changelog
- Fix #272 - Revert
paddingHorizontal
topadding
fordefaultTextContainer
default prop. - Fix
render
functions' passed second argument in typescript definition. Thanks @AlexArendsen
4.5.0
I consolidated imageview
, TextView
and CancelButton
into the parent component.
Changelog
- Removed
padding
incontainerStyle
,imageStyle
andcancelBtnImageStyle
default prop. - Replaced
padding
withpaddingHorizontal
indefaultTextContainer
default prop. - Added
cancelBtnStyle
prop. - Renamed
constants.js
toUtils.js
.
See more props: here
4.4.0
4.3.0
Changelog
BREAKING CHANGES
- Removed
replaceEnabled
in favor of alert queue. - Removed
useAnimationLock
because it would block alerts from opening during another alert's animation.
FEATURES
- Introducing: alert queue. This provides ability to invoke
alertWithType
multiple times to enqueue a series of alerts. They are presented in FIFO (first in, first out) order and display until the queue is empty. Example:
_createAlertQueue = () => {
const types = ['info', 'warn', 'error', 'success', 'custom'];
const message = 'message';
let count = 1;
// queuing a series of alerts
types.map(type => {
this.dropDownAlertRef.alertWithType(
type,
`Alert ${count} of ${types.length}`,
message,
);
count++;
});
};
// get queue size programmatically:
_getQueueSize = () => {
const queueSize = this.dropDownAlertRef.getQueueSize();
console.log(`current queue size is ${queueSize}`);
};
// clear queue programmatically:
_clearQueue = () => {
this.dropDownAlertRef.clearQueue();
};
FIXES
- StatusBar not updating itself after close.
4.2.1
4.2.0
4.1.1
4.1.0
Changelog
FEATURES
- Added
onTap
callback function prop for whenDropdownAlert
has been tapped close. - Added the ability to pass a payload object with an image source property as parameter to
alertWithType
#161. Example:
//...
const payload = { source: 'https://facebook.github.io/react-native/docs/assets/favicon.png' };
this.dropDownAlertRef.alertWithType('info', 'title', 'message', payload);
// Keep in mind, the image source property overrides any provided image source props.
//...