react-native-toast-message 2.1.4 → 2.2.0-beta.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.
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { ToastProps, ToastShowParams } from './types';
3
- export declare function Toast(props: ToastProps): JSX.Element;
3
+ export declare function Toast({ useNativeDriver, ...props }: ToastProps): JSX.Element;
4
4
  export declare namespace Toast {
5
5
  var show: (params: ToastShowParams) => void;
6
6
  var hide: (params?: void | undefined) => void;
package/lib/src/Toast.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { LoggerProvider } from './contexts';
2
+ import { EnvironmentProvider, LoggerProvider } from './contexts';
3
3
  import { ToastUI } from './ToastUI';
4
4
  import { useToast } from './useToast';
5
5
  const ToastRoot = React.forwardRef((props, ref) => {
@@ -33,7 +33,7 @@ function addNewRef(newRef) {
33
33
  function removeOldRef(oldRef) {
34
34
  refs = refs.filter((r) => r.current !== oldRef);
35
35
  }
36
- export function Toast(props) {
36
+ export function Toast({ useNativeDriver, ...props }) {
37
37
  const toastRef = React.useRef(null);
38
38
  /*
39
39
  This must use `useCallback` to ensure the ref doesn't get set to null and then a new ref every render.
@@ -53,7 +53,9 @@ export function Toast(props) {
53
53
  }
54
54
  }, []);
55
55
  return (<LoggerProvider enableLogs={false}>
56
- <ToastRoot ref={setRef} {...props}/>
56
+ <EnvironmentProvider useNativeDriver={useNativeDriver}>
57
+ <ToastRoot ref={setRef} {...props}/>
58
+ </EnvironmentProvider>
57
59
  </LoggerProvider>);
58
60
  }
59
61
  /**
@@ -17,7 +17,7 @@ function renderComponent({ data, options, config, isVisible, show, hide }) {
17
17
  };
18
18
  const ToastComponent = toastConfig[type];
19
19
  if (!ToastComponent) {
20
- throw new Error(`Toast type: '${type}' does not exist. You can add it via the 'config' prop on the Toast instance. Learn more: https://github.com/calintamas/react-native-toast-message/blob/master/README.md`);
20
+ throw new Error(`Toast type: '${type}' does not exist. You can add it via the 'config' prop on the Toast instance. Learn more: https://github.com/calintamas/react-native-toast-message/blob/HEAD/docs/custom-layouts.md`);
21
21
  }
22
22
  return ToastComponent({
23
23
  position,
@@ -40,7 +40,7 @@ export function animatedValueFor(gesture, position, damping) {
40
40
  export function AnimatedContainer({ children, isVisible, position, topOffset, bottomOffset, keyboardOffset, onHide, onRestorePosition = noop }) {
41
41
  const { log } = useLogger();
42
42
  const { computeViewDimensions, height } = useViewDimensions();
43
- const { animatedValue, animate, animationStyles } = useSlideAnimation({
43
+ const { animatedValue, animate, defaultStyles, animationStyles } = useSlideAnimation({
44
44
  position,
45
45
  height,
46
46
  topOffset,
@@ -72,7 +72,7 @@ export function AnimatedContainer({ children, isVisible, position, topOffset, bo
72
72
  const newAnimationValue = isVisible ? 1 : 0;
73
73
  animate(newAnimationValue);
74
74
  }, [animate, isVisible]);
75
- return (<Animated.View testID={getTestId('AnimatedContainer')} onLayout={computeViewDimensions} style={[styles.base, styles[position], animationStyles]}
75
+ return (<Animated.View testID={getTestId('AnimatedContainer')} onLayout={computeViewDimensions} style={[styles.base, styles[position], defaultStyles, animationStyles]}
76
76
  // This container View is never the target of touch events but its subviews can be.
77
77
  // By doing this, tapping buttons behind the Toast is allowed
78
78
  pointerEvents='box-none' {...panResponder.panHandlers}>
@@ -7,10 +7,10 @@ export function BaseToast({ text1, text2, onPress, activeOpacity, style, touchab
7
7
  return (<Touchable testID={getTestId('TouchableContainer')} onPress={onPress} activeOpacity={activeOpacity} style={[styles.base, styles.leadingBorder, style]} {...touchableContainerProps}>
8
8
  {renderLeadingIcon && renderLeadingIcon()}
9
9
  <View testID={getTestId('ContentContainer')} style={[styles.contentContainer, contentContainerStyle]} {...contentContainerProps}>
10
- {text1 && text1.length > 0 && (<Text testID={getTestId('Text1')} style={[styles.text1, text1Style]} numberOfLines={text1NumberOfLines} ellipsizeMode='tail' {...text1Props}>
10
+ {(text1?.length ?? 0) > 0 && (<Text testID={getTestId('Text1')} style={[styles.text1, text1Style]} numberOfLines={text1NumberOfLines} ellipsizeMode='tail' {...text1Props}>
11
11
  {text1}
12
12
  </Text>)}
13
- {text2 && text2?.length > 0 && (<Text testID={getTestId('Text2')} style={[styles.text2, text2Style]} numberOfLines={text2NumberOfLines} ellipsizeMode='tail' {...text2Props}>
13
+ {(text2?.length ?? 0) > 0 && (<Text testID={getTestId('Text2')} style={[styles.text2, text2Style]} numberOfLines={text2NumberOfLines} ellipsizeMode='tail' {...text2Props}>
14
14
  {text2}
15
15
  </Text>)}
16
16
  </View>
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { ToastProps } from '~/types';
3
+ export declare type EnvironmentContextType = {
4
+ useNativeDriver?: ToastProps['useNativeDriver'];
5
+ };
6
+ declare const EnvironmentProvider: React.FC<EnvironmentContextType>;
7
+ declare function useEnvironmentContext(): EnvironmentContextType;
8
+ export { EnvironmentProvider, useEnvironmentContext };
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { Platform } from 'react-native';
3
+ const EnvironmentContext = React.createContext(null);
4
+ const EnvironmentProvider = ({ children, useNativeDriver = Platform.select({
5
+ default: true,
6
+ web: false
7
+ }) }) => {
8
+ const value = {
9
+ useNativeDriver
10
+ };
11
+ return (<EnvironmentContext.Provider value={value}>
12
+ {children}
13
+ </EnvironmentContext.Provider>);
14
+ };
15
+ function useEnvironmentContext() {
16
+ const ctx = React.useContext(EnvironmentContext);
17
+ if (!ctx) {
18
+ throw new Error(`useEnvironment() must be called within EnvironmentProvider context`);
19
+ }
20
+ return ctx;
21
+ }
22
+ export { EnvironmentProvider, useEnvironmentContext };
@@ -1 +1,4 @@
1
- export * from './LoggerContext';
1
+ export { LoggerProvider, useLogger } from './LoggerContext';
2
+ export type { LoggerContextType } from './LoggerContext';
3
+ export { EnvironmentProvider, useEnvironmentContext } from './EnvironmentContext';
4
+ export type { EnvironmentContextType } from './EnvironmentContext';
@@ -1 +1,2 @@
1
- export * from './LoggerContext';
1
+ export { LoggerProvider, useLogger } from './LoggerContext';
2
+ export { EnvironmentProvider, useEnvironmentContext } from './EnvironmentContext';
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Animated } from 'react-native';
3
3
  import { ToastPosition } from '../types';
4
- declare type UseSlideAnimationParams = {
4
+ export declare type UseSlideAnimationParams = {
5
5
  position: ToastPosition;
6
6
  height: number;
7
7
  topOffset: number;
@@ -14,6 +14,11 @@ export declare function translateYOutputRangeFor({ position, height, topOffset,
14
14
  export declare function useSlideAnimation({ position, height, topOffset, bottomOffset, keyboardOffset }: UseSlideAnimationParams): {
15
15
  animatedValue: React.MutableRefObject<Animated.Value>;
16
16
  animate: (toValue: number) => void;
17
+ defaultStyles: {
18
+ transform: {
19
+ translateY: number;
20
+ }[];
21
+ };
17
22
  animationStyles: {
18
23
  opacity: Animated.AnimatedInterpolation;
19
24
  transform: {
@@ -21,4 +26,3 @@ export declare function useSlideAnimation({ position, height, topOffset, bottomO
21
26
  }[];
22
27
  };
23
28
  };
24
- export {};
@@ -1,25 +1,42 @@
1
1
  import React from 'react';
2
- import { Animated, Platform } from 'react-native';
3
- import { additiveInverseArray } from '../utils/array';
2
+ import { Animated } from 'react-native';
3
+ import { useEnvironmentContext } from '../contexts';
4
4
  import { useKeyboard } from './useKeyboard';
5
+ const startPointFor = (position, height) => {
6
+ const value = height * 2;
7
+ if (position === 'top') {
8
+ return -value;
9
+ }
10
+ return value;
11
+ };
5
12
  export function translateYOutputRangeFor({ position, height, topOffset, bottomOffset, keyboardHeight, keyboardOffset }) {
6
- const offset = position === 'bottom' ? bottomOffset : topOffset;
7
- const keyboardAwareOffset = position === 'bottom' ? keyboardHeight + keyboardOffset : 0;
8
- const range = [-(height * 2), Math.max(offset, keyboardAwareOffset)];
9
- const outputRange = position === 'bottom' ? additiveInverseArray(range) : range;
10
- return outputRange;
13
+ const startPoint = startPointFor(position, height);
14
+ switch (position) {
15
+ case 'bottom': {
16
+ const keyboardAwareOffset = keyboardHeight + keyboardOffset;
17
+ const range = [startPoint, -Math.max(bottomOffset, keyboardAwareOffset)];
18
+ return range;
19
+ }
20
+ case 'top': {
21
+ const keyboardAwareOffset = 0;
22
+ const range = [startPoint, Math.max(topOffset, keyboardAwareOffset)];
23
+ return range;
24
+ }
25
+ default:
26
+ throw new Error(`Position '${position}' not supported`);
27
+ }
11
28
  }
12
- const useNativeDriver = Platform.select({ native: true, default: false });
13
29
  export function useSlideAnimation({ position, height, topOffset, bottomOffset, keyboardOffset }) {
30
+ const { useNativeDriver } = useEnvironmentContext();
14
31
  const animatedValue = React.useRef(new Animated.Value(0));
15
32
  const { keyboardHeight } = useKeyboard();
16
33
  const animate = React.useCallback((toValue) => {
17
34
  Animated.spring(animatedValue.current, {
18
35
  toValue,
19
- useNativeDriver,
36
+ useNativeDriver: !!useNativeDriver,
20
37
  friction: 8
21
38
  }).start();
22
- }, []);
39
+ }, [useNativeDriver]);
23
40
  const translateY = React.useMemo(() => animatedValue.current.interpolate({
24
41
  inputRange: [0, 1],
25
42
  outputRange: translateYOutputRangeFor({
@@ -35,9 +52,17 @@ export function useSlideAnimation({ position, height, topOffset, bottomOffset, k
35
52
  inputRange: [0, 0.7, 1],
36
53
  outputRange: [0, 1, 1]
37
54
  });
55
+ const defaultStyles = {
56
+ transform: [
57
+ {
58
+ translateY: startPointFor(position, height)
59
+ }
60
+ ]
61
+ };
38
62
  return {
39
63
  animatedValue,
40
64
  animate,
65
+ defaultStyles,
41
66
  animationStyles: {
42
67
  opacity,
43
68
  transform: [
@@ -154,6 +154,15 @@ export declare type ToastProps = {
154
154
  * Default value: `10`
155
155
  */
156
156
  keyboardOffset?: number;
157
+ /**
158
+ * Enable / disable native driver for the slide animation.
159
+ *
160
+ * Default:
161
+ * - `true` on iOS
162
+ * - `false` on Android (fixes [issue #300](https://github.com/calintamas/react-native-toast-message/issues/300))
163
+ * - `false` on Web (fixes [issue #311](https://github.com/calintamas/react-native-toast-message/issues/311))
164
+ */
165
+ useNativeDriver?: boolean;
157
166
  /**
158
167
  * Called when any Toast is shown
159
168
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-toast-message",
3
- "version": "2.1.4",
3
+ "version": "2.2.0-beta.2",
4
4
  "description": "Toast message component for React Native",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -22,27 +22,32 @@
22
22
  "lint": "./node_modules/.bin/eslint --fix",
23
23
  "lint-staged": "./node_modules/.bin/lint-staged",
24
24
  "test": "./node_modules/.bin/jest",
25
- "yalc:push": "yarn build && yalc publish --push",
26
- "quality": "yarn lint && tsc --noEmit"
25
+ "quality": "yarn lint && tsc --noEmit",
26
+ "yalc:watch": "rm -rf ./lib && tsc-watch --onCompilationComplete \"yalc publish --push\""
27
27
  },
28
28
  "author": "Calin Tamas <calintamas2@gmail.com>",
29
29
  "license": "MIT",
30
30
  "devDependencies": {
31
31
  "@babel/core": "^7.15.8",
32
32
  "@testing-library/jest-native": "^4.0.4",
33
- "@testing-library/react-hooks": "^7.0.2",
33
+ "@testing-library/react-hooks": "^8.0.0",
34
34
  "@testing-library/react-native": "^9.0.0",
35
35
  "@types/jest": "^27.0.1",
36
- "@types/react-native": "^0.67.3",
36
+ "@types/react-native": "^0.67.7",
37
+ "@types/react-test-renderer": "^18.0.0",
38
+ "babel-plugin-module-resolver": "^4.1.0",
37
39
  "eslint-config-backpacker-react-ts": "^0.3.0",
38
- "husky": "^7.0.2",
39
- "import-sort-style-module": "^6.0.0",
40
+ "husky": "^8.0.1",
41
+ "import-sort-style-module-alias": "^1.1.0",
40
42
  "jest": "^27.1.1",
41
- "lint-staged": "^12.1.2",
42
- "metro-react-native-babel-preset": "^0.69.0",
43
+ "lint-staged": "^13.0.0",
44
+ "metro-react-native-babel-preset": "^0.71.0",
43
45
  "prettier": "^2.4.1",
44
46
  "prettier-plugin-import-sort": "^0.0.7",
47
+ "react": "17.0.2",
48
+ "react-native": "0.68.2",
45
49
  "react-test-renderer": "^17.0.2",
50
+ "tsc-watch": "^5.0.3",
46
51
  "typescript": "^4.4.3",
47
52
  "yalc": "^1.0.0-pre.53"
48
53
  },
@@ -52,8 +57,13 @@
52
57
  },
53
58
  "importSort": {
54
59
  ".js, .jsx, .ts, .tsx": {
55
- "style": "module",
56
- "parser": "typescript"
60
+ "style": "module-alias",
61
+ "parser": "typescript",
62
+ "options": {
63
+ "alias": [
64
+ "~"
65
+ ]
66
+ }
57
67
  }
58
68
  },
59
69
  "lint-staged": {
package/CHANGELOG.md DELETED
@@ -1,305 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
4
- and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
5
-
6
- ⚠️ The changelog should be **human-readable**, so everything that's added here should be easy to understand without additional lookups and checks
7
-
8
- Headers are one of:
9
-
10
- - `Added`, `Changed`, `Removed`, `Fixed` or `Breaking`.
11
-
12
- ## [2.1.4]
13
-
14
- ### Fixed
15
-
16
- - fix: delay after keyboard is dismissed by [rcb4t2](https://github.com/rcb4t2) in [#342](https://github.com/calintamas/react-native-toast-message/pull/342)
17
-
18
- ## [2.1.3]
19
-
20
- ### Fixed
21
-
22
- - chore(deps): bump minimist from 1.2.5 to 1.2.6 by [dependabot](https://github.com/dependabot) in [#338](https://github.com/calintamas/react-native-toast-message/pull/338)
23
-
24
- ## [2.1.2]
25
-
26
- ### Fixed
27
-
28
- - Fixes `useNativeDriver` warning on web by [jpaas](https://github.com/jpaas) in [#334](https://github.com/calintamas/react-native-toast-message/pull/334)
29
-
30
- ## [2.1.1]
31
-
32
- ### Fixed
33
-
34
- - Tapping a View / Button behind the Toast is not possible ([b9d191e](https://github.com/calintamas/react-native-toast-message/commit/b9d191e1dcc4d331fd5159ca9aabd54d7d0ecb97)) (fixes [#282](https://github.com/calintamas/react-native-toast-message/issues/282))
35
-
36
- ## [2.1.0]
37
-
38
- ### Fixed
39
-
40
- - After a Toast is shown within a Modal, the main instance outside of Modal doesn't work anymore ([#293](https://github.com/calintamas/react-native-toast-message/pull/293))
41
- - A previously set timer is not cleared when `autoHide` changes from `true` to `false`. This can make a newly shown Toast auto hide (even if it was shown with `autoHide: false`) ([#294](https://github.com/calintamas/react-native-toast-message/pull/294))
42
-
43
- Big thanks go to [jstheoriginal](https://github.com/jstheoriginal) for all the work on fixing the two issues above 🙌.
44
-
45
- - Flexbox not working for setting Toast width or alignment ([3400f00](https://github.com/calintamas/react-native-toast-message/commit/3400f0074116f5acb37ca2eb696ea50b0c669ddc))
46
-
47
- ### Changed
48
-
49
- - `BaseToastProps` style types allows passing an array of styles now `style={[styles.one, styles.two]}` ([#243](https://github.com/calintamas/react-native-toast-message/pull/243) was ported to v2)
50
- - Peer deps no longer require a min version ([e91ed21](https://github.com/calintamas/react-native-toast-message/commit/e91ed21d277d7348b674834765147be752b6abfb))
51
-
52
- ## [2.0.2]
53
-
54
- ### Fixed
55
-
56
- - Fast swipe up re-creates the toast [#280](https://github.com/calintamas/react-native-toast-message/issues/280)
57
-
58
- ## [2.0.1]
59
-
60
- ### Fixed
61
-
62
- - `ansi-regex` vulnerability by upgrading to `@testing-library/jest-native v4.0.4` ([#277](https://github.com/calintamas/react-native-toast-message/pull/277))
63
-
64
- ## [2.0.0]
65
-
66
- ### Breaking
67
-
68
- - Setting the `ref` is no longer required when rendering the `Toast` component in your app's entry point. Ref storage is now handled internally using [React.createRef](https://reactjs.org/docs/react-api.html#reactcreateref). This should improve ref access reliability at runtime.
69
-
70
- ```js
71
- // App.jsx
72
- import Toast from 'react-native-toast-message';
73
-
74
- export function App(props) {
75
- return (
76
- <>
77
- {/* ... */}
78
- <Toast />
79
- </>
80
- );
81
- }
82
- ```
83
-
84
- - When you want to have the Toast visible inside a Modal, you no longer need to set a separate `ref`.
85
-
86
- Simply render the `Toast` component inside the Modal, as well as in your app's entry point. When the Modal is visible, the `ref` from inside the Modal will be automatically used.
87
-
88
- - `onHide` callback is now always called when the Toast hides (does not matter if `autoHide` was `true` / `false`).
89
-
90
- - `inProgress` state has been removed and can no longer be relied upon in a custom Toast config.
91
-
92
- - `style` and `height` props from the Toast component were removed; with the purpose of achieving a cleaner API design. The only way to change the style / layout of different Toast types is through the `config` prop (fixes [#204](https://github.com/calintamas/react-native-toast-message/issues/204)).
93
-
94
- ### Added
95
-
96
- - on the `BaseToast` component, the following props were added: `touchableContainerProps`, `contentContainerProps`, `text1Props`, `text2Props` , `text1NumberOfLines`, `text2NumberOfLines` (fixes [#112](https://github.com/calintamas/react-native-toast-message/issues/112), [#133](https://github.com/calintamas/react-native-toast-message/issues/133)).
97
-
98
- - on the `Toast` component, the following callbacks were added as props: `onShow` , `onHide` and `onPress` (fixes [#143](https://github.com/calintamas/react-native-toast-message/issues/143)).
99
-
100
- - A new `ToastShowParams` type is exported (fixes [#192](https://github.com/calintamas/react-native-toast-message/issues/192)).
101
-
102
- ### Changed
103
-
104
- - `topOffset` and `bottomOffset` are now by default `40px`
105
- - New test ids on `BaseToast` component: `toastTouchableContainer`, `toastContentContainer`, `toastText1` and `toastText2`.
106
-
107
- ### Removed
108
-
109
- - Success, error and info leading icons were removed from the package (to make it as lightweight as possible).
110
-
111
- It's now possible to pass them via render functions (for more flexibility, see issues regarding svg support, using components as icons, etc) on `BaseToast` component, example below:
112
-
113
- ```js
114
- const toastConfig = {
115
- success: (props) => (
116
- <BaseToast
117
- {...props}
118
- renderLeadingIcon={() => <Image />}
119
- renderTrailingIcon={() => <Image />}
120
- />
121
- )
122
- }
123
- ```
124
-
125
- Fixes [#188](https://github.com/calintamas/react-native-toast-message/issues/188), [#203](https://github.com/calintamas/react-native-toast-message/issues/203), [#245](https://github.com/calintamas/react-native-toast-message/issues/245), [#250](https://github.com/calintamas/react-native-toast-message/issues/250).
126
-
127
- - Trailing close icon has been removed from default components `BaseToast`, `SuccessToast`, `ErrorToast` and `InfoToast`. Fixes [#167](https://github.com/calintamas/react-native-toast-message/issues/167).
128
-
129
- ### Fixed
130
-
131
- - Failed prop type: Invalid props.text2Style key fontSize supplied to BaseToast [#174](https://github.com/calintamas/react-native-toast-message/issues/174).
132
- - Changing Font Family does not work [#176](https://github.com/calintamas/react-native-toast-message/issues/176)
133
- - Text1 not showing on Android [#194](https://github.com/calintamas/react-native-toast-message/issues/194)
134
- - Toast background is Transparent [#219](https://github.com/calintamas/react-native-toast-message/issues/219)
135
- - TypeError: Cannot read property 'show' of null [#232](https://github.com/calintamas/react-native-toast-message/issues/232)
136
- - textStyle1 styles not been applied [#233](https://github.com/calintamas/react-native-toast-message/issues/233)
137
- - Typescript-class component toast message in modal usage [#172](https://github.com/calintamas/react-native-toast-message/issues/172)
138
- - Getting last toast along with native prompt [#149](https://github.com/calintamas/react-native-toast-message/issues/149)
139
- - When modal request permission appear then the modal toast on the previous screen also appears -> android [#226](https://github.com/calintamas/react-native-toast-message/issues/226)
140
- - autoHide: false crashes on android [#256](https://github.com/calintamas/react-native-toast-message/issues/256)
141
-
142
- ## [1.6.0]
143
-
144
- ### Added
145
-
146
- - Export all default Toast components (`BaseToast`, `SuccessToast`, `InfoToast`, `ErrorToast`) to be able to reuse them with custom props ([#225](https://github.com/calintamas/react-native-toast-message/pull/225))
147
-
148
- ## [1.5.0]
149
-
150
- ### Changed
151
-
152
- - Move `show` method options to separate `ToastShowOptions` interface ([#242](https://github.com/calintamas/react-native-toast-message/pull/242))
153
- - Use `StyleProp` in type definition file, to allow different types of style to be used (eg. `style={[styles.one, styles.two]}`) ([#243](https://github.com/calintamas/react-native-toast-message/pull/243))
154
-
155
- ## [1.4.9]
156
-
157
- ### Fixed
158
-
159
- - Fix Keyboard pushing Toast too much on Android when displayed with position `bottom` ([#161](https://github.com/calintamas/react-native-toast-message/pull/161))
160
-
161
- ## [1.4.8]
162
-
163
- ### Added
164
-
165
- - Add types for `text1NumberOfLines` and `text2NumberOfLines` ([#152](https://github.com/calintamas/react-native-toast-message/pull/152))
166
-
167
- ## [1.4.7]
168
-
169
- ### Fixed
170
-
171
- - Fix proptype regression ([#151](https://github.com/calintamas/react-native-toast-message/pull/151))
172
-
173
- ## [1.4.6]
174
-
175
- ### Fixed
176
-
177
- - Fix type declaration file ([#148](https://github.com/calintamas/react-native-toast-message/pull/148))
178
-
179
- ## [1.4.5]
180
-
181
- ### Fixed
182
-
183
- - Remove dependency on ViewPropTypes ([#147](https://github.com/calintamas/react-native-toast-message/pull/147))
184
-
185
- ## [1.4.4]
186
-
187
- ### Changed
188
-
189
- - Move eslint-plugin-prettier to dev dependencies ([#135](https://github.com/calintamas/react-native-toast-message/pull/135))
190
- - Increase the threshold to register a swipe on the toast container ([#144](https://github.com/calintamas/react-native-toast-message/pull/144))
191
-
192
- ## [1.4.3]
193
-
194
- ### Fixed
195
-
196
- - Fix type definitions ([#127](https://github.com/calintamas/react-native-toast-message/pull/127))
197
- - Reset customProps every time show is called ([#128](https://github.com/calintamas/react-native-toast-message/pull/128))
198
-
199
- ## [1.4.2]
200
-
201
- ### Fixed
202
-
203
- - Fix `onPress` handler for custom components
204
-
205
- ## [1.4.1]
206
-
207
- ### Fixed
208
-
209
- - Fix type declaration file
210
-
211
- ## [1.4.0]
212
-
213
- ### Added
214
-
215
- - Add `onPress` to `Toast.show` method
216
- - Export `BaseToast` component to allow styling
217
- - Add `topOffset`, `bottomOffset` and `visibilityTime` as instance props
218
- - When shown with `position: bottom`, Toast is now Keyboard aware
219
-
220
- ## [1.3.7]
221
-
222
- ### Added
223
-
224
- - Add Typescript declaration file ([#94](https://github.com/calintamas/react-native-toast-message/pull/94))
225
-
226
- ### Fixed
227
-
228
- - Allow style prop to style the base component ([#93](https://github.com/calintamas/react-native-toast-message/pull/93))
229
-
230
- ## [1.3.6]
231
-
232
- ### Fixed
233
-
234
- - Custom render props are now part of the initial state. This removes the need to use optional chaining when defining a custom toast `config`
235
-
236
- ## [1.3.5]
237
-
238
- ### Added
239
-
240
- - Allow arbitrary data to be passed into Toasts ([#81](https://github.com/calintamas/react-native-toast-message/pull/81))
241
-
242
- ### Fixed
243
-
244
- - In case of RTL the text will start from the right ([#84](https://github.com/calintamas/react-native-toast-message/pull/84))
245
- - null is not an object (evaluating 'this.\_ref.show') ([#90](https://github.com/calintamas/react-native-toast-message/pull/90))
246
-
247
- ## [1.3.4]
248
-
249
- ### Fixed
250
-
251
- - Shadows not visible on Android ([#51](https://github.com/calintamas/react-native-toast-message/pull/51))
252
-
253
- ## [1.3.3]
254
-
255
- ### Fixed
256
-
257
- - `position: bottom`, damping value must be grater than 0 error ([#48](https://github.com/calintamas/react-native-toast-message/pull/48))
258
-
259
- ## [1.3.2]
260
-
261
- ### Changed
262
-
263
- - Given texts `text1` and `text2` are rendered conditionally now ([#40](https://github.com/calintamas/react-native-toast-message/pull/40))
264
-
265
- ### Fixed
266
-
267
- - Custom toast does not hide completely if its `height` is greater than the default 60
268
-
269
- ## [1.3.1]
270
-
271
- ### Fixed
272
-
273
- - Fix typescript import err
274
-
275
- ## [1.3.0]
276
-
277
- ### Added
278
-
279
- - Render custom toast types using a `config` prop
280
- - A default `info` type toast
281
- - `onShow` and `onHide` callbacks when using `Toast.show({ onShow, onHide })`
282
-
283
- ### Changed
284
-
285
- - `autoHide` is now `true` by default
286
-
287
- ### Removed
288
-
289
- - `renderSuccessToast` and `renderErrorToast` props are no longer relevant, so they were removed
290
-
291
- ### Fixed
292
-
293
- - `onHide` is called when the toast is dismissed by a swipe gesture
294
-
295
- ## [1.2.3]
296
-
297
- ### Fixed
298
-
299
- - Android status bar has bottom shadow
300
-
301
- ## [1.2.2]
302
-
303
- ### Added
304
-
305
- - Swipe to dismiss gesture
@@ -1,2 +0,0 @@
1
- declare function additiveInverseArray(arr: number[]): number[];
2
- export { additiveInverseArray };
@@ -1,4 +0,0 @@
1
- function additiveInverseArray(arr) {
2
- return arr.map((i) => -i);
3
- }
4
- export { additiveInverseArray };