From 52d8660964039e0d8352dfea3bb9e02e115f77a2 Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Tue, 22 Jul 2025 09:29:50 -0700 Subject: [PATCH] Use default namespace in RNAndroid / imagemanager / conversion (#52751) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/52751 The only method use externally is ``` inline MapBuffer serializeImageRequest( const ImageSource& imageSource, const ImageRequestParams& imageRequestParams) { ``` all others can move to a private/anonymous namespace Changelog: [Internal] Reviewed By: rshest Differential Revision: D78709009 fbshipit-source-id: 10c444c34641deddcfc3d2d4e95274f24fd38a4e --- .../react/renderer/imagemanager/conversions.h | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/packages/react-native/ReactCommon/react/renderer/imagemanager/platform/android/react/renderer/imagemanager/conversions.h b/packages/react-native/ReactCommon/react/renderer/imagemanager/platform/android/react/renderer/imagemanager/conversions.h index 7f24a575b27..1e90a643761 100644 --- a/packages/react-native/ReactCommon/react/renderer/imagemanager/platform/android/react/renderer/imagemanager/conversions.h +++ b/packages/react-native/ReactCommon/react/renderer/imagemanager/platform/android/react/renderer/imagemanager/conversions.h @@ -17,6 +17,8 @@ namespace facebook::react { +namespace { + inline std::string toString(const ImageResizeMode& value) { switch (value) { case ImageResizeMode::Cover: @@ -34,21 +36,21 @@ inline std::string toString(const ImageResizeMode& value) { } } -constexpr static MapBuffer::Key IS_KEY_URI = 0; -constexpr static MapBuffer::Key IS_KEY_DEFAULT_SRC = 1; -constexpr static MapBuffer::Key IS_KEY_RESIZE_MODE = 2; -constexpr static MapBuffer::Key IS_KEY_RESIZE_METHOD = 3; -constexpr static MapBuffer::Key IS_KEY_BLUR_RADIUS = 4; -constexpr static MapBuffer::Key IS_KEY_VIEW_WIDTH = 5; -constexpr static MapBuffer::Key IS_KEY_VIEW_HEIGHT = 6; -constexpr static MapBuffer::Key IS_KEY_RESIZE_MULTIPLIER = 7; -constexpr static MapBuffer::Key IS_KEY_SHOULD_NOTIFY_LOAD_EVENTS = 8; -constexpr static MapBuffer::Key IS_KEY_OVERLAY_COLOR = 9; -constexpr static MapBuffer::Key IS_KEY_TINT_COLOR = 10; -constexpr static MapBuffer::Key IS_KEY_FADE_DURATION = 11; -constexpr static MapBuffer::Key IS_KEY_PROGRESSIVE_RENDERING_ENABLED = 12; -constexpr static MapBuffer::Key IS_KEY_LOADING_INDICATOR_SRC = 13; -constexpr static MapBuffer::Key IS_KEY_ANALYTIC_TAG = 14; +constexpr MapBuffer::Key IS_KEY_URI = 0; +constexpr MapBuffer::Key IS_KEY_DEFAULT_SRC = 1; +constexpr MapBuffer::Key IS_KEY_RESIZE_MODE = 2; +constexpr MapBuffer::Key IS_KEY_RESIZE_METHOD = 3; +constexpr MapBuffer::Key IS_KEY_BLUR_RADIUS = 4; +constexpr MapBuffer::Key IS_KEY_VIEW_WIDTH = 5; +constexpr MapBuffer::Key IS_KEY_VIEW_HEIGHT = 6; +constexpr MapBuffer::Key IS_KEY_RESIZE_MULTIPLIER = 7; +constexpr MapBuffer::Key IS_KEY_SHOULD_NOTIFY_LOAD_EVENTS = 8; +constexpr MapBuffer::Key IS_KEY_OVERLAY_COLOR = 9; +constexpr MapBuffer::Key IS_KEY_TINT_COLOR = 10; +constexpr MapBuffer::Key IS_KEY_FADE_DURATION = 11; +constexpr MapBuffer::Key IS_KEY_PROGRESSIVE_RENDERING_ENABLED = 12; +constexpr MapBuffer::Key IS_KEY_LOADING_INDICATOR_SRC = 13; +constexpr MapBuffer::Key IS_KEY_ANALYTIC_TAG = 14; inline void serializeImageSource( MapBufferBuilder& builder, @@ -89,6 +91,8 @@ inline void serializeImageRequestParams( builder.putString(IS_KEY_ANALYTIC_TAG, imageRequestParams.analyticTag); } +} // namespace + inline MapBuffer serializeImageRequest( const ImageSource& imageSource, const ImageRequestParams& imageRequestParams) {