Releases: testshallpass/react-native-dropdownalert
v5.2.0
The project was updated to support react-native 0.79.2 as a result the following prop types were updated to include React:
renderImage?: (data: DropdownAlertData) => React.JSX.Element;
renderCancel?: (data: DropdownAlertData, onCancel: () => void) => React.JSX.Element;
renderTitle?: (data: DropdownAlertData) => React.JSX.Element;
renderMessage?: (data: DropdownAlertData) => React.JSX.Element;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
panResponderMoveDistanceprop removed in favor of settingonMoveShouldSetPanRespondertopanResponderEnabled. 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
onDismissAutomaticcallback function added and invoked when alert is dismissed by timeout the time can customized withdismissIntervalprop orintervaldata property and defaults to 4000ms.onDismissPanRespondercallback function added and invoked when alert is dismissed by pan gesture.onDismissProgrammaticcallback function added and invoked when alert is dismissed bydismissfunction prop.onDismissCancelcallback function added and invoked when alert is cancelled typically when usingshowCancelprop.onDismissPresscallback function added and invoked when alert is dismissed by tapping on alert view.panResponderDismissDistancenumber added and is the distance on the y-axis the alert needs to travel to be dismissed.animatedViewPropsViewProps added and allows control over props forAnimated.Viewparent component.alertTouchableOpacityPropsTouchableOpacityProps added and allows control over props forTouchableOpacitychild component.safeViewPropsViewProps added and allows control over props forSafeViewchild component toTouchableOpacity.textViewPropsViewProps added and allows control over props forViewcomponent that holds title and message text components.imagePropsImageProps added and allows control over props for theImageleft side child component toTouchableOpacity.cancelTouchableOpacityPropsTouchableOpacityProps added and allows control over props for the cancel TouchableOpacity component.cancelImagePropsImageProps added and allows control over props for the cancel Image component.childrenReactNodeadded and if provided are rendered inside theAnimated.Viewinstead of the built-in components.springAnimationConfigadded and used inAnimated.spring().DropdownAlertTypeenum added.DropdownAlertDismissActionenum added.DropdownAlertColorenum added.DropdownAlertDataobject type added.DropdownAlertToValueenum added.DropdownAlertImageenum added.DropdownAlertTestIDobject added.
Changes
isOpenstate variable removed. This results in the alert always rendered. It's visibility is based ontopposition of theAnimated.Viewparent component.- Removed dependency
prop-types. imageSrc,infoImageSrc,warnImageSrc,errorImageSrc,successImageSrcpropType changed toImageSourcePropType.infoColor,warnColor,errorColor,successColor,activeStatusBarBackgroundColor,inactiveStatusBarBackgroundColorpropType changed toColorValue.imageStylepropType changed toImageStyle.
Breaking changes
dropDownAlertRef.alertWithType(...)replaced byalert(data?: DropdownAlertData)promise function prop.payloadremoved andsourceis part of data.dropDownAlertRef.closeAction()replaced bydismiss()function prop.closeIntervalrenamed todismissInterval.startDeltaandendDeltaremoved.wrapperStylerenamed toanimatedViewStyleand propType changed toViewStyle.containerStylerenamed toalertViewStyleand propType changed toViewStyle.contentContainerStylerenamed tosafeViewStyleand propType changed toViewStyle.titleStylerenamed totitleTextStyleand propType changed toTextStyle.messageStylerenamed tomessageTextStyleand propType changed toTextStyle.cancelBtnImageStylerenamed tocancelImageStyleand propType changed toImageStyle.titleNumOfLinesrenamed totitleNumberOfLines.messageNumOfLinesrenamed tomessageNumberOfLines.onClosereplaced by callback functions based on action taken. See:onDismissAutomatic,onDismissCancel,onDismissPress,onDismissPanResponderoronDismissProgrammatic.onCancelrenamed toonDismissCancel.tapToCloseEnabledrenamed toonDismissPressDisabledto matchTouchableOpacitydisabled prop and default changed tofalse.useNativeDriverandisInteractionmoved intospringAnimationConfigobject and defaults changed to false.activeStatusBarStyleandinactiveStatusBarStylepropTypes changed toStatusBarStyle.sensitivityrenamed topanResponderMoveDistance. It serves as the distance gesture needs to travel before alert should move.testID,accessibleLabelandaccessibleremoved. Use new prop objects to set these attributes on the specific components.onTaprenamed toonDismissPress.defaultContainerremoved.defaultTextContainerrenamed totextViewStyleand propType changed toViewStyle.cancelBtnImageSrcrenamed tocancelImageSrcand propType changed toImageSourcePropType.
4.5.1
Changelog
- Fix #272 - Revert
paddingHorizontaltopaddingfordefaultTextContainerdefault prop. - Fix
renderfunctions' passed second argument in typescript definition. Thanks @AlexArendsen
4.5.0
I consolidated imageview, TextView and CancelButton into the parent component.
Changelog
- Removed
paddingincontainerStyle,imageStyleandcancelBtnImageStyledefault prop. - Replaced
paddingwithpaddingHorizontalindefaultTextContainerdefault prop. - Added
cancelBtnStyleprop. - Renamed
constants.jstoUtils.js.
See more props: here
4.4.0
4.3.0
Changelog
BREAKING CHANGES
- Removed
replaceEnabledin favor of alert queue. - Removed
useAnimationLockbecause it would block alerts from opening during another alert's animation.
FEATURES
- Introducing: alert queue. This provides ability to invoke
alertWithTypemultiple 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.