PHP 7.4.33
Preview: ImageViewNativeComponent.js Size: 4.93 KB
/var/www/uibuilder.cmshelp.dk/httpdocs/node_modules/react-native/Libraries/Image/ImageViewNativeComponent.js
/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow strict-local
 * @format
 */

import type {ViewProps} from '../Components/View/ViewPropTypes';
import type {
  HostComponent,
  HostInstance,
  PartialViewConfig,
} from '../Renderer/shims/ReactNativeTypes';
import type {
  ColorValue,
  DangerouslyImpreciseStyle,
  ImageStyleProp,
} from '../StyleSheet/StyleSheet';
import type {ResolvedAssetSource} from './AssetSourceResolver';
import type {ImageProps} from './ImageProps';
import type {ImageSource} from './ImageSource';

import * as NativeComponentRegistry from '../NativeComponent/NativeComponentRegistry';
import {ConditionallyIgnoredEventHandlers} from '../NativeComponent/ViewConfigIgnore';
import codegenNativeCommands from '../Utilities/codegenNativeCommands';
import Platform from '../Utilities/Platform';

type Props = $ReadOnly<{
  ...ImageProps,
  ...ViewProps,

  style?: ImageStyleProp | DangerouslyImpreciseStyle,

  // iOS native props
  tintColor?: ColorValue,

  // Android native props
  shouldNotifyLoadEvents?: boolean,
  src?:
    | ?ResolvedAssetSource
    | ?$ReadOnlyArray<?$ReadOnly<{uri?: ?string, ...}>>,
  headers?: ?{[string]: string},
  defaultSource?: ?ImageSource | ?string,
  loadingIndicatorSrc?: ?string,
}>;

interface NativeCommands {
  +setIsVisible_EXPERIMENTAL: (
    viewRef: HostInstance,
    isVisible: boolean,
    time: number,
  ) => void;
}

export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
  supportedCommands: ['setIsVisible_EXPERIMENTAL'],
});

export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
  Platform.OS === 'android'
    ? {
        uiViewClassName: 'RCTImageView',
        bubblingEventTypes: {},
        directEventTypes: {
          topLoadStart: {
            registrationName: 'onLoadStart',
          },
          topProgress: {
            registrationName: 'onProgress',
          },
          topError: {
            registrationName: 'onError',
          },
          topLoad: {
            registrationName: 'onLoad',
          },
          topLoadEnd: {
            registrationName: 'onLoadEnd',
          },
        },
        validAttributes: {
          blurRadius: true,
          defaultSource: true,
          internal_analyticTag: true,
          resizeMethod: true,
          resizeMode: true,
          resizeMultiplier: true,
          tintColor: {
            process: require('../StyleSheet/processColor').default,
          },
          borderBottomLeftRadius: true,
          borderTopLeftRadius: true,
          src: true,
          // NOTE: New Architecture expects this to be called `source`,
          // regardless of the platform, therefore propagate it as well.
          // For the backwards compatibility reasons, we keep both `src`
          // and `source`, which will be identical at this stage.
          source: true,
          borderRadius: true,
          headers: true,
          shouldNotifyLoadEvents: true,
          overlayColor: {
            process: require('../StyleSheet/processColor').default,
          },
          borderColor: {
            process: require('../StyleSheet/processColor').default,
          },
          accessible: true,
          progressiveRenderingEnabled: true,
          fadeDuration: true,
          borderBottomRightRadius: true,
          borderTopRightRadius: true,
          loadingIndicatorSrc: true,
        },
      }
    : {
        uiViewClassName: 'RCTImageView',
        bubblingEventTypes: {},
        directEventTypes: {
          topLoadStart: {
            registrationName: 'onLoadStart',
          },
          topProgress: {
            registrationName: 'onProgress',
          },
          topError: {
            registrationName: 'onError',
          },
          topPartialLoad: {
            registrationName: 'onPartialLoad',
          },
          topLoad: {
            registrationName: 'onLoad',
          },
          topLoadEnd: {
            registrationName: 'onLoadEnd',
          },
        },
        validAttributes: {
          blurRadius: true,
          capInsets: {
            diff: require('../Utilities/differ/insetsDiffer'),
          },
          defaultSource: {
            process: require('./resolveAssetSource'),
          },
          internal_analyticTag: true,
          resizeMode: true,
          source: true,
          tintColor: {
            process: require('../StyleSheet/processColor').default,
          },
          ...ConditionallyIgnoredEventHandlers({
            onLoadStart: true,
            onLoad: true,
            onLoadEnd: true,
            onProgress: true,
            onError: true,
            onPartialLoad: true,
          }),
        },
      };

const ImageViewNativeComponent: HostComponent<Props> =
  NativeComponentRegistry.get<Props>(
    'RCTImageView',
    () => __INTERNAL_VIEW_CONFIG,
  );

export default ImageViewNativeComponent;

Directory Contents

Dirs: 0 × Files: 70
Name Size Perms Modified Actions
305 B lrw-r--r-- 2025-03-28 11:04:42
Edit Download
6.37 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
1.24 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
10.57 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
10.79 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
7.92 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
306 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
465 B lrw-r--r-- 2025-03-28 11:04:42
Edit Download
3.14 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
2.52 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
7.11 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
1.47 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
1.12 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
2.81 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
3.94 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
2.36 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
2.20 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
595 B lrw-r--r-- 2025-03-28 11:04:42
Edit Download
4.93 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
406 B lrw-r--r-- 2025-03-28 11:04:42
Edit Download
440 B lrw-r--r-- 2025-03-28 11:04:42
Edit Download
424 B lrw-r--r-- 2025-03-28 11:04:42
Edit Download
1.69 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
430 B lrw-r--r-- 2025-03-28 11:04:42
Edit Download
414 B lrw-r--r-- 2025-03-28 11:04:42
Edit Download
609 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
4.76 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
302 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
2.16 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
569 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
841 B lrw-r--r-- 2025-03-28 11:04:43
Edit Download
299 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
1.51 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
364 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
3.58 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
1.20 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
5.74 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
1.85 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
295 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
4.38 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
1.42 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
51.56 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
816 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
6.15 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
2.01 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
1.10 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
1.04 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
276 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
380 B lrw-r--r-- 2025-03-28 11:04:43
Edit Download
1.69 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
8.35 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
3.13 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
2.84 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
707 B lrw-r--r-- 2025-03-28 11:04:43
Edit Download
3.50 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
12.22 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
844 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
15.24 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
279 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
4.53 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
362 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
2.16 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
1.53 KB lrw-r--r-- 2025-03-28 11:04:41
Edit Download
623 B lrw-r--r-- 2025-03-28 11:04:43
Edit Download
310 B lrw-r--r-- 2025-03-28 11:04:41
Edit Download
10.67 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
2.43 KB lrw-r--r-- 2025-03-28 11:04:43
Edit Download
710 B lrw-r--r-- 2025-03-28 11:04:42
Edit Download
4.22 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
1.30 KB lrw-r--r-- 2025-03-28 11:04:42
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).