From c8a479c6417e257cbbdd676c8678662c20106974 Mon Sep 17 00:00:00 2001 From: Xin Chen Date: Wed, 16 Aug 2023 13:27:40 -0700 Subject: [PATCH] Update example description to help understand them better (#38797) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/38797 Changelog: [Internal] - Refactor description to performance comparison examples in RNTester Reviewed By: christophpurrer Differential Revision: D47892300 fbshipit-source-id: 8006cbef9f30472adc54ebf0f87a8b52c840a824 --- .../ReRenderWithNonPureChildExample.js | 2 +- .../ReRenderWithObjectPropExample.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/ReRenderWithNonPureChildExample.js b/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/ReRenderWithNonPureChildExample.js index 21f7e1cf9ba..7ea36fcfb16 100644 --- a/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/ReRenderWithNonPureChildExample.js +++ b/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/ReRenderWithNonPureChildExample.js @@ -57,7 +57,7 @@ function ReRenderWithNonPureChildGoodExample(): React.Node { export default { title: 'List re-render due to not pure or memoized', description: - 'The List component is not pure in the bad example. Even though all props are not changed, it will still re-render when parent re-renders.', + 'Get horizontal scroll offset.\nThe List component is not pure in the bad example. Even though all props are not changed, it will still re-render when parent re-renders.', Bad: ReRenderWithNonPureChildBadExample, Good: ReRenderWithNonPureChildGoodExample, }; diff --git a/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/ReRenderWithObjectPropExample.js b/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/ReRenderWithObjectPropExample.js index b535468ed18..5f5ab7354d3 100644 --- a/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/ReRenderWithObjectPropExample.js +++ b/packages/rn-tester/js/examples/Performance/performanceComparisonExamples/ReRenderWithObjectPropExample.js @@ -55,7 +55,7 @@ function ReRenderWithObjectPropGoodExample(): React.Node { export default { title: 'Re-render from new object reference in prop', description: - 'Even with pure or memoized child component, if a new object reference is passed down as prop, the child component will still re-render unnecessarily. The onScroll callback is passed without useCallback hook in the bad example and caused performance issues.', + 'Get horizontal scroll offset.\nEven with pure or memoized child component, if a new object reference is passed down as prop, the child component will still re-render unnecessarily. The onScroll callback is passed without useCallback hook in the bad example and caused performance issues.', Bad: ReRenderWithObjectPropBadExample, Good: ReRenderWithObjectPropGoodExample, };