Files
react-native/Libraries/Components/Switch/Switch.d.ts
T
Vic 7f061f8651 Refactor: removed duplicated words in comments (#34807)
Summary:
Found and removed duplicates of the word "the" in comments.

## Changelog

[Internal] [Removed] – Removed duplicates of the word "the" in comments.

Pull Request resolved: https://github.com/facebook/react-native/pull/34807

Test Plan: Not applicable.

Reviewed By: yungsters, cipolleschi

Differential Revision: D39880587

fbshipit-source-id: b7277aa70604902929903c31ab69d4c532f2667a
2022-09-28 09:08:27 -07:00

112 lines
2.9 KiB
TypeScript

/**
* 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 'Utilities';
import {NativeMethods} from '../../Renderer/shims/ReactNativeTypes';
import {ColorValue, StyleProp} from '../../StyleSheet/StyleSheet';
import {ViewStyle} from '../../StyleSheet/StyleSheetTypes';
import {ViewProps} from '../View/ViewPropTypes';
export interface SwitchPropsIOS extends ViewProps {
/**
* Background color when the switch is turned on.
*
* @deprecated use trackColor instead
*/
onTintColor?: ColorValue | undefined;
/**
* Color of the foreground switch grip.
*
* @deprecated use thumbColor instead
*/
thumbTintColor?: ColorValue | undefined;
/**
* Background color when the switch is turned off.
*
* @deprecated use trackColor instead
*/
tintColor?: ColorValue | undefined;
}
export interface SwitchChangeEvent extends React.SyntheticEvent {
value: boolean;
}
export interface SwitchProps extends SwitchPropsIOS {
/**
* Color of the foreground switch grip.
*/
thumbColor?: ColorValue | undefined;
/**
* Custom colors for the switch track
*
* Color when false and color when true
*/
trackColor?:
| {
false?: ColorValue | null | undefined;
true?: ColorValue | null | undefined;
}
| undefined;
/**
* If true the user won't be able to toggle the switch.
* Default value is false.
*/
disabled?: boolean | undefined;
/**
* Invoked with the change event as an argument when the value changes.
*/
onChange?:
| ((event: SwitchChangeEvent) => Promise<void> | void)
| null
| undefined;
/**
* Invoked with the new value when the value changes.
*/
onValueChange?: ((value: boolean) => Promise<void> | void) | null | undefined;
/**
* Used to locate this view in end-to-end tests.
*/
testID?: string | undefined;
/**
* The value of the switch. If true the switch will be turned on.
* Default value is false.
*/
value?: boolean | undefined;
/**
* On iOS, custom color for the background.
* Can be seen when the switch value is false or when the switch is disabled.
*/
ios_backgroundColor?: ColorValue | undefined;
style?: StyleProp<ViewStyle> | undefined;
}
/**
* Renders a boolean input.
*
* This is a controlled component that requires an `onValueChange` callback that
* updates the `value` prop in order for the component to reflect user actions.
* If the `value` prop is not updated, the component will continue to render
* the supplied `value` prop instead of the expected result of any user actions.
*/
declare class SwitchComponent extends React.Component<SwitchProps> {}
declare const SwitchBase: Constructor<NativeMethods> & typeof SwitchComponent;
export class Switch extends SwitchBase {}