Skip to content

Commit 8b03940

Browse files
Merge pull request #2242 from GetStream/develop
Next Release
2 parents 2b912c5 + a69d73f commit 8b03940

File tree

16 files changed

+124
-130
lines changed

16 files changed

+124
-130
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ Your co-operation is really-really appreciated in this manner. Thanks and happy
3333

3434
Describe your issue here
3535

36-
---
3736

3837
### Steps to reproduce
3938
Steps to reproduce the behavior:
@@ -44,14 +43,10 @@ Steps to reproduce the behavior:
4443
4. See error
4544
etc...
4645

47-
---
48-
49-
5046
### Expected behavior
5147

5248
<!-- A clear and concise description of what you expected to happen. -->
5349

54-
---
5550

5651
## Project Related Information
5752

@@ -76,17 +71,13 @@ Steps to reproduce the behavior:
7671
</p>
7772
</details>
7873

79-
---
80-
8174
### Offline support
8275

8376
<!--- Mark any options that apply below -->
8477

8578
- [ ] I have enabled offline support.
8679
- [ ] The feature I'm having does not occur when offline support is disabled. (stripe out if not applicable)
8780

88-
---
89-
9081
## Environment
9182

9283
<details><summary>Click To Expand</summary>
@@ -130,15 +121,10 @@ Steps to reproduce the behavior:
130121
<!-- For bonus points, if you put a 🔥 (:fire:) emojii at the start of the issue title we'll know -->
131122
<!-- that you took the time to fill this out correctly, or, at least read this far -->
132123

133-
---
134-
135-
136124
### Additional context
137125

138126
<!-- Add any other context about the problem here. -->
139127

140-
---
141-
142128
### Screenshots
143129

144130
<details><summary>Click To Expand</summary>

examples/TypeScriptMessaging/ios/TypeScriptMessaging.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,8 +500,12 @@
500500
);
501501
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
502502
PRODUCT_NAME = TypeScriptMessaging;
503+
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
504+
SUPPORTS_MACCATALYST = NO;
505+
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
503506
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
504507
SWIFT_VERSION = 5.0;
508+
TARGETED_DEVICE_FAMILY = "1,2";
505509
VERSIONING_SYSTEM = "apple-generic";
506510
};
507511
name = Debug;
@@ -526,7 +530,11 @@
526530
);
527531
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
528532
PRODUCT_NAME = TypeScriptMessaging;
533+
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
534+
SUPPORTS_MACCATALYST = NO;
535+
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
529536
SWIFT_VERSION = 5.0;
537+
TARGETED_DEVICE_FAMILY = "1,2";
530538
VERSIONING_SYSTEM = "apple-generic";
531539
};
532540
name = Release;

package/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"dayjs": "1.10.5",
7373
"file-loader": "6.2.0",
7474
"i18next": "20.2.4",
75-
"linkify-it": "^4.0.1",
75+
"linkifyjs": "^4.1.1",
7676
"lodash-es": "4.17.21",
7777
"metro-react-native-babel-preset": "0.66.2",
7878
"mime-types": "^2.1.34",

package/src/components/ChannelPreview/hooks/useLatestMessagePreview.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,11 @@ const getMentionUsers = <
6161
}
6262
return acc;
6363
}, '');
64-
return mentionUserString;
64+
65+
// escape special characters
66+
return mentionUserString.replaceAll(/[.*+?^${}()|[\]\\]/g, '\\$&');
6567
}
68+
6669
return '';
6770
};
6871

