Closed zxcodes closed 1 year ago
We incidentally have a PR that's doing a similar thing
This avoids creating an array in the case you don't pass in a style. Since this PR also has some other optimisations, we'll go in that direction
Thanks for the PR anyway 😊
… re-renders.
In the
SafeAreaContext.tsx
component, thestyle
prop was passed using array syntax, which created a new array on each render and caused unnecessary re-renders.To improve performance, the
style
prop has been refactored to use the spread syntax, which merges the component's default styles with the passed styles object more efficiently. This change ensures that theSafeAreaContext
component maintains its appearance and behavior while reducing the chance of unnecessary re-renders. The new syntax isstyle={{...styles.fill, ...style}}
.Summary
Test Plan