react-native-toast-message 2.1.3 → 2.2.0-beta.1

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.
Files changed (58) hide show
  1. package/lib/src/Toast.d.ts +1 -1
  2. package/lib/src/Toast.js +5 -3
  3. package/lib/src/ToastUI.js +1 -1
  4. package/lib/src/__helpers__/PanResponder.d.ts +3 -0
  5. package/lib/src/__helpers__/PanResponder.js +26 -0
  6. package/lib/src/__helpers__/testing-library/react-hooks.d.ts +9 -0
  7. package/lib/src/__helpers__/testing-library/react-hooks.js +13 -0
  8. package/lib/src/__helpers__/testing-library/react-native.d.ts +9 -0
  9. package/lib/src/__helpers__/testing-library/react-native.js +13 -0
  10. package/lib/src/__mocks__/EnvironmentProviderMock.d.ts +7 -0
  11. package/lib/src/__mocks__/EnvironmentProviderMock.js +9 -0
  12. package/lib/src/__tests__/Toast.test.d.ts +1 -0
  13. package/lib/src/__tests__/Toast.test.js +190 -0
  14. package/lib/src/__tests__/ToastUI.test.d.ts +1 -0
  15. package/lib/src/__tests__/ToastUI.test.js +52 -0
  16. package/lib/src/__tests__/useToast.test.d.ts +1 -0
  17. package/lib/src/__tests__/useToast.test.js +142 -0
  18. package/lib/src/components/AnimatedContainer.js +2 -2
  19. package/lib/src/components/BaseToast.js +2 -2
  20. package/lib/src/components/__tests__/AnimatedContainer.test.d.ts +1 -0
  21. package/lib/src/components/__tests__/AnimatedContainer.test.js +147 -0
  22. package/lib/src/components/__tests__/BaseToast.test.d.ts +1 -0
  23. package/lib/src/components/__tests__/BaseToast.test.js +81 -0
  24. package/lib/src/components/__tests__/ErrorToast.test.d.ts +1 -0
  25. package/lib/src/components/__tests__/ErrorToast.test.js +20 -0
  26. package/lib/src/components/__tests__/InfoToast.test.d.ts +1 -0
  27. package/lib/src/components/__tests__/InfoToast.test.js +20 -0
  28. package/lib/src/components/__tests__/SuccessToast.test.d.ts +1 -0
  29. package/lib/src/components/__tests__/SuccessToast.test.js +20 -0
  30. package/lib/src/contexts/EnvironmentContext.d.ts +8 -0
  31. package/lib/src/contexts/EnvironmentContext.js +22 -0
  32. package/lib/src/contexts/__tests__/EnvironmentContext.test.d.ts +1 -0
  33. package/lib/src/contexts/__tests__/EnvironmentContext.test.js +29 -0
  34. package/lib/src/contexts/__tests__/LoggerContext.test.d.ts +1 -0
  35. package/lib/src/contexts/__tests__/LoggerContext.test.js +35 -0
  36. package/lib/src/contexts/index.d.ts +4 -1
  37. package/lib/src/contexts/index.js +2 -1
  38. package/lib/src/hooks/__tests__/useKeyboard.test.d.ts +1 -0
  39. package/lib/src/hooks/__tests__/useKeyboard.test.js +60 -0
  40. package/lib/src/hooks/__tests__/usePanResponder.test.d.ts +1 -0
  41. package/lib/src/hooks/__tests__/usePanResponder.test.js +112 -0
  42. package/lib/src/hooks/__tests__/useSlideAnimation.test.d.ts +1 -0
  43. package/lib/src/hooks/__tests__/useSlideAnimation.test.js +88 -0
  44. package/lib/src/hooks/__tests__/useTimeout.test.d.ts +1 -0
  45. package/lib/src/hooks/__tests__/useTimeout.test.js +54 -0
  46. package/lib/src/hooks/__tests__/useViewDimensions.test.d.ts +1 -0
  47. package/lib/src/hooks/__tests__/useViewDimensions.test.js +51 -0
  48. package/lib/src/hooks/useSlideAnimation.d.ts +6 -2
  49. package/lib/src/hooks/useSlideAnimation.js +37 -12
  50. package/lib/src/types/index.d.ts +9 -0
  51. package/lib/src/utils/__tests__/number.test.d.ts +1 -0
  52. package/lib/src/utils/__tests__/number.test.js +15 -0
  53. package/lib/src/utils/__tests__/obj.test.d.ts +1 -0
  54. package/lib/src/utils/__tests__/obj.test.js +21 -0
  55. package/package.json +21 -11
  56. package/CHANGELOG.md +0 -299
  57. package/lib/src/utils/array.d.ts +0 -2
  58. package/lib/src/utils/array.js +0 -4