package/src/components/Message/MessageSimple/MessageReplies.tsx

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { ColorValue, Platform, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
2+
import { ColorValue, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
33

44
import {
55
MessageContextValue,
@@ -28,15 +28,9 @@ const styles = StyleSheet.create({
2828
},
2929
leftMessageRepliesCurve: {
3030
borderBottomLeftRadius: 16,
31-
borderRightColor: 'transparent',
32-
...Platform.select({
33-
android: {
34-
borderRightWidth: 0,
35-
},
36-
}),
31+
borderRightWidth: 0,
3732
},
3833
messageRepliesCurve: {
39-
borderTopColor: 'transparent',
4034
borderTopWidth: 0,
4135
borderWidth: 1,
4236
height: 16,
@@ -46,16 +40,11 @@ const styles = StyleSheet.create({
4640
fontSize: 12,
4741
fontWeight: '700',
4842
paddingBottom: 5,
49-
paddingLeft: 8,
43+
paddingHorizontal: 8,
5044
},
5145
rightMessageRepliesCurve: {
5246
borderBottomRightRadius: 16,
53-
borderLeftColor: 'transparent',
54-
...Platform.select({
55-
android: {
56-
borderLeftWidth: 0,
57-
},
58-
}),
47+
borderLeftWidth: 0,
5948
},
6049
});
6150

@@ -112,7 +101,7 @@ const MessageRepliesWithContext = <
112101
return (
113102
<View style={styles.curveContainer}>
114103
{alignment === 'left' && (
115-
<View testID='message-replies-left'>
104+
<View style={styles.curveContainer} testID='message-replies-left'>
116105
{!noBorder && (
117106
<View
118107
style={[
@@ -166,7 +155,7 @@ const MessageRepliesWithContext = <
166155
</Text>
167156
</TouchableOpacity>
168157
{alignment === 'right' && (
169-
<View testID='message-replies-right'>
158+
<View style={styles.curveContainer} testID='message-replies-right'>
170159
<MessageRepliesAvatars alignment={alignment} message={message} />
171160
{!noBorder && (
172161
<View

package/src/components/Message/MessageSimple/MessageRepliesAvatars.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const MessageRepliesAvatarsWithContext = <
5454
<View
5555
style={[
5656
styles.avatarContainer,
57-
alignment === 'right' ? { marginLeft: 8, ...rightAvatarsContainer } : leftAvatarsContainer,
57+
alignment === 'right' ? rightAvatarsContainer : leftAvatarsContainer,
5858
]}
5959
>
6060
{avatars.map((user, i) => (

package/src/components/Message/MessageSimple/ReactionList.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ const ReactionListWithContext = <
147147
}
148148

149149
const alignmentLeft = alignment === 'left';
150-
const fill = propFill || alignmentLeft ? grey_gainsboro : grey_whisper;
150+
const fill = propFill || (alignmentLeft ? grey_gainsboro : grey_whisper);
151151
const radius = propRadius || themeRadius;
152152
const reactionSize = propReactionSize || themeReactionSize;
153153
const highlighted = message.pinned || targetedMessage === message.id;
@@ -178,6 +178,7 @@ const ReactionListWithContext = <
178178

179179
return (
180180
<View
181+
pointerEvents='box-none'
181182
style={[
182183
styles.container,
183184
{
@@ -189,8 +190,8 @@ const ReactionListWithContext = <
189190
testID='reaction-list'
190191
>
191192
{reactions.length ? (
192-
<View style={[StyleSheet.absoluteFill]}>
193-
<Svg>
193+
<View pointerEvents='box-none' style={[StyleSheet.absoluteFill]}>
194+
<Svg pointerEvents='none'>
194195
<Circle cx={x1} cy={y1} fill={stroke} r={radius + strokeSize * 3} />
195196
<Circle cx={x2} cy={y2} fill={stroke} r={radius * 2 + strokeSize * 3} />
196197
<Circle cx={x1} cy={y1} fill={fill} r={radius + strokeSize} />
@@ -213,7 +214,7 @@ const ReactionListWithContext = <
213214
reactionBubbleBackground,
214215
]}
215216
/>
216-
<View style={[StyleSheet.absoluteFill]}>
217+
<View pointerEvents='none' style={[StyleSheet.absoluteFill]}>
217218
<Svg>
218219
<Circle cx={x2} cy={y2} fill={alignmentLeft ? fill : white} r={radius * 2} />
219220
</Svg>

package/src/components/Message/MessageSimple/__tests__/__snapshots__/MessageReplies.test.js.snap

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ exports[`MessageReplies should render message replies 1`] = `
99
}
1010
>
1111
<View
12+
style={
13+
Object {
14+
"flexDirection": "row",
15+
}
16+
}
1217
testID="message-replies-left"
1318
>
1419
<View
@@ -18,15 +23,14 @@ exports[`MessageReplies should render message replies 1`] = `
1823
"borderColor": undefined,
1924
},
2025
Object {
21-
"borderTopColor": "transparent",
2226
"borderTopWidth": 0,
2327
"borderWidth": 1,
2428
"height": 16,
2529
"width": 16,
2630
},
2731
Object {
2832
"borderBottomLeftRadius": 16,
29-
"borderRightColor": "transparent",
33+
"borderRightWidth": 0,
3034
},
3135
Object {},
3236
]
@@ -73,7 +77,7 @@ exports[`MessageReplies should render message replies 1`] = `
7377
"fontSize": 12,
7478
"fontWeight": "700",
7579
"paddingBottom": 5,
76-
"paddingLeft": 8,
80+
"paddingHorizontal": 8,
7781
},
7882
Object {
7983
"color": "#005FFF",

package/src/components/Message/MessageSimple/utils/parseLinks.test.ts

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ describe('parseLinksFromText', () => {
1414
'https://localhost/with/path?and=query#fragment',
1515
'https://localhost/with/path?and=query#fragment',
1616
],
17-
['reactnative.stream', undefined],
17+
['reactnative.dev', 'http://reactnative.dev'],
18+
['hinge.health/schedule-with-a-coach', 'http://hinge.health/schedule-with-a-coach'],
1819
[
1920
'https://zh.wikipedia.org/wiki/挪威牛油危機',
2021
'https://zh.wikipedia.org/wiki/%E6%8C%AA%E5%A8%81%E7%89%9B%E6%B2%B9%E5%8D%B1%E6%A9%9F',
@@ -87,29 +88,4 @@ describe('parseLinksFromText', () => {
8788
raw: input,
8889
});
8990
});
90-
it('doest not report invalid tlds as urls', () => {
91-
const input = `
92-
%
93-
% Not links
94-
%
95-
example.invalid
96-
example.invalid/
97-
http://.example.com
98-
http://-example.com
99-
hppt://example.com
100-
example.coma
101-
-example.coma
102-
`;
103-
const result = parseLinksFromText(input);
104-
expect(result).toHaveLength(0);
105-
});
106-
it('does not parse a decimal number as a URL', () => {
107-
const input = '123.456';
108-
const result = parseLinksFromText(input);
109-
expect(result).toHaveLength(0);
110-
});
111-
it.each([['@user'], ['@user.name']])('does not parse %p as a URL', (input) => {
112-
const result = parseLinksFromText(input);
113-
expect(result).toHaveLength(0);
114-
});
11591
});

package/src/components/Message/MessageSimple/utils/parseLinks.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Linkify from 'linkify-it';
1+
import { find } from 'linkifyjs';
22

33
interface LinkInfo {
44
encodedUrl: string;
@@ -23,13 +23,13 @@ export const parseLinksFromText = (input: string): LinkInfo[] => {
2323
input,
2424
);
2525

26-
const linkify = Linkify();
27-
const matches = linkify.match(strippedInput) ?? [];
26+
const links = find(strippedInput, 'url');
27+
const emails = find(strippedInput, 'email');
2828

29-
const result: LinkInfo[] = matches.map((match) => {
30-
const { raw, url } = match;
31-
return { encodedUrl: encodeURI(url), raw };
32-
});
29+
const result: LinkInfo[] = [...links, ...emails].map(({ href, value }) => ({
30+
encodedUrl: encodeURI(href),
31+
raw: value,
32+
}));
3333

3434
return result;
3535
};

0 commit comments

Comments
 (0)