Skip to content
This repository was archived by the owner on Nov 13, 2024. It is now read-only.

Commit 6447a8e

Browse files
authored
Merge pull request #127 from pubnub/CSK-316-remove-android-hack
fix(lib): remove inverted flatlist fix for android
2 parents c7a4eab + 8928b34 commit 6447a8e

File tree

12 files changed

+484
-1032
lines changed

12 files changed

+484
-1032
lines changed

.github/workflows/run-tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ defaults:
1717
jobs:
1818
tests:
1919
name: Run builtin test cases
20-
runs-on: ubuntu-latest
20+
runs-on: macos-13
2121
steps:
2222
- name: Checkout repository
2323
uses: actions/checkout@v3

.pubnub.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
---
22
name: pubnub-react-chat-components
3-
version: v0.31.0
3+
version: v0.32.0
44
scm: github.com/pubnub/react-chat-components
55
schema: 1
66
files:
77
- lib/dist/index.js
88
- lib/dist/index.es.js
99
changelog:
10+
- date: 2023-10-05
11+
version: v0.32.0
12+
changes:
13+
- type: bug
14+
text: "ReactNative - remove the workaround for poor performance of inverted FlatList in Android ."
1015
- date: 2023-10-04
1116
version: v0.31.0
1217
changes:

load-tests/react-native/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"expo-status-bar": "~1.4.2",
1616
"react": "18.2.0",
1717
"@pubnub/tomato": "1.7.0",
18-
"react-native": "0.71.6",
18+
"react-native": "0.72.4",
1919
"react-native-safe-area-context": "4.5.0",
2020
"react-native-screens": "~3.20.0"
2121
},

