Skip to content

Commit 064c981

Browse files
committed
Merge branch 'master' of https://github.com/Naturalclar/react-native-segmented-control into chore/addMissingTypes
2 parents 5d20125 + f9fdb94 commit 064c981

File tree

10 files changed

+56
-30
lines changed

10 files changed

+56
-30
lines changed

.circleci/config.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ aliases:
7777
# name: Jest Unit Tests
7878
# command: yarn test:jest
7979

80+
- &tsc
81+
name: TypeScript type check
82+
command: yarn tsc
83+
8084
# -------------------------
8185
# JOBS
8286
# -------------------------
@@ -117,6 +121,13 @@ jobs:
117121
# at: ~/react-native-segmented-control
118122
# - run: *jest
119123

124+
tsc:
125+
<<: *linux_defaults
126+
steps:
127+
- attach_workspace:
128+
at: ~/react-native-segmented-control
129+
- run: *tsc
130+
120131
android-compile:
121132
<<: *android_defaults
122133
steps:
@@ -175,6 +186,9 @@ workflows:
175186
# - jest:
176187
# requires:
177188
# - linux-checkout
189+
- tsc:
190+
requires:
191+
- linux-checkout
178192
- android-compile:
179193
requires:
180194
- linux-checkout
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#import <React/RCTComponent.h>
1111

12-
@interface RCTSegmentedControl : UISegmentedControl
12+
@interface RNCSegmentedControl : UISegmentedControl
1313

1414
@property (nonatomic, copy) NSArray<NSString *> *values;
1515
@property (nonatomic, assign) NSInteger selectedIndex;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "RCTSegmentedControl.h"
8+
#import "RNCSegmentedControl.h"
99

1010
#import "RCTConvert.h"
1111
#import "RCTEventDispatcher.h"
1212
#import "UIView+React.h"
1313

14-
@implementation RCTSegmentedControl
14+
@implementation RNCSegmentedControl
1515

1616
- (instancetype)initWithFrame:(CGRect)frame
1717
{

ios/RCTSegmentedControl.xcodeproj/project.pbxproj renamed to ios/RNCSegmentedControl.xcodeproj/project.pbxproj

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
B3E7B58A1CC2AC0600A0062D /* RCTSegmentedControl.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RCTSegmentedControl.m */; };
10+
B3E7B58A1CC2AC0600A0062D /* RNCSegmentedControl.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNCSegmentedControl.m */; };
1111
/* End PBXBuildFile section */
1212

1313
/* Begin PBXCopyFilesBuildPhase section */
@@ -23,9 +23,9 @@
2323
/* End PBXCopyFilesBuildPhase section */
2424

2525
/* Begin PBXFileReference section */
26-
134814201AA4EA6300B7C361 /* libRCTSegmentedControl.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTSegmentedControl.a; sourceTree = BUILT_PRODUCTS_DIR; };
27-
B3E7B5881CC2AC0600A0062D /* RCTSegmentedControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTSegmentedControl.h; sourceTree = "<group>"; };
28-
B3E7B5891CC2AC0600A0062D /* RCTSegmentedControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSegmentedControl.m; sourceTree = "<group>"; };
26+
134814201AA4EA6300B7C361 /* libRNCSegmentedControl.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNCSegmentedControl.a; sourceTree = BUILT_PRODUCTS_DIR; };
27+
B3E7B5881CC2AC0600A0062D /* RNCSegmentedControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNCSegmentedControl.h; sourceTree = "<group>"; };
28+
B3E7B5891CC2AC0600A0062D /* RNCSegmentedControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNCSegmentedControl.m; sourceTree = "<group>"; };
2929
/* End PBXFileReference section */
3030

3131
/* Begin PBXFrameworksBuildPhase section */
@@ -42,26 +42,26 @@
4242
134814211AA4EA7D00B7C361 /* Products */ = {
4343
isa = PBXGroup;
4444
children = (
45-
134814201AA4EA6300B7C361 /* libRCTSegmentedControl.a */,
45+
134814201AA4EA6300B7C361 /* libRNCSegmentedControl.a */,
4646
);
4747
name = Products;
4848
sourceTree = "<group>";
4949
};
5050
58B511D21A9E6C8500147676 = {
5151
isa = PBXGroup;
5252
children = (
53-
B3E7B5881CC2AC0600A0062D /* RCTSegmentedControl.h */,
54-
B3E7B5891CC2AC0600A0062D /* RCTSegmentedControl.m */,
53+
B3E7B5881CC2AC0600A0062D /* RNCSegmentedControl.h */,
54+
B3E7B5891CC2AC0600A0062D /* RNCSegmentedControl.m */,
5555
134814211AA4EA7D00B7C361 /* Products */,
5656
);
5757
sourceTree = "<group>";
5858
};
5959
/* End PBXGroup section */
6060

