mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
5b7be95a1d
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
49 lines
1.1 KiB
JavaScript
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);
|