react-native-popup-confirm-toast
Advanced tools
Comparing version
{ | ||
"name": "react-native-popup-confirm-toast", | ||
"version": "2.3.5", | ||
"version": "2.3.6", | ||
"description": "", | ||
@@ -46,3 +46,6 @@ "main": "index.js", | ||
"metro-react-native-babel-preset": "^0.65.2" | ||
}, | ||
"dependencies": { | ||
"react-native-popup-confirm-toast": "github:sekizlipenguen/react-native-popup-confirm-toast#c497b38c9070a5cd14f6ca8983c0aa271ed6a9bb" | ||
} | ||
} |
@@ -12,4 +12,3 @@ # react-native-popup-confirm-toast | ||
- getStatusBarHeight | ||
- isIPhoneWithMonobrow | ||
- multiple toast notifications Shows multiple toast notifications by queuing them | ||
@@ -16,0 +15,0 @@ ## Example Bottom Sheet |
@@ -13,2 +13,3 @@ import React, {Component} from 'react'; | ||
static toastInstance; | ||
toastQueue = []; | ||
@@ -64,37 +65,43 @@ constructor(props) { | ||
start({...config}) { | ||
this.setState({ | ||
...this.defaultState, | ||
title: config.title || false, | ||
text: config.text || false, | ||
titleTextStyle: config.titleTextStyle || false, | ||
descTextStyle: config.descTextStyle || false, | ||
backgroundColor: config.backgroundColor ? config.backgroundColor : defaultBackgroundColor, | ||
timeColor: config.timeColor ? config.timeColor : defaultTimeColor, | ||
position: config.position ? config.position : defaultPosition, | ||
icon: config.icon || false, | ||
timing: config.timing || 5000, | ||
statusBarHidden: config.statusBarHidden || false, | ||
statusBarAndroidHidden: (typeof config.statusBarAndroidHidden === 'undefined' ? true : config.statusBarAndroidHidden), | ||
statusBarAppleHidden: config.statusBarAppleHidden || false, | ||
statusBarTranslucent: config.statusBarTranslucent || false, | ||
statusBarAnimation: (typeof config.statusBarAnimation !== 'undefined') ? config.statusBarAnimation : true, | ||
statusBarType: config.statusBarType || 'dark-content', | ||
onOpen: config.onOpen || false, | ||
onOpenComplete: config.onOpenComplete || false, | ||
onClose: config.onClose || false, | ||
onCloseComplete: config.onCloseComplete || false, | ||
type: config.type, | ||
start: true, | ||
starting: true, | ||
}, () => { | ||
if (typeof this.state.onOpen == 'function') { | ||
return this.state.onOpen(); | ||
} | ||
}); | ||
// Yeni toast mesajlarını kuyruğa ekleyin | ||
if (this.state.starting) { | ||
// Eğer zaten bir toast mesajı gösteriliyorsa, yeni mesajı kuyruğa ekleyin | ||
this.toastQueue.push(config); | ||
} else { | ||
// Toast mesajını gösterin | ||
this.setState({ | ||
...this.defaultState, | ||
title: config.title || false, | ||
text: config.text || false, | ||
titleTextStyle: config.titleTextStyle || false, | ||
descTextStyle: config.descTextStyle || false, | ||
backgroundColor: config.backgroundColor ? config.backgroundColor : defaultBackgroundColor, | ||
timeColor: config.timeColor ? config.timeColor : defaultTimeColor, | ||
position: config.position ? config.position : defaultPosition, | ||
icon: config.icon || false, | ||
timing: config.timing || 5000, | ||
statusBarHidden: config.statusBarHidden || false, | ||
statusBarAndroidHidden: typeof config.statusBarAndroidHidden === 'undefined' ? true : config.statusBarAndroidHidden, | ||
statusBarAppleHidden: config.statusBarAppleHidden || false, | ||
statusBarTranslucent: config.statusBarTranslucent || false, | ||
statusBarAnimation: typeof config.statusBarAnimation !== 'undefined' ? config.statusBarAnimation : true, | ||
statusBarType: config.statusBarType || 'dark-content', | ||
onOpen: config.onOpen || false, | ||
onOpenComplete: config.onOpenComplete || false, | ||
onClose: config.onClose || false, | ||
onCloseComplete: config.onCloseComplete || false, | ||
type: config.type, | ||
start: true, | ||
starting: true, | ||
}, () => { | ||
if (typeof this.state.onOpen === 'function') { | ||
this.state.onOpen(); | ||
} | ||
this.runStart(); | ||
}); | ||
} | ||
} | ||
runStart() { | ||
let {minHeight, position, startDuration} = this.state; | ||
const {minHeight, position, startDuration} = this.state; | ||
let toValue; | ||
@@ -117,3 +124,3 @@ if (position === 'top') { | ||
}).start(() => { | ||
if (typeof this.state.onOpenComplete == 'function') { | ||
if (typeof this.state.onOpenComplete === 'function') { | ||
this.state.onOpenComplete(); | ||
@@ -128,3 +135,5 @@ } | ||
runTiming() { | ||
const {timing, time} = this.state; | ||
const {timing} = this.state; | ||
// Yeni toast için zaman değerini sıfırlayın | ||
this.state.time.setValue(0); | ||
Animated.timing(this.state.time, { | ||
@@ -139,3 +148,3 @@ toValue: -this.width, | ||
hideToast() { | ||
if (typeof this.state.onClose == 'function') { | ||
if (typeof this.state.onClose === 'function') { | ||
this.state.onClose(); | ||
@@ -169,5 +178,10 @@ } | ||
}, () => { | ||
if (onCloseComplete && typeof onCloseComplete == 'function') { | ||
return onCloseComplete(); | ||
if (onCloseComplete && typeof onCloseComplete === 'function') { | ||
onCloseComplete(); | ||
} | ||
// Gizlendikten sonra kuyrukta bekleyen mesajları kontrol edin | ||
if (this.toastQueue.length > 0) { | ||
const nextToast = this.toastQueue.shift(); | ||
this.start(nextToast); | ||
} | ||
}); | ||
@@ -347,1 +361,2 @@ }); | ||
export default Toast; | ||
GitHub dependency
Supply chain riskContains a dependency which resolves to a GitHub URL. Dependencies fetched from GitHub specifiers are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
9248129
0.01%32
3.23%1190
1.36%1
Infinity%353
-0.28%1
Infinity%