Skip to content

Commit 30b79c6

Browse files
authored
Merge pull request #1686 from GetStream/develop
Next Release
2 parents b999b3d + 9a7cfa9 commit 30b79c6

File tree

3 files changed

+42
-10
lines changed

3 files changed

+42
-10
lines changed

docusaurus/docs/reactnative/guides/push_notifications_v2.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ Easiest way to integrate push notifications in your Chat applications is using F
2727

2828
:::note
2929

30-
- If you would like to get push notifications only when users are offline, please contact [email protected].
3130
- Push notifications require membership. Watching a channel isn't enough.
3231

3332
:::
@@ -463,6 +462,11 @@ notifee.onBackgroundEvent(async ({ detail, type }) => {
463462
464463
The `notification_template` is a JSON object that includes the keys relevant to push notifications for Android. See the [AndroidNotification](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#AndroidNotification) type in the firebase documentation for all the supported keys.
465464
465+
:::
466+
:::caution
467+
468+
We do not recommend doing this. If `notification_template` is added, then notifications will be shown in the foreground for Android. iOS will, by default, not show any notifications in the foreground. Generally, chat applications do not show push notifications in the foreground. This is why we do not recommend it. However, if you want foreground notifications in both platforms, please follow the steps mentioned in the [display-notification-in-foreground](#display-notification-in-foreground) section.
469+
466470
:::
467471
468472
### Show badge number on the iOS app

package/src/components/MessageInput/ImageUploadPreview.tsx

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
import React from 'react';
2-
import { FlatList, Image, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
2+
import {
3+
FlatList,
4+
Image,
5+
StyleSheet,
6+
Text,
7+
TouchableOpacity,
8+
TouchableOpacityProps,
9+
View,
10+
} from 'react-native';
311

412
import { UploadProgressIndicator } from './UploadProgressIndicator';
513

@@ -87,9 +95,8 @@ const ImageUploadPreviewWithContext = <
8795

8896
const {
8997
theme: {
90-
colors: { overlay, white },
9198
messageInput: {
92-
imageUploadPreview: { dismiss, flatList, itemContainer, upload },
99+
imageUploadPreview: { flatList, itemContainer, upload },
93100
},
94101
},
95102
} = useTheme();
@@ -140,15 +147,11 @@ const ImageUploadPreviewWithContext = <
140147
style={[styles.upload, upload]}
141148
/>
142149
</UploadProgressIndicator>
143-
<TouchableOpacity
150+
<DismissUpload
144151
onPress={() => {
145152
removeImage(item.id);
146153
}}
147-
style={[styles.dismiss, { backgroundColor: overlay }, dismiss]}
148-
testID='remove-image-upload-preview'
149-
>
150-
<Close pathFill={white} />
151-
</TouchableOpacity>
154+
/>
152155
<UnsupportedImageTypeIndicator indicatorType={indicatorType} />
153156
</View>
154157
);
@@ -170,6 +173,29 @@ const ImageUploadPreviewWithContext = <
170173
) : null;
171174
};
172175

176+
type DismissUploadProps = Pick<TouchableOpacityProps, 'onPress'>;
177+
178+
const DismissUpload = ({ onPress }: DismissUploadProps) => {
179+
const {
180+
theme: {
181+
colors: { overlay, white },
182+
messageInput: {
183+
imageUploadPreview: { dismiss, dismissIconColor },
184+
},
185+
},
186+
} = useTheme();
187+
188+
return (
189+
<TouchableOpacity
190+
onPress={onPress}
191+
style={[styles.dismiss, { backgroundColor: overlay }, dismiss]}
192+
testID='remove-image-upload-preview'
193+
>
194+
<Close pathFill={dismissIconColor || white} />
195+
</TouchableOpacity>
196+
);
197+
};
198+
173199
const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(
174200
prevProps: ImageUploadPreviewPropsWithContext<StreamChatGenerics>,
175201
nextProps: ImageUploadPreviewPropsWithContext<StreamChatGenerics>,

package/src/contexts/themeContext/utils/theme.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ export type Theme = {
267267
};
268268
imageUploadPreview: {
269269
dismiss: ViewStyle;
270+
dismissIconColor: Color;
270271
flatList: ViewStyle;
271272
itemContainer: ViewStyle;
272273
upload: ImageStyle;
@@ -766,6 +767,7 @@ export const defaultTheme: Theme = {
766767
},
767768
imageUploadPreview: {
768769
dismiss: {},
770+
dismissIconColor: '',
769771
flatList: {},
770772
itemContainer: {},
771773
upload: {},

0 commit comments

Comments
 (0)