Skip to content

Commit cf0bd0b

Browse files
authored
Deduplicate several JavaScript files (#327)
* Update scripts to publish react-native-macos-init * Clean up merge markers * Restored ios:macos RNTester parity except for InputAccessoryView. * Revert "Restored ios:macos RNTester parity except for InputAccessoryView." This reverts commit 5a67ae0. * Dedup files from upstream.
1 parent 8879e31 commit cf0bd0b

21 files changed

+58
-420
lines changed

Libraries/Components/CheckBox/CheckBox.macos.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) 2017-present, Facebook, Inc.
2+
* Copyright (c) Facebook, Inc. and its affiliates.
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.

Libraries/Components/DatePicker/DatePickerIOS.macos.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) 2015-present, Facebook, Inc.
2+
* Copyright (c) Facebook, Inc. and its affiliates.
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,15 @@
11
/**
2-
* Copyright (c) 2015-present, Facebook, Inc.
2+
* Copyright (c) Facebook, Inc. and its affiliates.
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
77
* @format
8-
* @flow
8+
* @flow strict-local
99
*/
1010

1111
// TODO(macOS ISS#2323203)
1212

13-
'use strict';
14-
15-
import type {Options, DatePickerOpenAction} from './DatePickerAndroidTypes';
16-
17-
class DatePickerAndroid {
18-
static async open(options: ?Options): Promise<DatePickerOpenAction> {
19-
throw new Error('DatePickerAndroid is not supported on this platform.');
20-
}
21-
22-
/**
23-
* A date has been selected.
24-
*/
25-
static +dateSetAction: 'dateSetAction' = 'dateSetAction';
26-
/**
27-
* The dialog has been dismissed.
28-
*/
29-
static +dismissedAction: 'dismissedAction' = 'dismissedAction';
30-
}
31-
13+
/* $FlowFixMe allow macOS to share iOS file */
14+
const DatePickerAndroid = require('./DatePickerAndroid.ios');
3215
module.exports = DatePickerAndroid;

Libraries/Components/Picker/PickerAndroid.macos.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) 2015-present, Facebook, Inc.
2+
* Copyright (c) Facebook, Inc. and its affiliates.
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.

Libraries/Components/Picker/PickerIOS.macos.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
* This is a controlled component version of RCTPickerIOS
99
*
1010
* @format
11+
* @flow
1112
*/
1213

1314
// TODO(macOS ISS#2323203)
1415

16+
/* $FlowFixMe allow macOS to share iOS file */
1517
const PickerIOS = require('./PickerIOS.ios');
1618
module.exports = PickerIOS;

Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.macos.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) 2015-present, Facebook, Inc.
2+
* Copyright (c) Facebook, Inc. and its affiliates.
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
Lines changed: 4 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) 2015-present, Facebook, Inc.
2+
* Copyright (c) Facebook, Inc. and its affiliates.
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
@@ -10,73 +10,6 @@
1010

1111
// TODO(macOS ISS#2323203)
1212

13-
'use strict';
14-
15-
const React = require('react');
16-
const StyleSheet = require('../../StyleSheet/StyleSheet');
17-
18-
import RCTProgressViewNativeComponent from './RCTProgressViewNativeComponent';
19-
import type {ImageSource} from '../../Image/ImageSource';
20-
import type {ColorValue} from '../../StyleSheet/StyleSheetTypes';
21-
import type {ViewProps} from '../View/ViewPropTypes';
22-
23-
type Props = $ReadOnly<{|
24-
...ViewProps,
25-
26-
/**
27-
* The progress bar style.
28-
*/
29-
progressViewStyle?: ?('default' | 'bar'),
30-
31-
/**
32-
* The progress value (between 0 and 1).
33-
*/
34-
progress?: ?number,
35-
36-
/**
37-
* The tint color of the progress bar itself.
38-
*/
39-
progressTintColor?: ?ColorValue,
40-
41-
/**
42-
* The tint color of the progress bar track.
43-
*/
44-
trackTintColor?: ?ColorValue,
45-
46-
/**
47-
* A stretchable image to display as the progress bar.
48-
*/
49-
progressImage?: ?ImageSource,
50-
51-
/**
52-
* A stretchable image to display behind the progress bar.
53-
*/
54-
trackImage?: ?ImageSource,
55-
|}>;
56-
57-
/**
58-
* Use `ProgressViewIOS` to render a UIProgressView on iOS.
59-
*/
60-
const ProgressViewIOS = (
61-
props: Props,
62-
forwardedRef?: ?React.Ref<typeof RCTProgressViewNativeComponent>,
63-
) => (
64-
<RCTProgressViewNativeComponent
65-
{...props}
66-
style={[styles.progressView, props.style]}
67-
ref={forwardedRef}
68-
/>
69-
);
70-
71-
const styles = StyleSheet.create({
72-
progressView: {
73-
height: 2,
74-
},
75-
});
76-
77-
const ProgressViewIOSWithRef = React.forwardRef(ProgressViewIOS);
78-
79-
/* $FlowFixMe(>=0.89.0 site=react_native_ios_fb) This comment suppresses an
80-
* error found when Flow v0.89 was deployed. To see the error, delete this
81-
* comment and run Flow. */
82-
module.exports = (ProgressViewIOSWithRef: typeof RCTProgressViewNativeComponent);
13+
/* $FlowFixMe allow macOS to share iOS file */
14+
const ProgressViewIOSWithRef = require('./ProgressViewIOS.ios');
15+
module.exports = ProgressViewIOSWithRef;

Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.macos.js