6161
/* Begin PBXNativeTarget section */
62-
58B511DA1A9E6C8500147676 /* RCTSegmentedControl */ = {
62+
58B511DA1A9E6C8500147676 /* RNCSegmentedControl */ = {
6363
isa = PBXNativeTarget;
64-
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTSegmentedControl" */;
64+
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNCSegmentedControl" */;
6565
buildPhases = (
6666
58B511D71A9E6C8500147676 /* Sources */,
6767
58B511D81A9E6C8500147676 /* Frameworks */,
@@ -71,9 +71,9 @@
7171
);
7272
dependencies = (
7373
);
74-
name = RCTSegmentedControl;
74+
name = RNCSegmentedControl;
7575
productName = RCTDataManager;
76-
productReference = 134814201AA4EA6300B7C361 /* libRCTSegmentedControl.a */;
76+
productReference = 134814201AA4EA6300B7C361 /* libRNCSegmentedControl.a */;
7777
productType = "com.apple.product-type.library.static";
7878
};
7979
/* End PBXNativeTarget section */
@@ -90,7 +90,7 @@
9090
};
9191
};
9292
};
93-
buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTSegmentedControl" */;
93+
buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNCSegmentedControl" */;
9494
compatibilityVersion = "Xcode 3.2";
9595
developmentRegion = English;
9696
hasScannedForEncodings = 0;
@@ -102,7 +102,7 @@
102102
projectDirPath = "";
103103
projectRoot = "";
104104
targets = (
105-
58B511DA1A9E6C8500147676 /* RCTSegmentedControl */,
105+
58B511DA1A9E6C8500147676 /* RNCSegmentedControl */,
106106
);
107107
};
108108
/* End PBXProject section */
@@ -112,7 +112,7 @@
112112
isa = PBXSourcesBuildPhase;
113113
buildActionMask = 2147483647;
114114
files = (
115-
B3E7B58A1CC2AC0600A0062D /* RCTSegmentedControl.m in Sources */,
115+
B3E7B58A1CC2AC0600A0062D /* RNCSegmentedControl.m in Sources */,
116116
);
117117
runOnlyForDeploymentPostprocessing = 0;
118118
};
@@ -235,7 +235,7 @@
235235
/* End XCBuildConfiguration section */
236236

237237
/* Begin XCConfigurationList section */
238-
58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RCTSegmentedControl" */ = {
238+
58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNCSegmentedControl" */ = {
239239
isa = XCConfigurationList;
240240
buildConfigurations = (
241241
58B511ED1A9E6C8500147676 /* Debug */,
@@ -244,7 +244,7 @@
244244
defaultConfigurationIsVisible = 0;
245245
defaultConfigurationName = Release;
246246
};
247-
58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RCTSegmentedControl" */ = {
247+
58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNCSegmentedControl" */ = {
248248
isa = XCConfigurationList;
249249
buildConfigurations = (
250250
58B511F01A9E6C8500147676 /* Debug */,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77

88
#import <React/RCTViewManager.h>
99

10-
@interface RCTSegmentedControlManager : RCTViewManager
10+
@interface RNCSegmentedControlManager : RCTViewManager
1111

1212
@end
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import "RCTSegmentedControlManager.h"
8+
#import "RNCSegmentedControlManager.h"
99

1010
#import "RCTBridge.h"
1111
#import "RCTConvert.h"
12-
#import "RCTSegmentedControl.h"
12+
#import "RNCSegmentedControl.h"
1313

14-
@implementation RCTSegmentedControlManager
14+
@implementation RNCSegmentedControlManager
1515

1616
RCT_EXPORT_MODULE()
1717

1818
- (UIView *)view
1919
{
20-
return [RCTSegmentedControl new];
20+
return [RNCSegmentedControl new];
2121
}
2222

2323
RCT_EXPORT_VIEW_PROPERTY(values, NSArray<NSString *>)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,5 @@ type NativeSegmentedControlIOS = Class<
7575
>;
7676

7777
module.exports = ((requireNativeComponent(
78-
'RCTSegmentedControl',
78+
'RNCSegmentedControl',
7979
): any): NativeSegmentedControlIOS);

js/SegmentedControlIOS.ios.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {StyleSheet} from 'react-native';
1616
import type {SyntheticEvent} from 'CoreEventTypes';
1717
import type {ViewProps} from 'ViewPropTypes';
1818

19-
import RCTSegmentedControlNativeComponent from './RCTSegmentedControlNativeComponent';
19+
import RNCSegmentedControlNativeComponent from './RNCSegmentedControlNativeComponent';
2020

2121
type Event = SyntheticEvent<
2222
$ReadOnly<{|
@@ -63,7 +63,7 @@ type SegmentedControlIOSProps = $ReadOnly<{|
6363

6464
type Props = $ReadOnly<{|
6565
...SegmentedControlIOSProps,
66-
forwardedRef: ?React.Ref<typeof RCTSegmentedControlNativeComponent>,
66+
forwardedRef: ?React.Ref<typeof RNCSegmentedControlNativeComponent>,
6767
|}>;
6868

6969
/**
@@ -102,7 +102,7 @@ class SegmentedControlIOS extends React.Component<Props> {
102102
render() {
103103
const {forwardedRef, ...props} = this.props;
104104
return (
105-
<RCTSegmentedControlNativeComponent
105+
<RNCSegmentedControlNativeComponent
106106
{...props}
107107
ref={forwardedRef}
108108
style={[styles.segmentedControl, this.props.style]}
@@ -122,7 +122,7 @@ const styles = StyleSheet.create({
122122
const SegmentedControlIOSWithRef = React.forwardRef(
123123
(
124124
props: SegmentedControlIOSProps,
125-
forwardedRef: ?React.Ref<typeof RCTSegmentedControlNativeComponent>,
125+
forwardedRef: ?React.Ref<typeof RNCSegmentedControlNativeComponent>,
126126
) => {
127127
return <SegmentedControlIOS {...props} forwardedRef={forwardedRef} />;
128128
},

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"start": "node node_modules/react-native/local-cli/cli.js start",
99
"test": "yarn flow && yarn lint",
1010
"flow": "flow",
11-
"lint": "eslint ."
11+
"lint": "eslint .",
12+
"tsc": "tsc --noEmit"
1213
},
1314
"peerDependencies": {
1415
"react": "^16.0",

tsconfig.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
4+
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
5+
"lib": ["es6"],
6+
"jsx": "react" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */,
7+
/* Strict Type-Checking Options */
8+
"strict": true /* Enable all strict type-checking options. */,
9+
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
10+
}
11+
}

0 commit comments

Comments
 (0)