@amazon-devices/shopify__react-native-performance-lists-profiler 1.1.1758683737
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.
- package/LICENSE +7 -0
- package/README.kepler.md +331 -0
- package/README.md +7 -0
- package/ReactNativePerformanceListsProfiler.podspec +30 -0
- package/SystemBundles/1b881d5412b1fc3466fe9ebb1f1c33915d19056d122263f1ba0356a8c71c31ca.bundle +10666 -0
- package/SystemBundles/1b881d5412b1fc3466fe9ebb1f1c33915d19056d122263f1ba0356a8c71c31ca.map +1 -0
- package/SystemModules/amzn__shopify__react-native-performance-lists-profiler-1.modules.txt +26 -0
- package/SystemModules/amzn__shopify__react-native-performance-lists-profiler-1.private.modules.txt +96 -0
- package/SystemModules/keplerscript-system-bundle-config.json +7 -0
- package/THIRD_PARTY_NOTICES.txt +472 -0
- package/android/build.gradle +59 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/kotlin/com/shopify/reactnativeperformancelistsprofiler/BlankAreaView.kt +150 -0
- package/android/src/main/kotlin/com/shopify/reactnativeperformancelistsprofiler/FlashListPerformanceViewManager.kt +49 -0
- package/android/src/main/kotlin/com/shopify/reactnativeperformancelistsprofiler/FlatListPerformanceViewManager.kt +47 -0
- package/android/src/main/kotlin/com/shopify/reactnativeperformancelistsprofiler/ReactNativePerformanceListsProfilerPackage.kt +19 -0
- package/dist/FlashListPerformanceView.d.ts +14 -0
- package/dist/FlashListPerformanceView.d.ts.map +1 -0
- package/dist/FlashListPerformanceView.js +33 -0
- package/dist/FlashListPerformanceView.js.map +1 -0
- package/dist/FlashListPerformanceView.types.d.ts +21 -0
- package/dist/FlashListPerformanceView.types.d.ts.map +1 -0
- package/dist/FlashListPerformanceView.types.js +3 -0
- package/dist/FlashListPerformanceView.types.js.map +1 -0
- package/dist/FlashListPerformanceViewNativeComponent.d.ts +4 -0
- package/dist/FlashListPerformanceViewNativeComponent.d.ts.map +1 -0
- package/dist/FlashListPerformanceViewNativeComponent.js +7 -0
- package/dist/FlashListPerformanceViewNativeComponent.js.map +1 -0
- package/dist/FlashListPerformanceViewNativeComponent.kepler.d.ts +5 -0
- package/dist/FlashListPerformanceViewNativeComponent.kepler.d.ts.map +1 -0
- package/dist/FlashListPerformanceViewNativeComponent.kepler.js +35 -0
- package/dist/FlashListPerformanceViewNativeComponent.kepler.js.map +1 -0
- package/dist/FlatListPerformanceView.d.ts +15 -0
- package/dist/FlatListPerformanceView.d.ts.map +1 -0
- package/dist/FlatListPerformanceView.js +38 -0
- package/dist/FlatListPerformanceView.js.map +1 -0
- package/dist/FlatListPerformanceView.types.d.ts +19 -0
- package/dist/FlatListPerformanceView.types.d.ts.map +1 -0
- package/dist/FlatListPerformanceView.types.js +10 -0
- package/dist/FlatListPerformanceView.types.js.map +1 -0
- package/dist/FlatListPerformanceViewNativeComponent.d.ts +4 -0
- package/dist/FlatListPerformanceViewNativeComponent.d.ts.map +1 -0
- package/dist/FlatListPerformanceViewNativeComponent.js +7 -0
- package/dist/FlatListPerformanceViewNativeComponent.js.map +1 -0
- package/dist/FlatListPerformanceViewNativeComponent.kepler.d.ts +5 -0
- package/dist/FlatListPerformanceViewNativeComponent.kepler.d.ts.map +1 -0
- package/dist/FlatListPerformanceViewNativeComponent.kepler.js +35 -0
- package/dist/FlatListPerformanceViewNativeComponent.kepler.js.map +1 -0
- package/dist/ListsProfiler.d.ts +9 -0
- package/dist/ListsProfiler.d.ts.map +1 -0
- package/dist/ListsProfiler.js +54 -0
- package/dist/ListsProfiler.js.map +1 -0
- package/dist/ListsProfilerContext.d.ts +9 -0
- package/dist/ListsProfilerContext.d.ts.map +1 -0
- package/dist/ListsProfilerContext.js +11 -0
- package/dist/ListsProfilerContext.js.map +1 -0
- package/dist/ListsProfilerModule.d.ts +6 -0
- package/dist/ListsProfilerModule.d.ts.map +1 -0
- package/dist/ListsProfilerModule.js +14 -0
- package/dist/ListsProfilerModule.js.map +1 -0
- package/dist/ListsProfilerProps.d.ts +19 -0
- package/dist/ListsProfilerProps.d.ts.map +1 -0
- package/dist/ListsProfilerProps.js +3 -0
- package/dist/ListsProfilerProps.js.map +1 -0
- package/dist/__tests__/FlashListPerformanceView.test.d.ts +2 -0
- package/dist/__tests__/FlashListPerformanceView.test.d.ts.map +1 -0
- package/dist/__tests__/FlashListPerformanceView.test.js +53 -0
- package/dist/__tests__/FlashListPerformanceView.test.js.map +1 -0
- package/dist/__tests__/FlatListPerformanceView.test.d.ts +2 -0
- package/dist/__tests__/FlatListPerformanceView.test.d.ts.map +1 -0
- package/dist/__tests__/FlatListPerformanceView.test.js +59 -0
- package/dist/__tests__/FlatListPerformanceView.test.js.map +1 -0
- package/dist/__tests__/ListProfiler.test.d.ts +2 -0
- package/dist/__tests__/ListProfiler.test.d.ts.map +1 -0
- package/dist/__tests__/ListProfiler.test.js +53 -0
- package/dist/__tests__/ListProfiler.test.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/ios/ReactNativePerformanceListsProfiler.xcodeproj/project.pbxproj +3 -0
- package/ios/Sources/BlankAreaView.swift +111 -0
- package/ios/Sources/FlashListPerformanceViewManager.m +9 -0
- package/ios/Sources/FlashListPerformanceViewManager.swift +23 -0
- package/ios/Sources/FlatListPerformanceViewManager.m +9 -0
- package/ios/Sources/FlatListPerformanceViewManager.swift +18 -0
- package/ios/Sources/ReactNativePerfomanceListsProfilerUmbrella.h +8 -0
- package/ios/Tests/ReactNativePerformanceListsProfilerTests.swift +5 -0
- package/kepler-compatibility.json +8 -0
- package/kepler-transformed-package-info.json +3 -0
- package/package.json +1 -0
- package/src/FlashListPerformanceView.tsx +44 -0
- package/src/FlashListPerformanceView.types.ts +23 -0
- package/src/FlashListPerformanceViewNativeComponent.kepler.ts +38 -0
- package/src/FlashListPerformanceViewNativeComponent.ts +7 -0
- package/src/FlatListPerformanceView.tsx +61 -0
- package/src/FlatListPerformanceView.types.ts +28 -0
- package/src/FlatListPerformanceViewNativeComponent.kepler.tsx +38 -0
- package/src/FlatListPerformanceViewNativeComponent.tsx +7 -0
- package/src/ListsProfiler.tsx +67 -0
- package/src/ListsProfilerContext.tsx +13 -0
- package/src/ListsProfilerModule.ts +25 -0
- package/src/ListsProfilerProps.ts +18 -0
- package/src/__tests__/FlashListPerformanceView.test.tsx +71 -0
- package/src/__tests__/FlatListPerformanceView.test.tsx +77 -0
- package/src/__tests__/ListProfiler.test.tsx +60 -0
- package/src/__tests__/setupJest.js +5 -0
- package/src/index.ts +3 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2025 Amazon.com, Inc. or its affiliates. All rights reserved.
|
|
2
|
+
|
|
3
|
+
These materials are licensed as "Program Materials" under the Program Materials License Agreement (the "Agreement"). The Agreement is available at https://developer.amazon.com/support/legal/pml. See the Agreement for the specific terms and conditions of the Agreement. Capitalized terms not defined in this file have the meanings given to them in the Agreement.
|
|
4
|
+
|
|
5
|
+
If you do not agree to the above terms and conditions, you may not use any file in this package.
|
|
6
|
+
|
|
7
|
+
YOUR USE OF THE PROGRAM MATERIALS IN OR ASSOCIATED WITH THIS PACKAGE IS AT YOUR SOLE RISK. IN NO EVENT WILL AMAZON BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION ANY DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL, INCIDENTAL, OR PUNITIVE DAMAGES (INCLUDING FOR ANY LOSS OF GOODWILL, BUSINESS INTERRUPTION, LOST PROFITS OR DATA, OR COMPUTER FAILURE OR MALFUNCTION) ARISING FROM OR RELATING TO SUCH PROGRAM MATERIALS, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, EVEN IF AMAZON HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS AND DISCLAIMERS APPLY EXCEPT TO THE EXTENT PROHIBITED BY APPLICABLE LAW.
|
package/README.kepler.md
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
# @amazon-devices/shopify__react-native-performance-lists-profiler
|
|
2
|
+
|
|
3
|
+
## Getting Started
|
|
4
|
+
|
|
5
|
+
`@amazon-devices/shopify__react-native-performance-lists-profiler` is an extension library atop [@shopify/react-native-performance-navigation](../react-native-performance-navigation/getting-started) that provides utilities for profiling the `FlatList` and `FlashList` components.
|
|
6
|
+
|
|
7
|
+
### Installation
|
|
8
|
+
|
|
9
|
+
1. Add the JavaScript library dependency in the `package.json` file:
|
|
10
|
+
```json
|
|
11
|
+
"dependencies": {
|
|
12
|
+
...
|
|
13
|
+
"@amazon-devices/react-navigation__native": "^7.0.0",
|
|
14
|
+
"@amazon-devices/react-navigation__stack": "^7.0.0",
|
|
15
|
+
"@amazon-devices/shopify__flash-list": "^2.0.0",
|
|
16
|
+
"@shopify/react-native-performance-lists-profiler": "npm:@amazon-devices/shopify__react-native-performance-lists-profiler@^1.1.0",
|
|
17
|
+
"@amazon-devices/keplerscript-turbomodule-api": "^1.0.0"
|
|
18
|
+
},
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
2. Reinstall dependencies using `npm install` command.
|
|
22
|
+
|
|
23
|
+
## Usage Examples
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
import React, {
|
|
27
|
+
createContext,
|
|
28
|
+
ReactNode,
|
|
29
|
+
useCallback,
|
|
30
|
+
useContext,
|
|
31
|
+
useState,
|
|
32
|
+
} from 'react';
|
|
33
|
+
import {
|
|
34
|
+
Button,
|
|
35
|
+
FlatList,
|
|
36
|
+
ListRenderItem,
|
|
37
|
+
StyleSheet,
|
|
38
|
+
Text,
|
|
39
|
+
TouchableOpacity,
|
|
40
|
+
View,
|
|
41
|
+
} from 'react-native';
|
|
42
|
+
import { NavigationContainer } from '@amazon-devices/react-navigation__native';
|
|
43
|
+
import {
|
|
44
|
+
createStackNavigator,
|
|
45
|
+
StackScreenProps,
|
|
46
|
+
} from '@amazon-devices/react-navigation__stack';
|
|
47
|
+
import {
|
|
48
|
+
FlashListPerformanceView,
|
|
49
|
+
FlatListPerformanceView,
|
|
50
|
+
ListsProfiler,
|
|
51
|
+
} from '@shopify/react-native-performance-lists-profiler';
|
|
52
|
+
import {
|
|
53
|
+
FlashList,
|
|
54
|
+
ListRenderItem as FlashListRenderItem,
|
|
55
|
+
} from '@amazon-devices/shopify__flash-list';
|
|
56
|
+
|
|
57
|
+
interface BlankArea {
|
|
58
|
+
start: number;
|
|
59
|
+
end: number;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface ListsProfilerContextType {
|
|
63
|
+
listName: string;
|
|
64
|
+
tti: number | undefined;
|
|
65
|
+
blankArea: BlankArea | undefined;
|
|
66
|
+
resetContext: () => void;
|
|
67
|
+
onInteractive: (tti: number, listName: string) => void;
|
|
68
|
+
onBlankArea: (start: number, end: number, listName: string) => void;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const ListsProfilerContext = createContext<ListsProfilerContextType | null>(
|
|
72
|
+
null,
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
interface ListsProfilerContextProviderProps {
|
|
76
|
+
children: ReactNode;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const ListsProfilerContextProvider = ({
|
|
80
|
+
children,
|
|
81
|
+
}: ListsProfilerContextProviderProps) => {
|
|
82
|
+
const [listName, setListName] = useState('');
|
|
83
|
+
const [tti, setTti] = useState<number>();
|
|
84
|
+
const [blankArea, setBlankArea] = useState<BlankArea>();
|
|
85
|
+
|
|
86
|
+
const resetContext = useCallback(() => {
|
|
87
|
+
setListName('');
|
|
88
|
+
setTti(undefined);
|
|
89
|
+
setBlankArea(undefined);
|
|
90
|
+
}, []);
|
|
91
|
+
|
|
92
|
+
const onInteractive = useCallback((tti: number, listName: string) => {
|
|
93
|
+
setTti(tti);
|
|
94
|
+
setListName(listName);
|
|
95
|
+
}, []);
|
|
96
|
+
|
|
97
|
+
const onBlankArea = useCallback(
|
|
98
|
+
(start: number, end: number, listName: string) => {
|
|
99
|
+
setBlankArea({ start, end });
|
|
100
|
+
setListName(listName);
|
|
101
|
+
},
|
|
102
|
+
[],
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<ListsProfilerContext.Provider
|
|
107
|
+
value={{
|
|
108
|
+
listName,
|
|
109
|
+
tti,
|
|
110
|
+
blankArea,
|
|
111
|
+
resetContext,
|
|
112
|
+
onInteractive,
|
|
113
|
+
onBlankArea,
|
|
114
|
+
}}
|
|
115
|
+
>
|
|
116
|
+
{children}
|
|
117
|
+
</ListsProfilerContext.Provider>
|
|
118
|
+
);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
type StackParamList = {
|
|
122
|
+
FlashListScreen: undefined;
|
|
123
|
+
FlatListScreen: undefined;
|
|
124
|
+
HomeScreen: undefined;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const Stack = createStackNavigator<StackParamList>();
|
|
128
|
+
|
|
129
|
+
const NavigationTree = () => {
|
|
130
|
+
const { onInteractive, onBlankArea } = useContext(
|
|
131
|
+
ListsProfilerContext,
|
|
132
|
+
) as ListsProfilerContextType;
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<ListsProfiler onInteractive={onInteractive} onBlankArea={onBlankArea}>
|
|
136
|
+
<NavigationContainer>
|
|
137
|
+
<Stack.Navigator initialRouteName="HomeScreen">
|
|
138
|
+
<Stack.Screen
|
|
139
|
+
name="HomeScreen"
|
|
140
|
+
component={HomeScreen}
|
|
141
|
+
options={{ headerShown: false }}
|
|
142
|
+
/>
|
|
143
|
+
<Stack.Screen name="FlatListScreen" component={FlatListScreen} />
|
|
144
|
+
<Stack.Screen name="FlashListScreen" component={FlashListScreen} />
|
|
145
|
+
</Stack.Navigator>
|
|
146
|
+
</NavigationContainer>
|
|
147
|
+
</ListsProfiler>
|
|
148
|
+
);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const HomeScreen = ({
|
|
152
|
+
navigation,
|
|
153
|
+
}: StackScreenProps<StackParamList, 'HomeScreen'>) => {
|
|
154
|
+
const { resetContext } = useContext(
|
|
155
|
+
ListsProfilerContext,
|
|
156
|
+
) as ListsProfilerContextType;
|
|
157
|
+
|
|
158
|
+
const onNavigate =
|
|
159
|
+
(screenName: 'FlatListScreen' | 'FlashListScreen') => () => {
|
|
160
|
+
resetContext();
|
|
161
|
+
navigation.navigate(screenName);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<View style={styles.container}>
|
|
166
|
+
<Text style={styles.text}>FlatList Example</Text>
|
|
167
|
+
<Button title="FlatListScreen" onPress={onNavigate('FlatListScreen')} />
|
|
168
|
+
<Text style={styles.text}>FlashList Example</Text>
|
|
169
|
+
<Button title="FlashListScreen" onPress={onNavigate('FlashListScreen')} />
|
|
170
|
+
</View>
|
|
171
|
+
);
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export interface Item {
|
|
175
|
+
bgColor: string;
|
|
176
|
+
title: string;
|
|
177
|
+
height: number;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const listData = Array.from({ length: 1000 }, (_, i) => ({
|
|
181
|
+
title: `Item ${i + 1}`,
|
|
182
|
+
bgColor: `#${Math.floor(Math.random() * 16777215).toString(16)}`,
|
|
183
|
+
height: Math.floor(Math.random() * (140 - 60) + 60),
|
|
184
|
+
}));
|
|
185
|
+
|
|
186
|
+
interface ListItemProps {
|
|
187
|
+
item: Item;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const ListItem = ({ item }: ListItemProps) => {
|
|
191
|
+
return (
|
|
192
|
+
<TouchableOpacity
|
|
193
|
+
style={{ backgroundColor: item.bgColor, height: item.height }}
|
|
194
|
+
>
|
|
195
|
+
<Text style={styles.itemText}>{item.title}</Text>
|
|
196
|
+
</TouchableOpacity>
|
|
197
|
+
);
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
const DataDisplay = () => {
|
|
201
|
+
const { listName, tti, blankArea } = useContext(
|
|
202
|
+
ListsProfilerContext,
|
|
203
|
+
) as ListsProfilerContextType;
|
|
204
|
+
|
|
205
|
+
return (
|
|
206
|
+
<View style={styles.display}>
|
|
207
|
+
<Text style={styles.text}>List name: {listName}</Text>
|
|
208
|
+
<View style={styles.spacer} />
|
|
209
|
+
<Text style={styles.text}>TTI: {tti ?? 'n/a'}</Text>
|
|
210
|
+
<View style={styles.spacer} />
|
|
211
|
+
<Text style={styles.text}>
|
|
212
|
+
Blank area:{' '}
|
|
213
|
+
{blankArea ? JSON.stringify(blankArea, undefined, 0) : 'n/a'}
|
|
214
|
+
</Text>
|
|
215
|
+
</View>
|
|
216
|
+
);
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
const FlatListScreen = () => {
|
|
220
|
+
const renderItem: ListRenderItem<Item> = useCallback(
|
|
221
|
+
({ item }) => <ListItem item={item} />,
|
|
222
|
+
[],
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
return (
|
|
226
|
+
<View style={styles.listContainer}>
|
|
227
|
+
<DataDisplay />
|
|
228
|
+
<FlatListPerformanceView listName="flatlist">
|
|
229
|
+
<FlatList data={listData} renderItem={renderItem} />
|
|
230
|
+
</FlatListPerformanceView>
|
|
231
|
+
</View>
|
|
232
|
+
);
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
const FlashListScreen = () => {
|
|
236
|
+
const renderItem: FlashListRenderItem<Item> = useCallback(
|
|
237
|
+
({ item }) => <ListItem item={item} />,
|
|
238
|
+
[],
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
return (
|
|
242
|
+
<View style={styles.listContainer}>
|
|
243
|
+
<DataDisplay />
|
|
244
|
+
<FlashListPerformanceView listName="flashlist">
|
|
245
|
+
<FlashList data={listData} renderItem={renderItem} />
|
|
246
|
+
</FlashListPerformanceView>
|
|
247
|
+
</View>
|
|
248
|
+
);
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
export const App = () => {
|
|
252
|
+
return (
|
|
253
|
+
<ListsProfilerContextProvider>
|
|
254
|
+
<NavigationTree />
|
|
255
|
+
</ListsProfilerContextProvider>
|
|
256
|
+
);
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
const styles = StyleSheet.create({
|
|
260
|
+
container: {
|
|
261
|
+
backgroundColor: '#fff',
|
|
262
|
+
flex: 1,
|
|
263
|
+
alignItems: 'center',
|
|
264
|
+
justifyContent: 'center',
|
|
265
|
+
},
|
|
266
|
+
display: {
|
|
267
|
+
flexDirection: 'row',
|
|
268
|
+
alignItems: 'center',
|
|
269
|
+
justifyContent: 'center',
|
|
270
|
+
paddingVertical: 20,
|
|
271
|
+
},
|
|
272
|
+
itemText: {
|
|
273
|
+
fontSize: 24,
|
|
274
|
+
color: '#fff',
|
|
275
|
+
fontWeight: '500',
|
|
276
|
+
},
|
|
277
|
+
listContainer: {
|
|
278
|
+
flex: 1,
|
|
279
|
+
},
|
|
280
|
+
spacer: {
|
|
281
|
+
width: 32,
|
|
282
|
+
},
|
|
283
|
+
text: {
|
|
284
|
+
fontSize: 30,
|
|
285
|
+
fontWeight: '500',
|
|
286
|
+
},
|
|
287
|
+
});
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## API Reference
|
|
291
|
+
|
|
292
|
+
Check out the dedicated documentation for info about this library, API reference and more: [Official react-native-performance-lists-profiler documentation](https://shopify.github.io/react-native-performance/docs/guides/react-native-performance-lists-profiler)
|
|
293
|
+
|
|
294
|
+
### Components
|
|
295
|
+
|
|
296
|
+
| Component | Description | Platform support |
|
|
297
|
+
| --------- | ----------- | ---------------- |
|
|
298
|
+
| ListsProfiler | A component used for collecting the performance metrics. Should be mounted high in the app tree | All |
|
|
299
|
+
| FlatListPerformanceView | A wrapper for `FlatList` component that enables performance metrics collection | All |
|
|
300
|
+
| FlashListPerformanceView | A wrapper for `FlashList` component that enables performance metrics collection | All |
|
|
301
|
+
|
|
302
|
+
#### ListsProfiler props
|
|
303
|
+
|
|
304
|
+
| Prop | Description | Platform support |
|
|
305
|
+
| ---- | ----------- | ---------------- |
|
|
306
|
+
| onInteractive | Callback triggered when the profiled list becomes interactive, can be used to process the profiling results in a custom manner. It has two parameters: `TTI` - represents the time-to-interactive, `listName` - name of the list defined in the performance view | All |
|
|
307
|
+
| onBlankArea | Callback triggered on each frame the list is scrolled - even if there is currently no blank space, can be used to process the profiling results in a custom manner. It has three parameters: `offsetStart` - visible blank space on top of the screen (while going up). If value is greater than 0, it's visible to user, `offsetEnd` - visible blank space at the end of the screen (while going down). If value is greater than 0, it's visible to user, `listName` - name of the list defined in the performance view | All |
|
|
308
|
+
|
|
309
|
+
#### FlatListPerformanceView
|
|
310
|
+
|
|
311
|
+
| Prop | Description | Platform support |
|
|
312
|
+
| ---- | ----------- | ---------------- |
|
|
313
|
+
| listName | The name of the list which will be used in the callbacks `onInteractive` and `onBlankArea` | All |
|
|
314
|
+
| onInteractive | Callback triggered when the profiled list becomes interactive, can be used directly on `FlatListPerformanceView` if you want to avoid using `ListsProfiler`. It has two parameters: `TTI` - represents the time-to-interactive, `listName` - name of the list defined in `FlatListPerformanceView` | All |
|
|
315
|
+
| onBlankArea | Callback triggered on each frame the list is scrolled - even if there is currently no blank space, can be used directly on `FlatListPerformanceView` if you want to avoid using `ListsProfiler`. It has three parameters: `offsetStart` - visible blank space on top of the screen (while going up). If value is greater than 0, it's visible to user, `offsetEnd` - visible blank space at the end of the screen (while going down). If value is greater than 0, it's visible to user, `listName` - name of the list defined in `FlatListPerformanceView`| All |
|
|
316
|
+
|
|
317
|
+
#### FlashListPerformanceView
|
|
318
|
+
|
|
319
|
+
| Prop | Description | Platform support |
|
|
320
|
+
| ---- | ----------- | ---------------- |
|
|
321
|
+
| listName | The name of the list which will be used in the callbacks `onInteractive` and `onBlankArea` | All |
|
|
322
|
+
|
|
323
|
+
## Known Issues
|
|
324
|
+
|
|
325
|
+
* The documentation of the upstream version of the library mistakingly states that `FlashListPerformanceView` API is the same as `FlatListPerformanceView` - `onInteractive` and `onBlankArea` can only be directly used with `FlatListPerformanceView`.
|
|
326
|
+
|
|
327
|
+
## Supported Versions
|
|
328
|
+
|
|
329
|
+
| Package version | Based on | @amazon-devices/react-native-kepler version |
|
|
330
|
+
| ---------------- | -------- | --------------------------------- |
|
|
331
|
+
| 2.0.x | @shopify/react-native-performance-lists-profiler v1.1.0 | 2.0.x |
|
package/README.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# react-native-performance-lists-profiler
|
|
2
|
+
|
|
3
|
+
Extension library atop [@shopify/react-native-performance-navigation](../react-native-performance-navigation/getting-started). Contains utilities for profiling the `FlatList` and `FlashList` components.
|
|
4
|
+
|
|
5
|
+
## Usage & installation
|
|
6
|
+
|
|
7
|
+
Please refer to [documentation](https://shopify.github.io/react-native-performance/docs/guides/react-native-performance-lists-profiler/) to see more information and usage examples.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "ReactNativePerformanceListsProfiler"
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.homepage = package['homepage']
|
|
10
|
+
s.license = package['license']
|
|
11
|
+
s.author = package['author']
|
|
12
|
+
s.platform = :ios, '11.0'
|
|
13
|
+
s.source = { :git => 'https://github.com/shopify/react-native-performance.git', :tag => 'v#{s.version}' }
|
|
14
|
+
s.source_files = 'ios/**/*.{h,m,swift}'
|
|
15
|
+
s.exclude_files = 'ios/**/*Tests.{h,m,swift}'
|
|
16
|
+
s.requires_arc = true
|
|
17
|
+
s.swift_version = '5.0'
|
|
18
|
+
|
|
19
|
+
# Dependencies
|
|
20
|
+
s.dependency 'React-Core'
|
|
21
|
+
|
|
22
|
+
# Remote Pods
|
|
23
|
+
|
|
24
|
+
# Tests spec
|
|
25
|
+
s.test_spec "Tests" do |test_spec|
|
|
26
|
+
test_spec.source_files = 'ios/**/*Tests.{h, m,swift}'
|
|
27
|
+
test_spec.framework = 'XCTest'
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|