Lines changed: 3 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -10,117 +10,6 @@
1010

1111
// TODO(macOS ISS#2323203)
1212

13-
'use strict';
14-
15-
import * as React from 'react';
16-
import StyleSheet from '../../StyleSheet/StyleSheet';
17-
import type {OnChangeEvent} from './RCTSegmentedControlNativeComponent';
18-
import type {ViewProps} from '../View/ViewPropTypes';
19-
import RCTSegmentedControlNativeComponent from './RCTSegmentedControlNativeComponent';
20-
import type {SyntheticEvent} from 'react-native/Libraries/Types/CoreEventTypes';
21-
22-
type SegmentedControlIOSProps = $ReadOnly<{|
23-
...ViewProps,
24-
/**
25-
* The labels for the control's segment buttons, in order.
26-
*/
27-
values?: $ReadOnlyArray<string>,
28-
/**
29-
* The index in `props.values` of the segment to be (pre)selected.
30-
*/
31-
selectedIndex?: ?number,
32-
/**
33-
* If false the user won't be able to interact with the control.
34-
* Default value is true.
35-
*/
36-
enabled?: boolean,
37-
/**
38-
* Accent color of the control.
39-
*/
40-
tintColor?: ?string,
41-
/**
42-
* If true, then selecting a segment won't persist visually.
43-
* The `onValueChange` callback will still work as expected.
44-
*/
45-
momentary?: ?boolean,
46-
/**
47-
* Callback that is called when the user taps a segment
48-
*/
49-
onChange?: ?(event: SyntheticEvent<OnChangeEvent>) => void,
50-
/**
51-
* Callback that is called when the user taps a segment;
52-
* passes the segment's value as an argument
53-
*/
54-
onValueChange?: ?(value: number) => mixed,
55-
|}>;
56-
57-
type Props = $ReadOnly<{|
58-
...SegmentedControlIOSProps,
59-
forwardedRef: ?React.Ref<typeof RCTSegmentedControlNativeComponent>,
60-
|}>;
61-
62-
/**
63-
* Use `SegmentedControlIOS` to render a UISegmentedControl iOS.
64-
*
65-
* #### Programmatically changing selected index
66-
*
67-
* The selected index can be changed on the fly by assigning the
68-
* selectedIndex prop to a state variable, then changing that variable.
69-
* Note that the state variable would need to be updated as the user
70-
* selects a value and changes the index, as shown in the example below.
71-
*
72-
* ````
73-
* <SegmentedControlIOS
74-
* values={['One', 'Two']}
75-
* selectedIndex={this.state.selectedIndex}
76-
* onChange={(event) => {
77-
* this.setState({selectedIndex: event.nativeEvent.selectedSegmentIndex});
78-
* }}
79-
* />
80-
* ````
81-
*/
82-
83-
class SegmentedControlIOS extends React.Component<Props> {
84-
static defaultProps = {
85-
values: [],
86-
enabled: true,
87-
};
88-
89-
_onChange = (event: SyntheticEvent<OnChangeEvent>) => {
90-
this.props.onChange && this.props.onChange(event);
91-
this.props.onValueChange &&
92-
this.props.onValueChange(event.nativeEvent.value);
93-
};
94-
95-
render() {
96-
const {forwardedRef, onValueChange, style, ...props} = this.props;
97-
return (
98-
<RCTSegmentedControlNativeComponent
99-
{...props}
100-
ref={forwardedRef}
101-
style={[styles.segmentedControl, style]}
102-
onChange={this._onChange}
103-
/>
104-
);
105-
}
106-
}
107-
108-
const styles = StyleSheet.create({
109-
segmentedControl: {
110-
height: 28,
111-
},
112-
});
113-
114-
const SegmentedControlIOSWithRef = React.forwardRef(
115-
(
116-
props: SegmentedControlIOSProps,
117-
forwardedRef: ?React.Ref<typeof RCTSegmentedControlNativeComponent>,
118-
) => {
119-
return <SegmentedControlIOS {...props} forwardedRef={forwardedRef} />;
120-
},
121-
);
122-
123-
/* $FlowFixMe(>=0.89.0 site=react_native_ios_fb) This comment suppresses an
124-
* error found when Flow v0.89 was deployed. To see the error, delete this
125-
* comment and run Flow. */
126-
module.exports = (SegmentedControlIOSWithRef: NativeSegmentedControlIOS);
13+
/* $FlowFixMe allow macOS to share iOS file */
14+
const SegmentedControlIOSWithRef = require('./SegmentedControlIOS.ios');
15+
module.exports = SegmentedControlIOSWithRef;

Libraries/Components/StatusBar/StatusBarIOS.macos.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,6 @@
1010

1111
// TODO(macOS ISS#2323203)
1212

13-
'use strict';
14-
15-
const NativeEventEmitter = require('../../EventEmitter/NativeEventEmitter');
16-
const {StatusBarManager} = require('../../BatchedBridge/NativeModules');
17-
18-
/**
19-
* Use `StatusBar` for mutating the status bar.
20-
*/
21-
class StatusBarIOS extends NativeEventEmitter {}
22-
23-
module.exports = new StatusBarIOS(StatusBarManager);
13+
/* $FlowFixMe allow macOS to share iOS file */
14+
const StatusBarIOS = require('./StatusBarIOS.ios');
15+
module.exports = StatusBarIOS;

Libraries/Components/TimePickerAndroid/TimePickerAndroid.macos.js

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)