Skip to content
Merged
2 changes: 1 addition & 1 deletion Libraries/Components/CheckBox/CheckBox.macos.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
* 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.
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Components/DatePicker/DatePickerIOS.macos.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* 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.
Expand Down
25 changes: 4 additions & 21 deletions Libraries/Components/DatePickerAndroid/DatePickerAndroid.macos.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,15 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* 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.
*
* @format
* @flow
* @flow strict-local
*/

// TODO(macOS ISS#2323203)

'use strict';

import type {Options, DatePickerOpenAction} from './DatePickerAndroidTypes';

class DatePickerAndroid {
static async open(options: ?Options): Promise<DatePickerOpenAction> {
throw new Error('DatePickerAndroid is not supported on this platform.');
}

/**
* A date has been selected.
*/
static +dateSetAction: 'dateSetAction' = 'dateSetAction';
/**
* The dialog has been dismissed.
*/
static +dismissedAction: 'dismissedAction' = 'dismissedAction';
}

/* $FlowFixMe allow macOS to share iOS file */
const DatePickerAndroid = require('./DatePickerAndroid.ios');
module.exports = DatePickerAndroid;
2 changes: 1 addition & 1 deletion Libraries/Components/Picker/PickerAndroid.macos.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* 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.
Expand Down
2 changes: 2 additions & 0 deletions Libraries/Components/Picker/PickerIOS.macos.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
* This is a controlled component version of RCTPickerIOS
*
* @format
* @flow
*/

// TODO(macOS ISS#2323203)

/* $FlowFixMe allow macOS to share iOS file */
const PickerIOS = require('./PickerIOS.ios');
module.exports = PickerIOS;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* 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.
Expand Down
75 changes: 4 additions & 71 deletions Libraries/Components/ProgressViewIOS/ProgressViewIOS.macos.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* 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.
Expand All @@ -10,73 +10,6 @@

// TODO(macOS ISS#2323203)

'use strict';

const React = require('react');
const StyleSheet = require('../../StyleSheet/StyleSheet');

import RCTProgressViewNativeComponent from './RCTProgressViewNativeComponent';
import type {ImageSource} from '../../Image/ImageSource';
import type {ColorValue} from '../../StyleSheet/StyleSheetTypes';
import type {ViewProps} from '../View/ViewPropTypes';

type Props = $ReadOnly<{|
...ViewProps,

/**
* The progress bar style.
*/
progressViewStyle?: ?('default' | 'bar'),

/**
* The progress value (between 0 and 1).
*/
progress?: ?number,

/**
* The tint color of the progress bar itself.
*/
progressTintColor?: ?ColorValue,

/**
* The tint color of the progress bar track.
*/
trackTintColor?: ?ColorValue,

/**
* A stretchable image to display as the progress bar.
*/
progressImage?: ?ImageSource,

/**
* A stretchable image to display behind the progress bar.
*/
trackImage?: ?ImageSource,
|}>;

/**
* Use `ProgressViewIOS` to render a UIProgressView on iOS.
*/
const ProgressViewIOS = (
props: Props,
forwardedRef?: ?React.Ref<typeof RCTProgressViewNativeComponent>,
) => (
<RCTProgressViewNativeComponent
{...props}
style={[styles.progressView, props.style]}
ref={forwardedRef}
/>
);

const styles = StyleSheet.create({
progressView: {
height: 2,
},
});

const ProgressViewIOSWithRef = React.forwardRef(ProgressViewIOS);

/* $FlowFixMe(>=0.89.0 site=react_native_ios_fb) This comment suppresses an
* error found when Flow v0.89 was deployed. To see the error, delete this
* comment and run Flow. */
module.exports = (ProgressViewIOSWithRef: typeof RCTProgressViewNativeComponent);
/* $FlowFixMe allow macOS to share iOS file */
const ProgressViewIOSWithRef = require('./ProgressViewIOS.ios');
module.exports = ProgressViewIOSWithRef;
117 changes: 3 additions & 114 deletions Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.macos.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,117 +10,6 @@

// TODO(macOS ISS#2323203)

'use strict';

import * as React from 'react';
import StyleSheet from '../../StyleSheet/StyleSheet';
import type {OnChangeEvent} from './RCTSegmentedControlNativeComponent';
import type {ViewProps} from '../View/ViewPropTypes';
import RCTSegmentedControlNativeComponent from './RCTSegmentedControlNativeComponent';
import type {SyntheticEvent} from 'react-native/Libraries/Types/CoreEventTypes';

type SegmentedControlIOSProps = $ReadOnly<{|
...ViewProps,
/**
* The labels for the control's segment buttons, in order.
*/
values?: $ReadOnlyArray<string>,
/**
* The index in `props.values` of the segment to be (pre)selected.
*/
selectedIndex?: ?number,
/**
* If false the user won't be able to interact with the control.
* Default value is true.
*/
enabled?: boolean,
/**
* Accent color of the control.
*/
tintColor?: ?string,
/**
* If true, then selecting a segment won't persist visually.
* The `onValueChange` callback will still work as expected.
*/
momentary?: ?boolean,
/**
* Callback that is called when the user taps a segment
*/
onChange?: ?(event: SyntheticEvent<OnChangeEvent>) => void,
/**
* Callback that is called when the user taps a segment;
* passes the segment's value as an argument
*/
onValueChange?: ?(value: number) => mixed,
|}>;

