When running react-native in bridgeless mode, the results of getConstants are no longer cached by the JS side. This causes 100s of calls into the theming modules getConstants method, which then has to load and marshall the whole theming data from native to JS.
With this change we'll cache the result of getConstants to avoid the performance cost of calling it multiple times.
Platforms Impacted
Description of changes
When running react-native in bridgeless mode, the results of getConstants are no longer cached by the JS side. This causes 100s of calls into the theming modules getConstants method, which then has to load and marshall the whole theming data from native to JS.
With this change we'll cache the result of getConstants to avoid the performance cost of calling it multiple times.