Skip to content

Commit af2729b

Browse files
Merge pull request #972 from GetStream/develop
Next Release
2 parents 340f338 + 828c4e3 commit af2729b

File tree

9 files changed

+76
-167
lines changed

9 files changed

+76
-167
lines changed

.github/workflows/e2e-native-android.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

.github/workflows/e2e-native-ios.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/workflows/e2e-sample-android.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

.github/workflows/e2e-sample-ios.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

examples/SampleApp/android/app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,11 @@ dependencies {
197197
implementation platform('com.google.firebase:firebase-bom:25.12.0')
198198

199199
// For animated GIF support
200-
implementation 'com.facebook.fresco:animated-gif:2.0.0'
200+
implementation 'com.facebook.fresco:animated-gif:2.6.0'
201201

202202
// For WebP support, including animated WebP
203-
implementation 'com.facebook.fresco:animated-webp:2.1.0'
204-
implementation 'com.facebook.fresco:webpsupport:2.0.0'
203+
implementation 'com.facebook.fresco:animated-webp:2.6.0'
204+
implementation 'com.facebook.fresco:webpsupport:2.6.0'
205205

206206
implementation 'com.google.firebase:firebase-crashlytics'
207207
implementation 'com.google.firebase:firebase-analytics'

examples/TypeScriptMessaging/android/app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,11 @@ dependencies {
189189
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
190190

191191
// For animated GIF support
192-
implementation 'com.facebook.fresco:animated-gif:2.0.0'
192+
implementation 'com.facebook.fresco:animated-gif:2.6.0'
193193

194194
// For WebP support, including animated WebP
195-
implementation 'com.facebook.fresco:animated-webp:2.1.0'
196-
implementation 'com.facebook.fresco:webpsupport:2.0.0'
195+
implementation 'com.facebook.fresco:animated-webp:2.6.0'
196+
implementation 'com.facebook.fresco:webpsupport:2.6.0'
197197

198198
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
199199
exclude group:'com.facebook.fbjni'

package/src/components/ChannelList/Skeleton.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export const Skeleton: React.FC = () => {
4141
gradientStart,
4242
gradientStop,
4343
height = 64,
44+
maskFillColor,
4445
},
4546
colors: { border, grey_gainsboro, white_snow },
4647
},
@@ -138,7 +139,7 @@ export const Skeleton: React.FC = () => {
138139
</Svg>
139140
</Animated.View>
140141
<Svg height={height} width={width}>
141-
<Path d={d.value} fill={white_snow} />
142+
<Path d={d.value} fill={maskFillColor || white_snow} />
142143
</Svg>
143144
</View>
144145
);

package/src/components/Message/MessageSimple/utils/renderText.tsx

Lines changed: 66 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { GestureResponderEvent, Linking, Text } from 'react-native';
2+
import { GestureResponderEvent, Linking, Text, View } from 'react-native';
33
import anchorme from 'anchorme';
44
import truncate from 'lodash/truncate';
55
// @ts-expect-error
@@ -11,6 +11,7 @@ import {
1111
ParseFunction,
1212
parseInline,
1313
ReactNodeOutput,
14+
SingleASTNode,
1415
} from 'simple-markdown';
1516

1617
import type { MessageType } from '../../../MessageList/hooks/useMessageList';
@@ -38,9 +39,15 @@ const defaultMarkdownStyles: MarkdownStyle = {
3839
marginBottom: 8,
3940
marginTop: 8,
4041
},
42+
listItemNumber: {
43+
fontWeight: 'bold',
44+
},
4145
listItemText: {
4246
flex: 0,
4347
},
48+
listRow: {
49+
flexDirection: 'row',
50+
},
4451
mentions: {
4552
fontWeight: '700',
4653
},
@@ -182,20 +189,17 @@ export const renderText = <
182189
}
183190
};
184191

185-
state.withinLink = true;
186-
const link = React.createElement(
187-
Text,
188-
{
189-
key: state.key,
190-
onLongPress,
191-
onPress,
192-
style: styles.autolink,
193-
suppressHighlighting: true,
194-
},
195-
output(node.content, state),
192+
return (
193+
<Text
194+
key={state.key}
195+
onLongPress={onLongPress}
196+
onPress={onPress}
197+
style={styles.autolink}
198+
suppressHighlighting={true}
199+
>
200+
{output(node.content, { ...state, withinLink: true })}
201+
</Text>
196202
);
197-
state.withinLink = false;
198-
return link;
199203
};
200204

201205
const mentionedUsers = Array.isArray(mentioned_users)
@@ -230,22 +234,61 @@ export const renderText = <
230234
}
231235
};
232236

233-
return React.createElement(
234-
Text,
235-
{
236-
key: state.key,
237-
onLongPress,
238-
onPress,
239-
style: styles.mentions,
240-
},
241-
Array.isArray(node.content) ? node.content[0]?.content || '' : output(node.content, state),
237+
return (
238+
<Text key={state.key} onLongPress={onLongPress} onPress={onPress} style={styles.mentions}>
239+
{Array.isArray(node.content) ? node.content[0].content || '' : output(node.content, state)}
240+
</Text>
242241
);
243242
};
244243

244+
const listLevels = {
245+
sub: 'sub',
246+
top: 'top',
247+
};
248+
249+
/**
250+
* For lists and sublists, the default behavior of the markdown library we use is
251+
* to always renumber any list, so all ordered lists start from 1.
252+
*
253+
* This custom rule overrides this behavior both for top level lists and sublists,
254+
* in order to start the numbering from the number of the first list item provided.
255+
* */
256+
const customListAtLevel =
257+
(level: keyof typeof listLevels): ReactNodeOutput =>
258+
(node, output, { ...state }) => {
259+
const items = node.items.map((item: Array<SingleASTNode>, index: number) => {
260+
const withinList = item.length > 1 && item[1].type === 'list';
261+
const content = output(item, { ...state, withinList });
262+
263+
const isTopLevelText =
264+
['text', 'paragraph', 'strong'].includes(item[0].type) && withinList === false;
265+
266+
return (
267+
<View key={index} style={styles.listRow}>
268+
<Text style={styles.listItemNumber}>
269+
{node.ordered ? `${node.start + index}. ` : `\u2022`}
270+
</Text>
271+
<Text style={[styles.listItemText, isTopLevelText && { marginBottom: 0 }]}>
272+
{content}
273+
</Text>
274+
</View>
275+
);
276+
});
277+
278+
const isSublist = level === 'sub';
279+
return (
280+
<View key={state.key} style={[isSublist ? styles.list : styles.sublist]}>
281+
{items}
282+
</View>
283+
);
284+
};
285+
245286
const customRules = {
246287
link: { react },
288+
list: { react: customListAtLevel('top') },
247289
// we have no react rendering support for reflinks
248290
reflink: { match: () => null },
291+
sublist: { react: customListAtLevel('sub') },
249292
...(mentionedUsers
250293
? {
251294
mentions: {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { vh } from '../../../utils/utils';
22

33
import type { ImageStyle, TextStyle, ViewStyle } from 'react-native';
4-
import type { CircleProps, StopProps } from 'react-native-svg';
4+
import type { CircleProps, Color, StopProps } from 'react-native-svg';
55

66
import type { IconProps } from '../../../icons/utils/base';
77

@@ -124,6 +124,7 @@ export type Theme = {
124124
gradientStart: StopProps;
125125
gradientStop: StopProps;
126126
height: number;
127+
maskFillColor?: Color;
127128
};
128129
channelPreview: {
129130
checkAllIcon: IconProps;

0 commit comments

Comments
 (0)