@aws-amplify/ui-react-native 1.2.0 → 1.2.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/Authenticator/common/DefaultFormFields/DefaultTextFormFields.js +2 -7
  3. package/dist/Authenticator/common/DefaultFormFields/Field.d.ts +6 -0
  4. package/dist/Authenticator/common/DefaultFormFields/Field.js +34 -0
  5. package/dist/Authenticator/common/DefaultFormFields/types.d.ts +3 -0
  6. package/dist/InAppMessaging/components/CarouselMessage/CarouselMessage.js +2 -1
  7. package/dist/InAppMessaging/constants.d.ts +1 -0
  8. package/dist/InAppMessaging/constants.js +1 -0
  9. package/dist/primitives/Carousel/types.d.ts +1 -0
  10. package/dist/version.d.ts +1 -1
  11. package/dist/version.js +1 -1
  12. package/package.json +3 -3
  13. package/src/Authenticator/Defaults/ConfirmResetPassword/__tests__/__snapshots__/ConfirmResetPassword.spec.tsx.snap +44 -0
  14. package/src/Authenticator/Defaults/ForceNewPassword/__tests__/__snapshots__/ForceNewPassword.spec.tsx.snap +33 -0
  15. package/src/Authenticator/Defaults/SignIn/__tests__/__snapshots__/SignIn.spec.tsx.snap +33 -0
  16. package/src/Authenticator/Defaults/SignUp/__tests__/__snapshots__/SignUp.spec.tsx.snap +110 -0
  17. package/src/Authenticator/common/DefaultFormFields/DefaultTextFormFields.tsx +2 -13
  18. package/src/Authenticator/common/DefaultFormFields/Field.tsx +50 -0
  19. package/src/Authenticator/common/DefaultFormFields/types.ts +4 -0
  20. package/src/InAppMessaging/components/BannerMessage/__tests__/BannerMessage.spec.tsx +46 -33
  21. package/src/InAppMessaging/components/BannerMessage/__tests__/__snapshots__/BannerMessage.spec.tsx.snap +372 -0
  22. package/src/InAppMessaging/components/CarouselMessage/CarouselMessage.tsx +2 -0
  23. package/src/InAppMessaging/components/CarouselMessage/__tests__/CarouselMessage.spec.tsx +64 -27
  24. package/src/InAppMessaging/components/CarouselMessage/__tests__/CarouselMessageItem.spec.tsx +5 -11
  25. package/src/InAppMessaging/components/CarouselMessage/__tests__/__snapshots__/CarouselMessage.spec.tsx.snap +38 -0
  26. package/src/InAppMessaging/components/FullScreenMessage/__tests__/FullScreenMessage.spec.tsx +5 -5
  27. package/src/InAppMessaging/components/InAppMessageDisplay/__tests__/InAppMessageDisplay.spec.tsx +3 -3
  28. package/src/InAppMessaging/components/MessageWrapper/__tests__/MessageWrapper.spec.tsx +3 -3
  29. package/src/InAppMessaging/components/ModalMessage/__tests__/ModalMessage.spec.tsx +48 -34
  30. package/src/InAppMessaging/components/ModalMessage/__tests__/__snapshots__/ModalMessage.spec.tsx.snap +372 -0
  31. package/src/InAppMessaging/components/withInAppMessaging/__tests__/withInAppMessaging.spec.tsx +3 -3
  32. package/src/InAppMessaging/constants.ts +1 -0
  33. package/src/primitives/Carousel/__tests__/Carousel.spec.tsx +53 -64
  34. package/src/primitives/Carousel/__tests__/CarouselPageIndicator.spec.tsx +46 -44
  35. package/src/primitives/Carousel/__tests__/__snapshots__/Carousel.spec.tsx.snap +94 -0
  36. package/src/primitives/Carousel/types.ts +1 -0
  37. package/src/version.ts +1 -1
@@ -35,6 +35,7 @@ exports[`CarouselMessage allows style overrides 1`] = `
35
35
  ]
36
36
  }
37
37
  renderItem={[Function]}
38
+ testID="in-app-messaging--carousel"
38
39
  />
39
40
  </MessageWrapper>
40
41
  `;