package/CHANGELOG.md DELETED
@@ -1,299 +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.3]
13
-
14
- ### Fixed
15
-
16
- - 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)
17
-
18
- ## [2.1.2]
19
-
20
- ### Fixed
21
-
22
- - Fixes `useNativeDriver` warning on web by [jpaas](https://github.com/jpaas) in [#334](https://github.com/calintamas/react-native-toast-message/pull/334)
23
-
24
- ## [2.1.1]
25
-
26
- ### Fixed
27
-
28
- - 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))
29
-
30
- ## [2.1.0]
31
-
32
- ### Fixed
33
-
34
- - 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))
35
- - 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))
36
-
37
- Big thanks go to [jstheoriginal](https://github.com/jstheoriginal) for all the work on fixing the two issues above 🙌.
38
-
39
- - Flexbox not working for setting Toast width or alignment ([3400f00](https://github.com/calintamas/react-native-toast-message/commit/3400f0074116f5acb37ca2eb696ea50b0c669ddc))
40
-
41
- ### Changed
42
-
43
- - `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)
44
- - Peer deps no longer require a min version ([e91ed21](https://github.com/calintamas/react-native-toast-message/commit/e91ed21d277d7348b674834765147be752b6abfb))
45
-
46
- ## [2.0.2]
47
-
48
- ### Fixed
49
-
50
- - Fast swipe up re-creates the toast [#280](https://github.com/calintamas/react-native-toast-message/issues/280)
51
-
52
- ## [2.0.1]
53
-
54
- ### Fixed
55
-
56
- - `ansi-regex` vulnerability by upgrading to `@testing-library/jest-native v4.0.4` ([#277](https://github.com/calintamas/react-native-toast-message/pull/277))
57
-
58
- ## [2.0.0]
59
-
60
- ### Breaking
61
-
62
- - 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.
63
-
64
- ```js
65
- // App.jsx
66
- import Toast from 'react-native-toast-message';
67
-
68
- export function App(props) {
69
- return (
70
- <>
71
- {/* ... */}
72
- <Toast />
73
- </>
74
- );
75
- }
76
- ```
77
-
78
- - When you want to have the Toast visible inside a Modal, you no longer need to set a separate `ref`.
79
-
80
- 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.
81
-
82
- - `onHide` callback is now always called when the Toast hides (does not matter if `autoHide` was `true` / `false`).
83
-
84
- - `inProgress` state has been removed and can no longer be relied upon in a custom Toast config.
85
-
86
- - `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)).
87
-
88
- ### Added
89
-
90
- - 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)).
91
-
92
- - 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)).
93
-
94
- - A new `ToastShowParams` type is exported (fixes [#192](https://github.com/calintamas/react-native-toast-message/issues/192)).
95
-
96
- ### Changed
97
-
98
- - `topOffset` and `bottomOffset` are now by default `40px`
99
- - New test ids on `BaseToast` component: `toastTouchableContainer`, `toastContentContainer`, `toastText1` and `toastText2`.
100
-
101
- ### Removed
102
-
103
- - Success, error and info leading icons were removed from the package (to make it as lightweight as possible).
104
-
105
- 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:
106
-
107
- ```js
108
- const toastConfig = {
109
- success: (props) => (
110
- <BaseToast
111
- {...props}
112
- renderLeadingIcon={() => <Image />}
113
- renderTrailingIcon={() => <Image />}
114
- />
115
- )
116
- }
117
- ```
118
-
119
- 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).
120
-
121
- - 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).
122
-
123
- ### Fixed
124
-
125
- - Failed prop type: Invalid props.text2Style key fontSize supplied to BaseToast [#174](https://github.com/calintamas/react-native-toast-message/issues/174).
126
- - Changing Font Family does not work [#176](https://github.com/calintamas/react-native-toast-message/issues/176)
127
- - Text1 not showing on Android [#194](https://github.com/calintamas/react-native-toast-message/issues/194)
128
- - Toast background is Transparent [#219](https://github.com/calintamas/react-native-toast-message/issues/219)
129
- - TypeError: Cannot read property 'show' of null [#232](https://github.com/calintamas/react-native-toast-message/issues/232)
130
- - textStyle1 styles not been applied [#233](https://github.com/calintamas/react-native-toast-message/issues/233)
131
- - Typescript-class component toast message in modal usage [#172](https://github.com/calintamas/react-native-toast-message/issues/172)
132
- - Getting last toast along with native prompt [#149](https://github.com/calintamas/react-native-toast-message/issues/149)
133
- - 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)
134
- - autoHide: false crashes on android [#256](https://github.com/calintamas/react-native-toast-message/issues/256)
135
-
136
- ## [1.6.0]
137
-
138
- ### Added
139
-
140
- - 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))
141
-
142
- ## [1.5.0]
143
-
144
- ### Changed
145
-
146
- - Move `show` method options to separate `ToastShowOptions` interface ([#242](https://github.com/calintamas/react-native-toast-message/pull/242))
147
- - 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))
148
-
149
- ## [1.4.9]
150
-
151
- ### Fixed
152
-
153
- - Fix Keyboard pushing Toast too much on Android when displayed with position `bottom` ([#161](https://github.com/calintamas/react-native-toast-message/pull/161))
154
-
155
- ## [1.4.8]
156
-
157
- ### Added
158
-
159
- - Add types for `text1NumberOfLines` and `text2NumberOfLines` ([#152](https://github.com/calintamas/react-native-toast-message/pull/152))
160
-
161
- ## [1.4.7]
162
-
163
- ### Fixed
164
-
165
- - Fix proptype regression ([#151](https://github.com/calintamas/react-native-toast-message/pull/151))
166
-
167
- ## [1.4.6]
168
-
169
- ### Fixed
170
-
171
- - Fix type declaration file ([#148](https://github.com/calintamas/react-native-toast-message/pull/148))
172
-
173
- ## [1.4.5]
174
-
175
- ### Fixed
176
-
177
- - Remove dependency on ViewPropTypes ([#147](https://github.com/calintamas/react-native-toast-message/pull/147))
178
-
179
- ## [1.4.4]
180
-
181
- ### Changed
182
-
183
- - Move eslint-plugin-prettier to dev dependencies ([#135](https://github.com/calintamas/react-native-toast-message/pull/135))
184
- - Increase the threshold to register a swipe on the toast container ([#144](https://github.com/calintamas/react-native-toast-message/pull/144))
185
-
186
- ## [1.4.3]
187
-
188
- ### Fixed
189
-
190
- - Fix type definitions ([#127](https://github.com/calintamas/react-native-toast-message/pull/127))
191
- - Reset customProps every time show is called ([#128](https://github.com/calintamas/react-native-toast-message/pull/128))
192
-
193
- ## [1.4.2]
194
-
195
- ### Fixed
196
-
197
- - Fix `onPress` handler for custom components
198
-
199
- ## [1.4.1]
200
-
201
- ### Fixed
202
-
203
- - Fix type declaration file
204
-
205
- ## [1.4.0]
206
-
207
- ### Added
208
-
209
- - Add `onPress` to `Toast.show` method
210
- - Export `BaseToast` component to allow styling
211
- - Add `topOffset`, `bottomOffset` and `visibilityTime` as instance props
212
- - When shown with `position: bottom`, Toast is now Keyboard aware
213
-
214
- ## [1.3.7]
215
-
216
- ### Added
217
-
218
- - Add Typescript declaration file ([#94](https://github.com/calintamas/react-native-toast-message/pull/94))
219
-
220
- ### Fixed
221
-
222
- - Allow style prop to style the base component ([#93](https://github.com/calintamas/react-native-toast-message/pull/93))
223
-
224
- ## [1.3.6]
225
-
226
- ### Fixed
227
-
228
- - Custom render props are now part of the initial state. This removes the need to use optional chaining when defining a custom toast `config`
229
-
230
- ## [1.3.5]
231
-
232
- ### Added
233
-
234
- - Allow arbitrary data to be passed into Toasts ([#81](https://github.com/calintamas/react-native-toast-message/pull/81))
235
-
236
- ### Fixed
237
-
238
- - In case of RTL the text will start from the right ([#84](https://github.com/calintamas/react-native-toast-message/pull/84))
239
- - null is not an object (evaluating 'this.\_ref.show') ([#90](https://github.com/calintamas/react-native-toast-message/pull/90))
240
-
241
- ## [1.3.4]
242
-
243
- ### Fixed
244
-
245
- - Shadows not visible on Android ([#51](https://github.com/calintamas/react-native-toast-message/pull/51))
246
-
247
- ## [1.3.3]
248
-
249
- ### Fixed
250
-
251
- - `position: bottom`, damping value must be grater than 0 error ([#48](https://github.com/calintamas/react-native-toast-message/pull/48))
252
-
253
- ## [1.3.2]
254
-
255
- ### Changed
256
-
257
- - Given texts `text1` and `text2` are rendered conditionally now ([#40](https://github.com/calintamas/react-native-toast-message/pull/40))
258
-
259
- ### Fixed
260
-
261
- - Custom toast does not hide completely if its `height` is greater than the default 60
262
-
263
- ## [1.3.1]
264
-
265
- ### Fixed
266
-
267
- - Fix typescript import err
268
-
269
- ## [1.3.0]
270
-
271
- ### Added
272
-
273
- - Render custom toast types using a `config` prop
274
- - A default `info` type toast
275
- - `onShow` and `onHide` callbacks when using `Toast.show({ onShow, onHide })`
276
-
277
- ### Changed
278
-
279
- - `autoHide` is now `true` by default
280
-
281
- ### Removed
282
-
283
- - `renderSuccessToast` and `renderErrorToast` props are no longer relevant, so they were removed
284
-
285
- ### Fixed
286
-
287
- - `onHide` is called when the toast is dismissed by a swipe gesture
288
-
289
- ## [1.2.3]
290
-
291
- ### Fixed
292
-
293
- - Android status bar has bottom shadow
294
-
295
- ## [1.2.2]
296
-
297
- ### Added
298
-
299
- - 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 };