Files
react-native/Libraries/Components/Switch/AndroidSwitchNativeComponent.js
T
Rick Hanlon 5b7be95a1d Use generated view config for iOS Switch
Summary:
Adds a generated view config for iOS Switch

Note: this required some refactoring because the SwitchNativeComponent file included both iOS and android componets, so I broke them out into:

- AndroidSwitchNativeComponent (not generated)
- SwitchNativeComponent (generated)

The schema that we're using is for the  iOS version so that's the config that's generated here

Reviewed By: cpojer

Differential Revision: D15495402

fbshipit-source-id: 07b3bc9c780cbf8f6cbf66e976e15981cefcadfa
2019-06-10 03:34:13 -07:00

49 lines
1.1 KiB
JavaScript

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/
'use strict';
const {NativeComponent} = require('../../Renderer/shims/ReactNative');
const requireNativeComponent = require('../../ReactNative/requireNativeComponent');
import type {SyntheticEvent} from '../../Types/CoreEventTypes';
import type {ViewProps} from '../View/ViewPropTypes';
type SwitchChangeEvent = SyntheticEvent<
$ReadOnly<{|
value: boolean,
|}>,
>;
type NativeProps = $ReadOnly<{|
...ViewProps,
// Props
disabled?: ?boolean,
enabled?: ?boolean,
thumbColor?: ?string,
trackColorForFalse?: ?string,
trackColorForTrue?: ?string,
value?: ?boolean,
on?: ?boolean,
thumbTintColor?: ?string,
trackTintColor?: ?string,
// Events
onChange?: ?(event: SwitchChangeEvent) => mixed,
|}>;
type SwitchNativeComponentType = Class<NativeComponent<NativeProps>>;
module.exports = ((requireNativeComponent(
'AndroidSwitch',
): any): SwitchNativeComponentType);