@@ -70,6 +71,43 @@ exports[`CarouselMessage renders as expected 1`] = `
70
71
  ]
71
72
  }
72
73
  renderItem={[Function]}
74
+ testID="in-app-messaging--carousel"
75
+ />
76
+ </MessageWrapper>
77
+ `;
78
+
79
+ exports[`CarouselMessage renders as expected with minimal props 1`] = `
80
+ <MessageWrapper
81
+ disableSafeAreaView={true}
82
+ >
83
+ <Carousel
84
+ data={Array []}
85
+ indicatorActiveStyle={
86
+ Array [
87
+ Object {
88
+ "backgroundColor": "#a1a1a1",
89
+ "borderRadius": 6,
90
+ "height": 12,
91
+ "margin": 4,
92
+ "width": 12,
93
+ },
94
+ undefined,
95
+ ]
96
+ }
97
+ indicatorInactiveStyle={
98
+ Array [
99
+ Object {
100
+ "backgroundColor": "#d8d8d8",
101
+ "borderRadius": 6,
102
+ "height": 12,
103
+ "margin": 4,
104
+ "width": 12,
105
+ },
106
+ undefined,
107
+ ]
108
+ }
109
+ renderItem={[Function]}
110
+ testID="in-app-messaging--carousel"
73
111
  />
74
112
  </MessageWrapper>
75
113
  `;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import TestRenderer from 'react-test-renderer';
2
+ import { render } from '@testing-library/react-native';
3
3
 
4
4
  import { useDeviceOrientation } from '../../../../hooks';
5
5
  import { useMessageImage } from '../../../hooks';
@@ -34,9 +34,9 @@ describe('FullScreenMessage', () => {
34
34
  isImageFetching: false,
35
35
  });
36
36
 
37
- const renderer = TestRenderer.create(<FullScreenMessage {...baseProps} />);
37
+ const { toJSON } = render(<FullScreenMessage {...baseProps} />);
38
38
 
39
- expect(renderer.toJSON()).toMatchSnapshot();
39
+ expect(toJSON()).toMatchSnapshot();
40
40
  });
41
41
 
42
42
  it('returns null while an image is fetching', () => {
@@ -46,8 +46,8 @@ describe('FullScreenMessage', () => {
46
46
  isImageFetching: true,
47
47
  });
48
48
 
49
- const renderer = TestRenderer.create(<FullScreenMessage {...baseProps} />);
49
+ const { toJSON } = render(<FullScreenMessage {...baseProps} />);
50
50
 
51
- expect(renderer.toJSON()).toBeNull();
51
+ expect(toJSON()).toBeNull();
52
52
  });
53
53
  });
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { Text, View } from 'react-native';
3
- import TestRenderer from 'react-test-renderer';
3
+ import { render } from '@testing-library/react-native';
4
4
  import { useMessage } from '@aws-amplify/ui-react-core';
5
5
 
6
6
  import InAppMessageDisplay from '../InAppMessageDisplay';
@@ -24,8 +24,8 @@ describe('InAppMessageDisplay', () => {
24
24
 
25
25
  mockUseMessage.mockReturnValueOnce({ Component, props });
26
26
 
27
- const inAppMessageDisplay = TestRenderer.create(<InAppMessageDisplay />);
27
+ const { toJSON } = render(<InAppMessageDisplay />);
28
28
 
29
- expect(inAppMessageDisplay.toJSON()).toMatchSnapshot();
29
+ expect(toJSON()).toMatchSnapshot();
30
30
  });
31
31
  });
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import TestRenderer from 'react-test-renderer';
2
+ import { render } from '@testing-library/react-native';
3
3
  import { Text } from 'react-native';
4
4
 
5
5
  import MessageWrapper from '../MessageWrapper';
@@ -8,12 +8,12 @@ const Children = () => <Text>Children</Text>;
8
8
 
9
9
  describe('MessageWrapper', () => {
10
10
  it('renders as expected', () => {
11
- const renderer = TestRenderer.create(
11
+ const { toJSON } = render(
12
12
  <MessageWrapper>
13
13
  <Children />
14
14
  </MessageWrapper>
15
15
  );
16
16
 
17
- expect(renderer.toJSON()).toMatchSnapshot();
17
+ expect(toJSON()).toMatchSnapshot();
18
18
  });
19
19
  });
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import TestRenderer from 'react-test-renderer';
2
+ import { fireEvent, render } from '@testing-library/react-native';
3
3
 
4
4
  import { IN_APP_MESSAGING_TEST_ID } from '../../../constants';
5
5
  import { useDeviceOrientation } from '../../../../hooks';
@@ -36,9 +36,9 @@ describe('ModalMessage', () => {
36
36
  isImageFetching: false,
37
37
  });
38
38
 
39
- const renderer = TestRenderer.create(<ModalMessage {...baseProps} />);
39
+ const { toJSON } = render(<ModalMessage {...baseProps} />);
40
40
 
41
- expect(renderer.toJSON()).toMatchSnapshot();
41
+ expect(toJSON()).toMatchSnapshot();
42
42
  });
