Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/react-native/Libraries/Components/CheckBox/AndroidCheckBoxNativeComponent.js b/react-native/Libraries/Components/CheckBox/AndroidCheckBoxNativeComponent.js
- new file mode 100644
- --- /dev/null
- +++ b/react-native/Libraries/Components/CheckBox/AndroidCheckBoxNativeComponent.js
- @@ -0,0 +1,51 @@
- +/**
- + * 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 requireNativeComponent = require('requireNativeComponent');
- +
- +import type {ViewProps} from 'ViewPropTypes';
- +import type {SyntheticEvent} from 'CoreEventTypes';
- +import type {NativeComponent} from 'ReactNative';
- +
- +type CheckBoxEvent = SyntheticEvent<
- + $ReadOnly<{|
- + target: number,
- + value: boolean,
- + |}>,
- +>;
- +
- +type NativeProps = $ReadOnly<{|
- + ...ViewProps,
- +
- + /**
- + * Used in case the props change removes the component.
- + */
- + onChange?: ?(event: CheckBoxEvent) => mixed,
- +
- + /**
- + * Invoked with the new value when the value changes.
- + */
- + onValueChange?: ?(value: boolean) => mixed,
- +
- + /**
- + * Used to locate this view in end-to-end tests.
- + */
- + testID?: ?string,
- +
- + on?: ?boolean,
- + enabled?: boolean,
- +|}>;
- +
- +type CheckBoxNativeType = Class<NativeComponent<NativeProps>>;
- +
- +module.exports = ((requireNativeComponent(
- + 'AndroidCheckBox',
- +): any): CheckBoxNativeType);
- diff --git a/react-native/Libraries/Components/CheckBox/CheckBox.android.js b/react-native/Libraries/Components/CheckBox/CheckBox.android.js
- --- a/react-native/Libraries/Components/CheckBox/CheckBox.android.js
- +++ b/react-native/Libraries/Components/CheckBox/CheckBox.android.js
- @@ -9,6 +9,7 @@
- */
- 'use strict';
- +const AndroidCheckBoxNativeComponent = require('AndroidCheckBoxNativeComponent');
- const React = require('React');
- const StyleSheet = require('StyleSheet');
- @@ -18,7 +19,6 @@
- import type {ViewProps} from 'ViewPropTypes';
- import type {SyntheticEvent} from 'CoreEventTypes';
- -import type {NativeComponent} from 'ReactNative';
- type CheckBoxEvent = SyntheticEvent<
- $ReadOnly<{|
- @@ -46,15 +46,6 @@
- testID?: ?string,
- |}>;
- -type NativeProps = $ReadOnly<{|
- - ...CommonProps,
- -
- - on?: ?boolean,
- - enabled?: boolean,
- -|}>;
- -
- -type CheckBoxNativeType = Class<NativeComponent<NativeProps>>;
- -
- type Props = $ReadOnly<{|
- ...CommonProps,
- @@ -76,10 +67,6 @@
- forwardedRef?: ?React.Ref<CheckBoxNativeType>,
- |}>;
- -const RCTCheckBox = ((requireNativeComponent(
- - 'AndroidCheckBox',
- -): any): CheckBoxNativeType);
- -
- /**
- * Renders a boolean input (Android only).
- *
- @@ -169,7 +156,7 @@
- };
- return (
- - <RCTCheckBox
- + <AndroidCheckBoxNativeComponent
- {...nativeProps}
- ref={this._setNativeRef}
- onChange={this._onChange}
Advertisement
Add Comment
Please, Sign In to add comment