type Props = $ReadOnly<{|
...SegmentedControlIOSProps,
forwardedRef: ?React.Ref<typeof RCTSegmentedControlNativeComponent>,
|}>;

/**
* Use `SegmentedControlIOS` to render a UISegmentedControl iOS.
*
* #### Programmatically changing selected index
*
* The selected index can be changed on the fly by assigning the
* selectedIndex prop to a state variable, then changing that variable.
* Note that the state variable would need to be updated as the user
* selects a value and changes the index, as shown in the example below.
*
* ````
* <SegmentedControlIOS
* values={['One', 'Two']}
* selectedIndex={this.state.selectedIndex}
* onChange={(event) => {
* this.setState({selectedIndex: event.nativeEvent.selectedSegmentIndex});
* }}
* />
* ````
*/

class SegmentedControlIOS extends React.Component<Props> {
static defaultProps = {
values: [],
enabled: true,
};

_onChange = (event: SyntheticEvent<OnChangeEvent>) => {
this.props.onChange && this.props.onChange(event);
this.props.onValueChange &&
this.props.onValueChange(event.nativeEvent.value);
};

render() {
const {forwardedRef, onValueChange, style, ...props} = this.props;
return (
<RCTSegmentedControlNativeComponent
{...props}
ref={forwardedRef}
style={[styles.segmentedControl, style]}
onChange={this._onChange}
/>
);
}
}

const styles = StyleSheet.create({
segmentedControl: {
height: 28,
},
});

const SegmentedControlIOSWithRef = React.forwardRef(
(
props: SegmentedControlIOSProps,
forwardedRef: ?React.Ref<typeof RCTSegmentedControlNativeComponent>,
) => {
return <SegmentedControlIOS {...props} forwardedRef={forwardedRef} />;
},
);

/* $FlowFixMe(>=0.89.0 site=react_native_ios_fb) This comment suppresses an
* error found when Flow v0.89 was deployed. To see the error, delete this
* comment and run Flow. */
module.exports = (SegmentedControlIOSWithRef: NativeSegmentedControlIOS);
/* $FlowFixMe allow macOS to share iOS file */
const SegmentedControlIOSWithRef = require('./SegmentedControlIOS.ios');
module.exports = SegmentedControlIOSWithRef;
14 changes: 3 additions & 11 deletions Libraries/Components/StatusBar/StatusBarIOS.macos.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@

// TODO(macOS ISS#2323203)

'use strict';

const NativeEventEmitter = require('../../EventEmitter/NativeEventEmitter');
const {StatusBarManager} = require('../../BatchedBridge/NativeModules');

/**
* Use `StatusBar` for mutating the status bar.
*/
class StatusBarIOS extends NativeEventEmitter {}

module.exports = new StatusBarIOS(StatusBarManager);
/* $FlowFixMe allow macOS to share iOS file */
const StatusBarIOS = require('./StatusBarIOS.ios');
module.exports = StatusBarIOS;
28 changes: 0 additions & 28 deletions Libraries/Components/TimePickerAndroid/TimePickerAndroid.macos.js

This file was deleted.

11 changes: 1 addition & 10 deletions Libraries/Components/ToastAndroid/ToastAndroid.macos.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,5 @@

// TODO(macOS ISS#2323203)

'use strict';

const warning = require('fbjs/lib/warning');

const ToastAndroid = {
show: function(message: string, duration: number): void {
warning(false, 'ToastAndroid is not supported on this platform.');
},
};

const ToastAndroid = require('./ToastAndroid.ios');
module.exports = ToastAndroid;
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
* @format
*/

// TODO(macOS ISS#2323203) TODO(windows ISS): this file is TouchableNativeFeedback.ios.js in facebook's repo. Renamed to TouchableNativeFeedback.js since it is shared here between ios, macos, and windows.

'use strict';

const React = require('react');
Expand Down
11 changes: 11 additions & 0 deletions Libraries/Components/Touchable/TouchableNativeFeedback.macos.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* 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.
*
* @format
*/

const DummyTouchableNativeFeedback = require('./TouchableNativeFeedback.ios');
module.exports = DummyTouchableNativeFeedback;
4 changes: 3 additions & 1 deletion Libraries/Components/View/PlatformViewPropTypes.macos.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
* 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.
*
* @providesModule PlatformViewPropTypes
* @format
* @flow
*/

Expand Down
3 changes: 0 additions & 3 deletions Libraries/Image/Image.js → Libraries/Image/Image.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
* @flow
* @format
*/

// TODO(macOS ISS#2323203) TODO(windows ISS): this file is Image.ios.js in facebook's repo. Renamed to Image.js since it is shared here between ios, macos, and windows.

'use strict';

const DeprecatedImagePropType = require('../DeprecatedPropTypes/DeprecatedImagePropType');
Expand Down
Loading