43
43
 
44
44
  it('renders a message as expected with an image', () => {
@@ -55,16 +55,14 @@ describe('ModalMessage', () => {
55
55
  const src = 'asset.png';
56
56
  const props = { ...baseProps, image: { src } };
57
57
 
58
- const renderer = TestRenderer.create(<ModalMessage {...props} />);
58
+ const { toJSON, getByTestId } = render(<ModalMessage {...props} />);
59
59
 
60
- const image = renderer.root.findByProps({
61
- testID: IN_APP_MESSAGING_TEST_ID.IMAGE,
62
- });
60
+ const image = getByTestId(IN_APP_MESSAGING_TEST_ID.IMAGE);
63
61
 
64
62
  expect(image.props).toEqual(
65
63
  expect.objectContaining({ source: { uri: src } })
66
64
  );
67
- expect(renderer.toJSON()).toMatchSnapshot();
65
+ expect(toJSON()).toMatchSnapshot();
68
66
  });
69
67
 
70
68
  it('returns null while an image is fetching', () => {
@@ -78,9 +76,9 @@ describe('ModalMessage', () => {
78
76
  isImageFetching: true,
79
77
  });
80
78
 
81
- const renderer = TestRenderer.create(<ModalMessage {...baseProps} />);
79
+ const { toJSON } = render(<ModalMessage {...baseProps} />);
82
80
 
83
- expect(renderer.toJSON()).toBeNull();
81
+ expect(toJSON()).toBeNull();
84
82
  });
85
83
 
86
84
  it.each([
@@ -100,12 +98,32 @@ describe('ModalMessage', () => {
100
98
  expectedProps: { children: 'body content' },
101
99
  },
102
100
  ],
101
+ ])(
102
+ 'correctly handles a %s prop',
103
+ (key, testID, { testProps, expectedProps }) => {
104
+ mockUseMessageImage.mockReturnValueOnce({
105
+ hasRenderableImage: false,
106
+ imageDimensions: { height: undefined, width: undefined },
107
+ isImageFetching: false,
108
+ });
109
+
110
+ const props = { ...baseProps, [key]: testProps };
111
+
112
+ const { getByTestId } = render(<ModalMessage {...props} />);
113
+ const testElement = getByTestId(testID);
114
+
115
+ for (const [key, value] of Object.entries(expectedProps)) {
116
+ expect(testElement.props[key]).toEqual(value);
117
+ }
118
+ }
119
+ );
120
+
121
+ it.each([
103
122
  [
104
123
  'primaryButton',
105
124
  IN_APP_MESSAGING_TEST_ID.PRIMARY_BUTTON,
106
125
  {
107
126
  testProps: { onAction, title: 'primary button' },
108
- expectedProps: { children: 'primary button', onPress: onAction },
109
127
  },
110
128
  ],
111
129
  [
@@ -113,26 +131,27 @@ describe('ModalMessage', () => {
113
131
  IN_APP_MESSAGING_TEST_ID.SECONDARY_BUTTON,
114
132
  {
115
133
  testProps: { onAction, title: 'secondary button' },
116
- expectedProps: { children: 'secondary button', onPress: onAction },
117
134
  },
118
135
  ],
119
- ])(
120
- 'correctly handles a %s prop',
121
- (key, testID, { testProps, expectedProps }) => {
122
- mockUseMessageImage.mockReturnValueOnce({
123
- hasRenderableImage: false,
124
- imageDimensions: { height: null, width: null },
125
- isImageFetching: false,
126
- });
136
+ ])('correctly handles a %s prop', (key, testID, { testProps }) => {
137
+ mockUseMessageImage.mockReturnValueOnce({
138
+ hasRenderableImage: false,
139
+ imageDimensions: { height: undefined, width: undefined },
140
+ isImageFetching: false,
141
+ });
127
142
 
128
- const props = { ...baseProps, [key]: testProps };
143
+ const props = { ...baseProps, [key]: testProps };
144
+ const { toJSON, getByRole, getByTestId, getByText, queryAllByRole } =
145
+ render(<ModalMessage {...props} />);
129
146
 
130
- const renderer = TestRenderer.create(<ModalMessage {...props} />);
131
- const testElement = renderer.root.findByProps({ testID });
147
+ expect(toJSON()).toMatchSnapshot();
148
+ expect(queryAllByRole('button')).toHaveLength(2);
149
+ expect(getByTestId(testID)).toBeDefined();
150
+ expect(getByTestId(IN_APP_MESSAGING_TEST_ID.CLOSE_BUTTON)).toBeDefined();
132
151
 
133
- expect(testElement.props).toEqual(expect.objectContaining(expectedProps));
134
- }
135
- );
152
+ expect(getByRole('image')).toBeDefined();
153
+ expect(getByText(testProps.title)).toBeDefined();
154
+ });
136
155
 
137
156
  it('calls onClose when the close button is pressed', () => {
138
157
  mockUseMessageImage.mockReturnValueOnce({
@@ -141,15 +160,10 @@ describe('ModalMessage', () => {
141
160
  isImageFetching: false,
142
161
  });
143
162
 
144
- const renderer = TestRenderer.create(<ModalMessage {...baseProps} />);
145
- const closeButton = renderer.root.findByProps({
146
- testID: IN_APP_MESSAGING_TEST_ID.CLOSE_BUTTON,
147
- });
148
-
149
- TestRenderer.act(() => {
150
- (closeButton.props as { onPress: () => void }).onPress();
151
- });
163
+ const { getByTestId } = render(<ModalMessage {...baseProps} />);
164
+ const closeButton = getByTestId(IN_APP_MESSAGING_TEST_ID.CLOSE_BUTTON);
152
165
 
166
+ fireEvent.press(closeButton);
153
167
  expect(onClose).toHaveBeenCalledTimes(1);
154
168
  });
155
169
  });
@@ -1,5 +1,377 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`ModalMessage correctly handles a primaryButton prop 1`] = `
4
+ <MessageWrapper
5
+ style={
6
+ Object {
7
+ "flex": 1,
8
+ "justifyContent": "center",
9
+ }
10
+ }
11
+ >
12
+ <View
13
+ style={
14
+ Array [
15
+ Object {
16
+ "backgroundColor": "#fff",
17
+ "elevation": 3,
18
+ "margin": 16,
19
+ "minHeight": "40%",
20
+ "shadowColor": "#000",
21
+ "shadowOffset": Object {
22
+ "height": 2,
23
+ "width": 2,
24
+ },
25
+ "shadowOpacity": 0.1,
26
+ "shadowRadius": 2,
27
+ },
28
+ Object {},
29
+ Object {},
30
+ ]
31
+ }
32
+ >
33
+ <View
34
+ style={
35
+ Object {
36
+ "padding": 12,
37
+ }
38
+ }
39
+ >
40
+ <View
41
+ accessibilityRole="button"
42
+ accessible={true}
43
+ collapsable={false}
44
+ focusable={true}
45
+ hitSlop={
46
+ Object {
47
+ "bottom": 10,
48
+ "left": 10,
49
+ "right": 10,
50
+ "top": 10,
51
+ }
52
+ }
53
+ onBlur={[Function]}
54
+ onClick={[Function]}
55
+ onFocus={[Function]}
56
+ onResponderGrant={[Function]}
57
+ onResponderMove={[Function]}
58
+ onResponderRelease={[Function]}
59
+ onResponderTerminate={[Function]}
60
+ onResponderTerminationRequest={[Function]}
61
+ onStartShouldSetResponder={[Function]}
62
+ style={
63
+ Array [
64
+ Object {},
65
+ undefined,
66
+ Array [
67
+ Object {
68
+ "alignSelf": "flex-start",
69
+ "marginLeft": "auto",
70
+ },
71
+ undefined,
72
+ ],
73
+ ]
74
+ }
75
+ testID="in-app-messaging--close-button"
76
+ >
77
+ <Image
78
+ accessibilityRole="image"
79
+ source={
80
+ Object {
81
+ "testUri": "../../../src/assets/icons/close.png",
82
+ }
83
+ }
84
+ style={
85
+ Array [
86
+ Object {
87
+ "height": 20,
88
+ "resizeMode": "contain",
89
+ "tintColor": undefined,
90
+ "width": 20,
91
+ },
92
+ undefined,
93
+ ]
94
+ }
95
+ />
96
+ </View>
97
+ <View
98
+ style={
99
+ Object {
100
+ "marginTop": 12,
101
+ }
102
+ }
103
+ />
104
+ </View>
105
+ <View
106
+ style={
107
+ Object {
108
+ "flexDirection": "row",
109
+ "justifyContent": "center",
110
+ "marginTop": "auto",
111
+ "paddingBottom": 4,
112
+ "paddingHorizontal": 4,
113
+ }
114
+ }
115
+ >
116
+ <View
117
+ accessibilityRole="button"
118
+ accessible={true}
119
+ collapsable={false}
120
+ focusable={true}
121
+ onBlur={[Function]}
122
+ onClick={[Function]}
123
+ onFocus={[Function]}
124
+ onResponderGrant={[Function]}
125
+ onResponderMove={[Function]}
126
+ onResponderRelease={[Function]}
127
+ onResponderTerminate={[Function]}
128
+ onResponderTerminationRequest={[Function]}
129
+ onStartShouldSetResponder={[Function]}
130
+ style={
131
+ Array [
132
+ Object {
133
+ "alignItems": "center",
134
+ "backgroundColor": "transparent",
135
+ "borderColor": "hsl(210, 10%, 58%)",
136
+ "borderRadius": 4,
137
+ "borderWidth": 1,
138
+ "justifyContent": "center",
139
+ "paddingHorizontal": 16,
140
+ "paddingVertical": 12,
141
+ },
142
+ undefined,
143
+ Array [
144
+ Object {},
145
+ Object {
146
+ "backgroundColor": "#e8e8e8",
147
+ "borderRadius": 4,
148
+ "flex": 1,
149
+ "margin": 8,
150
+ "padding": 12,
151
+ },
152
+ Object {},
153
+ Object {},
154
+ ],
155
+ ]
156
+ }
157
+ testID="in-app-messaging--primary-button"
158
+ >
159
+ <Text
160
+ style={
161
+ Array [
162
+ Object {
163
+ "color": "hsl(210, 50%, 10%)",
164
+ "fontSize": 16,
165
+ "fontWeight": "700",
166
+ "textAlign": "center",
167
+ },
168
+ Array [
169
+ Object {
170
+ "fontSize": 16,
171
+ "fontWeight": "400",
172
+ "lineHeight": 24,
173
+ "textAlign": "center",
174
+ },
175
+ Object {},
176
+ Object {},
177
+ ],
178
+ ]
179
+ }
180
+ >
181
+ primary button
182
+ </Text>
183
+ </View>
184
+ </View>
185
+ </View>
186
+ </MessageWrapper>
187
+ `;
188
+
189
+ exports[`ModalMessage correctly handles a secondaryButton prop 1`] = `
190
+ <MessageWrapper
191
+ style={
192
+ Object {
193
+ "flex": 1,
194
+ "justifyContent": "center",
195
+ }
196
+ }
197
+ >
198
+ <View
199
+ style={
200
+ Array [
201
+ Object {
202
+ "backgroundColor": "#fff",
203
+ "elevation": 3,
204
+ "margin": 16,
205
+ "minHeight": "40%",
206
+ "shadowColor": "#000",
207
+ "shadowOffset": Object {
208
+ "height": 2,
209
+ "width": 2,
210
+ },
211
+ "shadowOpacity": 0.1,
212
+ "shadowRadius": 2,
213
+ },
214
+ Object {},
215
+ Object {},
216
+ ]
217
+ }
218
+ >
219
+ <View
220
+ style={
221
+ Object {
222
+ "padding": 12,
223
+ }
224
+ }
225
+ >
226
+ <View
227
+ accessibilityRole="button"
228
+ accessible={true}
229
+ collapsable={false}
230
+ focusable={true}
231
+ hitSlop={
232
+ Object {
233
+ "bottom": 10,
234
+ "left": 10,
235
+ "right": 10,
236
+ "top": 10,
237
+ }
238
+ }
239
+ onBlur={[Function]}
240
+ onClick={[Function]}
241
+ onFocus={[Function]}
242
+ onResponderGrant={[Function]}
243
+ onResponderMove={[Function]}
244
+ onResponderRelease={[Function]}
245
+ onResponderTerminate={[Function]}
246
+ onResponderTerminationRequest={[Function]}
247
+ onStartShouldSetResponder={[Function]}
248
+ style={
249
+ Array [
250
+ Object {},
251
+ undefined,
252
+ Array [
253
+ Object {
254
+ "alignSelf": "flex-start",
255
+ "marginLeft": "auto",
256
+ },
257
+ undefined,
258
+ ],
259
+ ]
260
+ }
261
+ testID="in-app-messaging--close-button"
262
+ >
263
+ <Image
264
+ accessibilityRole="image"
265
+ source={
266
+ Object {
267
+ "testUri": "../../../src/assets/icons/close.png",
268
+ }
269
+ }
270
+ style={
271
+ Array [
272
+ Object {
273
+ "height": 20,
274
+ "resizeMode": "contain",
275
+ "tintColor": undefined,
276
+ "width": 20,
277
+ },
278
+ undefined,
279
+ ]
280
+ }
281
+ />
282
+ </View>
283
+ <View
284
+ style={
285
+ Object {
286
+ "marginTop": 12,
287
+ }
288
+ }
289
+ />
290
+ </View>
291
+ <View
292
+ style={
293
+ Object {
294
+ "flexDirection": "row",
295
+ "justifyContent": "center",
296
+ "marginTop": "auto",
297
+ "paddingBottom": 4,
298
+ "paddingHorizontal": 4,
299
+ }
300
+ }
301
+ >
302
+ <View
303
+ accessibilityRole="button"
304
+ accessible={true}
305
+ collapsable={false}
306
+ focusable={true}
307
+ onBlur={[Function]}
308
+ onClick={[Function]}
309
+ onFocus={[Function]}
310
+ onResponderGrant={[Function]}
311
+ onResponderMove={[Function]}
312
+ onResponderRelease={[Function]}
313
+ onResponderTerminate={[Function]}
314
+ onResponderTerminationRequest={[Function]}
315
+ onStartShouldSetResponder={[Function]}
316
+ style={
317
+ Array [
318
+ Object {
319
+ "alignItems": "center",
320
+ "backgroundColor": "transparent",
321
+ "borderColor": "hsl(210, 10%, 58%)",
322
+ "borderRadius": 4,
323
+ "borderWidth": 1,
324
+ "justifyContent": "center",
325
+ "paddingHorizontal": 16,
326
+ "paddingVertical": 12,
327
+ },
328
+ undefined,
329
+ Array [
330
+ Object {},
331
+ Object {
332
+ "backgroundColor": "#e8e8e8",
333
+ "borderRadius": 4,
334
+ "flex": 1,
335
+ "margin": 8,
336
+ "padding": 12,
337
+ },
338
+ Object {},
339
+ Object {},
340
+ ],
341
+ ]
342
+ }
343
+ testID="in-app-messaging--secondary-button"
344
+ >
345
+ <Text
346
+ style={
347
+ Array [
348
+ Object {
349
+ "color": "hsl(210, 50%, 10%)",
350
+ "fontSize": 16,
351
+ "fontWeight": "700",
352
+ "textAlign": "center",
353
+ },
354
+ Array [
355
+ Object {
356
+ "fontSize": 16,
357
+ "fontWeight": "400",
358
+ "lineHeight": 24,
359
+ "textAlign": "center",
360
+ },
361
+ Object {},
362
+ Object {},
363
+ ],
364
+ ]
365
+ }
366
+ >
367
+ secondary button
368
+ </Text>
369
+ </View>
370
+ </View>
371
+ </View>
372
+ </MessageWrapper>
373
+ `;
374
+
3
375
  exports[`ModalMessage renders a message as expected with an image 1`] = `
4
376
  <MessageWrapper
5
377
  style={
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import TestRenderer from 'react-test-renderer';
2
+ import { render } from '@testing-library/react-native';
3
3
 
4
4
  import withInAppMessaging from '../withInAppMessaging';
5
5
 
@@ -8,8 +8,8 @@ const TestComponent = ({ title }: { title: string }) => <>{title}</>;
8
8
  describe('withInAppMessaging', () => {
9
9
  it('renders as expected', () => {
10
10
  const WrappedComponent = withInAppMessaging(TestComponent);
11
- const output = TestRenderer.create(<WrappedComponent title="example" />);
11
+ const { toJSON } = render(<WrappedComponent title="example" />);
12
12
 
13
- expect(output.toJSON()).toMatchSnapshot();
13
+ expect(toJSON()).toMatchSnapshot();
14
14
  });
15
15
  });
@@ -54,4 +54,5 @@ export const IN_APP_MESSAGING_TEST_ID = {
54
54
  IMAGE: 'in-app-messaging--image',
55
55
  PRIMARY_BUTTON: 'in-app-messaging--primary-button',
56
56
  SECONDARY_BUTTON: 'in-app-messaging--secondary-button',
57
+ CAROUSEL: 'in-app-messaging--carousel',
57
58
  };