packages/common/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pubnub/common-chat-components",
3-
"version": "0.31.0",
3+
"version": "0.32.0",
44
"main": "src/index.ts",
55
"license": "MIT",
66
"scripts": {

packages/react-native/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pubnub/react-native-chat-components",
3-
"version": "0.31.0",
3+
"version": "0.32.0",
44
"description": "PubNub Chat Components is a development kit of React Native components that aims to help you to easily build Chat applications using PubNub infrastructure. It removes the complexicity of picking an adequate Chat engine, learning its APIs and dealing with its low-level internals. As the same time it allows you to create apps of various use cases, with different functionalities and customizable looks.",
55
"author": "PubNub <[email protected]>",
66
"main": "dist/commonjs/index",
@@ -59,7 +59,7 @@
5959
"pubnub-react": "3.0.1",
6060
"react": "18.2.0",
6161
"react-dom": "18.2.0",
62-
"react-native": "0.71.6",
62+
"react-native": "0.72.4",
6363
"react-test-renderer": "18.2.0",
6464
"rollup": "2.79.0",
6565
"rollup-plugin-peer-deps-external": "2.2.4",
@@ -70,7 +70,7 @@
7070
"pubnub": ">=4.29.9",
7171
"pubnub-react": ">=2.1.0",
7272
"react": ">=16.8.0",
73-
"react-native": ">=0.69.0"
73+
"react-native": ">=0.72.4"
7474
},
7575
"dependencies": {
7676
"expo-document-picker": "11.2.2",

packages/react-native/src/message-list/android-hack-workaround.native.ts

-6
This file was deleted.

packages/react-native/src/message-list/android-hack-workaround.ts

-1
This file was deleted.

packages/react-native/src/message-list/message-list.tsx

+3-11
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
ListRenderItem,
1616
NativeScrollEvent,
1717
NativeSyntheticEvent,
18-
Platform,
1918
Pressable,
2019
StyleSheet,
2120
Text,
@@ -36,9 +35,6 @@ import { EmojiPickerElementProps } from "../types";
3635
import { useStyle, useRotation } from "../helpers";
3736
import SpinnerIcon from "../icons/spinner.png";
3837
import { RemoteFile } from "./remote-file";
39-
import { doAndroidHackWorkaround } from "./android-hack-workaround";
40-
41-
doAndroidHackWorkaround();
4238

4339
export type MessageListProps = CommonMessageListProps & {
4440
/** Option to pass in a component that will be used for picking message reactions. For more details, refer to the Message Reactions section in the docs. */
@@ -92,7 +88,6 @@ export const MessageList: FC<MessageListProps> = (props: MessageListProps) => {
9288
const [spinnerShown, setSpinnerShown] = useState(false);
9389
const [sheetPosition] = useState(new Animated.Value(0));
9490
const shouldShownSpinner = props.fetchMessages && !paginationEnd;
95-
const isAndroid = Platform.OS === "android";
9691

9792
const rotate = useRotation(shouldShownSpinner && spinnerShown);
9893
const listRef = useRef<FlatList>(null);
@@ -178,8 +173,7 @@ export const MessageList: FC<MessageListProps> = (props: MessageListProps) => {
178173
const renderItem: ListRenderItem<MessageEnvelope> = ({ item }) => {
179174
const envelope = item;
180175
if (envelope.timetoken === "spinner-element") return renderSpinner();
181-
if (envelope.timetoken === "children-element")
182-
return <View style={isAndroid && { scaleY: -1 }}>{props.children}</View>;
176+
if (envelope.timetoken === "children-element") return <View>{props.children}</View>;
183177
const uuid = envelope.uuid || envelope.publisher || "";
184178
const actions = envelope.actions;
185179
const deleted = !!Object.keys(actions?.deleted || {}).length;
@@ -193,7 +187,6 @@ export const MessageList: FC<MessageListProps> = (props: MessageListProps) => {
193187
style.message,
194188
props.enableReactions && pressed && style.messagePressed,
195189
isOwn && style.messageOwn,
196-
isAndroid && { scaleY: -1 },
197190
]}
198191
onLongPress={() => handleOpenReactions(envelope.timetoken)}
199192
>
@@ -315,7 +308,7 @@ export const MessageList: FC<MessageListProps> = (props: MessageListProps) => {
315308
)}
316309
<FlatList
317310
testID="message-list"
318-
style={[style.messageList, isAndroid && { scaleY: -1 }]}
311+
style={style.messageList}
319312
contentContainerStyle={style.messageListScroller}
320313
data={[
321314
{ timetoken: "children-element", message: { id: "children-element" } },
@@ -327,8 +320,7 @@ export const MessageList: FC<MessageListProps> = (props: MessageListProps) => {
327320
ref={listRef}
328321
onEndReached={() => fetchHistory()}
329322
onScroll={handleScroll}
330-
// Workaround for: https://github.com/facebook/react-native/issues/30034
331-
inverted={!isAndroid}
323+
inverted={true}
332324
onViewableItemsChanged={onViewableItemsChanged}
333325
/>
334326
{props.reactionsPicker &&

packages/react/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pubnub/react-chat-components",
3-
"version": "0.31.0",
3+
"version": "0.32.0",
44
"description": "PubNub Chat Components is a development kit of React components that aims to help you to easily build Chat applications using PubNub infrastructure. It removes the complexicity of picking an adequate Chat engine, learning its APIs and dealing with its low-level internals. As the same time it allows you to create apps of various use cases, with different functionalities and customizable looks.",
55
"author": "PubNub <[email protected]>",
66
"main": "dist/index.js",

samples/react-native/getting-started/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"pubnub": "7.2.0",
1717
"pubnub-react": "3.0.1",
1818
"react": "18.2.0",
19-
"react-native": "0.71.6",
19+
"react-native": "0.72.4",
2020
"react-native-safe-area-context": "4.5.0"
2121
},
2222
"devDependencies": {

samples/react-native/mobile-chat/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"pubnub-react": "3.0.1",
2727
"react": "18.2.0",
2828
"react-dom": "18.2.0",
29-
"react-native": "0.71.6",
29+
"react-native": "0.72.4",
3030
"react-native-emoji-selector": "^0.2.0",
3131
"react-native-safe-area-context": "4.5.0",
3232
"react-native-screens": "~3.20.0",

0 commit comments

Comments
 (0)