first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

View File

@@ -0,0 +1,71 @@
/**
* 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 {ProgressBarAndroidProps} from './ProgressBarAndroidTypes';
import ProgressBarAndroidNativeComponent from './ProgressBarAndroidNativeComponent';
const React = require('react');
export type {ProgressBarAndroidProps};
/**
* React component that wraps the Android-only `ProgressBar`. This component is
* used to indicate that the app is loading or there is activity in the app.
*
* Example:
*
* ```
* render: function() {
* var progressBar =
* <View style={styles.container}>
* <ProgressBar styleAttr="Inverse" />
* </View>;
* return (
* <MyLoadingComponent
* componentView={componentView}
* loadingView={progressBar}
* style={styles.loadingComponent}
* />
* );
* },
* ```
*/
const ProgressBarAndroid: component(
ref?: React.RefSetter<
React.ElementRef<typeof ProgressBarAndroidNativeComponent>,
>,
...props: ProgressBarAndroidProps
) = function ProgressBarAndroid({
ref: forwardedRef,
// $FlowFixMe[incompatible-type]
styleAttr = 'Normal',
indeterminate = true,
animating = true,
...restProps
}: {
ref?: React.RefSetter<
React.ElementRef<typeof ProgressBarAndroidNativeComponent>,
>,
...ProgressBarAndroidProps,
}) {
return (
<ProgressBarAndroidNativeComponent
styleAttr={styleAttr}
indeterminate={indeterminate}
animating={animating}
{...restProps}
ref={forwardedRef}
/>
);
};
export default ProgressBarAndroid;

View File

@@ -0,0 +1,83 @@
/**
* 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.
*
* @format
*/
import type * as React from 'react';
import {Constructor} from '../../../types/private/Utilities';
import {HostInstance} from '../../../types/public/ReactNativeTypes';
import {ColorValue} from '../../StyleSheet/StyleSheet';
import {ViewProps} from '../View/ViewPropTypes';
/**
* ProgressBarAndroid has been extracted from react-native core and will be removed in a future release.
* It can now be installed and imported from `@react-native-community/progress-bar-android` instead of 'react-native'.
* @see https://github.com/react-native-community/progress-bar-android
* @deprecated
*/
export interface ProgressBarAndroidProps extends ViewProps {
/**
* Style of the ProgressBar. One of:
Horizontal
Normal (default)
Small
Large
Inverse
SmallInverse
LargeInverse
*/
styleAttr?:
| 'Horizontal'
| 'Normal'
| 'Small'
| 'Large'
| 'Inverse'
| 'SmallInverse'
| 'LargeInverse'
| undefined;
/**
* If the progress bar will show indeterminate progress.
* Note that this can only be false if styleAttr is Horizontal.
*/
indeterminate?: boolean | undefined;
/**
* The progress value (between 0 and 1).
*/
progress?: number | undefined;
/**
* Whether to show the ProgressBar (true, the default) or hide it (false).
*/
animating?: boolean | undefined;
/**
* Color of the progress bar.
*/
color?: ColorValue | undefined;
/**
* Used to locate this view in end-to-end tests.
*/
testID?: string | undefined;
}
/**
* React component that wraps the Android-only `ProgressBar`. This component is used to indicate
* that the app is loading or there is some activity in the app.
*/
declare class ProgressBarAndroidComponent extends React.Component<ProgressBarAndroidProps> {}
declare const ProgressBarAndroidBase: Constructor<HostInstance> &
typeof ProgressBarAndroidComponent;
/**
* ProgressBarAndroid has been extracted from react-native core and will be removed in a future release.
* It can now be installed and imported from `@react-native-community/progress-bar-android` instead of 'react-native'.
* @see https://github.com/react-native-progress-view/progress-bar-android
* @deprecated
*/
export class ProgressBarAndroid extends ProgressBarAndroidBase {}

View File

@@ -0,0 +1,46 @@
/**
* 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
*/
'use strict';
import typeof ProgressBarAndroidNativeComponentType from './ProgressBarAndroidNativeComponent';
import type {ProgressBarAndroidProps} from './ProgressBarAndroidTypes';
import Platform from '../../Utilities/Platform';
export type {ProgressBarAndroidProps};
// A utility type to preserve the semantics of the union uses in the definition
// of ProgressBarAndroidProps. TS's Omit does not distribute over unions, so
// we define our own version which does. This does not affect Flow.
// $FlowExpectedError[unclear-type]
type Omit<T, K> = T extends any ? Pick<T, Exclude<$Keys<T>, K>> : T;
/**
* ProgressBarAndroid has been extracted from react-native core and will be removed in a future release.
* It can now be installed and imported from `@react-native-community/progress-bar-android` instead of 'react-native'.
* @see https://github.com/react-native-community/progress-bar-android
* @deprecated
*/
let ProgressBarAndroid: component(
ref?: React.RefSetter<
React.ElementRef<ProgressBarAndroidNativeComponentType>,
>,
...props: Omit<ProgressBarAndroidProps, empty>
);
if (Platform.OS === 'android') {
ProgressBarAndroid = require('./ProgressBarAndroid').default;
} else {
ProgressBarAndroid = require('../UnimplementedViews/UnimplementedView')
.default as $FlowFixMe;
}
export default ProgressBarAndroid;

View File

@@ -0,0 +1,12 @@
/**
* 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
*/
export * from '../../../src/private/specs_DEPRECATED/components/ProgressBarAndroidNativeComponent';
export {default} from '../../../src/private/specs_DEPRECATED/components/ProgressBarAndroidNativeComponent';

View File

@@ -0,0 +1,63 @@
/**
* 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 {ColorValue} from '../../StyleSheet/StyleSheet';
import type {ViewProps} from '../View/ViewPropTypes';
/**
* Style of the ProgressBar and whether it shows indeterminate progress (e.g. spinner).
*
* `indeterminate` can only be false if `styleAttr` is Horizontal, and requires a
* `progress` value.
*/
type DeterminateProgressBarAndroidStyleAttrProp = {
styleAttr: 'Horizontal',
indeterminate: false,
progress: number,
};
type IndeterminateProgressBarAndroidStyleAttrProp = {
styleAttr:
| 'Horizontal'
| 'Normal'
| 'Small'
| 'Large'
| 'Inverse'
| 'SmallInverse'
| 'LargeInverse',
indeterminate: true,
};
type ProgressBarAndroidBaseProps = $ReadOnly<{
/**
* Whether to show the ProgressBar (true, the default) or hide it (false).
*/
animating?: ?boolean,
/**
* Color of the progress bar.
*/
color?: ?ColorValue,
/**
* Used to locate this view in end-to-end tests.
*/
testID?: ?string,
}>;
export type ProgressBarAndroidProps =
| $ReadOnly<{
...ViewProps,
...ProgressBarAndroidBaseProps,
...DeterminateProgressBarAndroidStyleAttrProp,
}>
| $ReadOnly<{
...ViewProps,
...ProgressBarAndroidBaseProps,
...IndeterminateProgressBarAndroidStyleAttrProp,
}>;