优化 React Native 性能涉及最小化不必要的重新渲染、高效的列表、减少JS 线程工作和 bridge 流量、优化图像以及使用原生线程进行动画。性能对于平滑、响应式应用很重要。
最小化重新渲染(React 的关键问题)
✓ Avoid unnecessary RE-RENDERS:
→ React.memo (memoize components), useMemo (values), useCallback (functions)
→ correct, stable KEYS in lists; avoid creating new objects/functions inline that
cause children to re-render
→ proper state structure (don't put everything in one big state that re-renders all)
高效列表
✓ Use FLATLIST (not ScrollView + map) for long lists — lazy rendering/virtualization
✓ Optimize FlatList: keyExtractor, getItemLayout, windowSize, removeClippedSubviews;
keep item components light and memoized
✓ For very large/complex lists → FlashList (Shopify) — a faster drop-in alternative
