react-native-toast-message 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,12 @@ Headers are one of:
|
|
|
9
9
|
|
|
10
10
|
- `Added`, `Changed`, `Removed`, `Fixed` or `Breaking`.
|
|
11
11
|
|
|
12
|
+
## [2.0.2]
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- Fast swipe up re-creates the toast [#280](https://github.com/calintamas/react-native-toast-message/issues/280)
|
|
17
|
+
|
|
12
18
|
## [2.0.1]
|
|
13
19
|
|
|
14
20
|
### Fixed
|
|
@@ -11,6 +11,12 @@ export declare type AnimatedContainerProps = {
|
|
|
11
11
|
onHide: () => void;
|
|
12
12
|
onRestorePosition?: () => void;
|
|
13
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* Produces a positive damping value.
|
|
16
|
+
*
|
|
17
|
+
* To note: `moveY` becomes negative when going off-screen. By making sure the value
|
|
18
|
+
* produced is always positive, we avoid issues like: https://github.com/calintamas/react-native-toast-message/issues/280
|
|
19
|
+
*/
|
|
14
20
|
export declare function dampingFor(gesture: PanResponderGestureState, position: ToastPosition): number;
|
|
15
21
|
export declare function animatedValueFor(gesture: PanResponderGestureState, position: ToastPosition, damping: number): number;
|
|
16
22
|
export declare function AnimatedContainer({ children, isVisible, position, topOffset, bottomOffset, keyboardOffset, onHide, onRestorePosition }: AnimatedContainerProps): JSX.Element;
|
|
@@ -6,15 +6,21 @@ import { noop } from '../utils/func';
|
|
|
6
6
|
import { bound } from '../utils/number';
|
|
7
7
|
import { getTestId } from '../utils/test-id';
|
|
8
8
|
import { styles } from './AnimatedContainer.styles';
|
|
9
|
+
/**
|
|
10
|
+
* Produces a positive damping value.
|
|
11
|
+
*
|
|
12
|
+
* To note: `moveY` becomes negative when going off-screen. By making sure the value
|
|
13
|
+
* produced is always positive, we avoid issues like: https://github.com/calintamas/react-native-toast-message/issues/280
|
|
14
|
+
*/
|
|
9
15
|
export function dampingFor(gesture, position) {
|
|
10
16
|
const { moveY } = gesture;
|
|
11
17
|
switch (position) {
|
|
12
18
|
case 'bottom': {
|
|
13
19
|
const { height: screenHeight } = Dimensions.get('screen');
|
|
14
|
-
return screenHeight - moveY;
|
|
20
|
+
return Math.abs(screenHeight - moveY);
|
|
15
21
|
}
|
|
16
22
|
case 'top':
|
|
17
|
-
return moveY;
|
|
23
|
+
return Math.abs(moveY);
|
|
18
24
|
default:
|
|
19
25
|
throw new Error(`Toast position: ${position} not implemented`);
|
|
20
26
|
}
|