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