Skip to content

Commit 63edf59

Browse files
authored
chore: update lint config (#60)
* chore: update lint config * chore: update screenshot url
1 parent 9dda8b9 commit 63edf59

File tree

6 files changed

+876
-498
lines changed

6 files changed

+876
-498
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,6 @@ example/android-bundle.js
5555
example/ios-bundle.js
5656
index.android.bundle
5757
index.ios.bundle
58+
59+
# Eslint Cache
60+
.eslintcache

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
React Native SegmentedControlIOS library. Use SegmentedControlIOS to render a UISegmentedControl iOS.
66

7-
<img src="https://github.com/react-native-community/segmented-control/blob/master/ScreenShots/Screen%20Shot%202019-02-26%20at%206.28.55%20PM.png" height="500" />
7+
<img src="https://user-images.githubusercontent.com/6936373/71608757-dc6ef680-2bc6-11ea-85be-aa31f25ecf36.png" height="500" />
88

99
## Getting started
1010

@@ -72,7 +72,7 @@ return (
7272
<SegmentedControlIOS
7373
values={['One', 'Two']}
7474
selectedIndex={this.state.selectedIndex}
75-
onChange={event => {
75+
onChange={(event) => {
7676
this.setState({selectedIndex: event.nativeEvent.selectedSegmentIndex});
7777
}}
7878
/>
@@ -152,8 +152,8 @@ Accent color of the control.
152152
Text color of the control. (iOS 13+ only)
153153

154154
| Type | Required | Supported Version |
155-
| ------ | -------- | ----- |
156-
| string | No | iOS 13+ |
155+
| ------ | -------- | ----------------- |
156+
| string | No | iOS 13+ |
157157

158158
---
159159

@@ -162,8 +162,8 @@ Text color of the control. (iOS 13+ only)
162162
Text color of the active control. (iOS 13+ only)
163163

164164
| Type | Required | Supported Version |
165-
| ------ | -------- | ----- |
166-
| string | No | iOS 13+ |
165+
| ------ | -------- | ----------------- |
166+
| string | No | iOS 13+ |
167167

168168
---
169169

@@ -172,8 +172,8 @@ Text color of the active control. (iOS 13+ only)
172172
Background color color of the control. (iOS 13+ only)
173173

174174
| Type | Required | Supported Version |
175-
| ------ | -------- | ----- |
176-
| string | No | iOS 13+ |
175+
| ------ | -------- | ----------------- |
176+
| string | No | iOS 13+ |
177177

178178
---
179179

@@ -185,7 +185,6 @@ The labels for the control's segment buttons, in order.
185185
| --------------- | -------- |
186186
| array of string | No |
187187

188-
189188
## Maintainers
190189

191190
- [M.Haris Baig](https://github.com/harisbaig100)
Binary file not shown.

example/App.js

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,31 @@ export default class App extends React.Component<{}, $FlowFixMeState> {
1818

1919
render() {
2020
return (
21-
<ScrollView contentContainerStyle={{paddingTop: 80}}>
22-
<View style={{marginBottom: 10}}>
21+
<ScrollView contentContainerStyle={styles.container}>
22+
<View style={styles.segmentContainer}>
2323
<Text style={styles.text}>Segmented controls can have values</Text>
2424
<SegmentedControlIOS values={['One', 'Two']} />
2525
</View>
2626

27-
<View style={{marginBottom: 25}}>
27+
<View style={styles.segmentSection}>
2828
<SegmentedControlIOS
2929
values={['One', 'Two', 'Three', 'Four', 'Five']}
3030
/>
3131
</View>
3232

33-
<View style={{marginBottom: 25}}>
33+
<View style={styles.segmentSection}>
3434
<Text style={styles.text}>
3535
Segmented controls can have pre-selected values
3636
</Text>
3737
<SegmentedControlIOS values={['One', 'Two']} selectedIndex={0} />
3838
</View>
3939

40-
<View style={{marginBottom: 25}}>
40+
<View style={styles.segmentSection}>
4141
<Text style={styles.text}>Segmented controls can be momentary</Text>
4242
<SegmentedControlIOS values={['One', 'Two']} momentary={true} />
4343
</View>
4444

45-
<View style={{marginBottom: 25}}>
45+
<View style={styles.segmentSection}>
4646
<Text style={styles.text}>Segmented controls can be disabled</Text>
4747
<SegmentedControlIOS
4848
enabled={false}
@@ -51,7 +51,7 @@ export default class App extends React.Component<{}, $FlowFixMeState> {
5151
/>
5252
</View>
5353

54-
<View style={{marginBottom: 10}}>
54+
<View style={styles.segmentContainer}>
5555
<Text style={styles.text}>Custom colors can be provided</Text>
5656
<SegmentedControlIOS
5757
tintColor="#ff0000"
@@ -60,14 +60,14 @@ export default class App extends React.Component<{}, $FlowFixMeState> {
6060
backgroundColor="#0000ff"
6161
/>
6262
</View>
63-
<View style={{marginBottom: 10}}>
63+
<View style={styles.segmentContainer}>
6464
<SegmentedControlIOS
6565
tintColor="#00ff00"
6666
values={['One', 'Two', 'Three']}
6767
selectedIndex={1}
6868
/>
6969
</View>
70-
<View style={{marginBottom: 25}}>
70+
<View style={styles.segmentSection}>
7171
<SegmentedControlIOS
7272
textColor="#ff00ff"
7373
values={['One', 'Two']}
@@ -77,27 +77,29 @@ export default class App extends React.Component<{}, $FlowFixMeState> {
7777

7878
<View>
7979
<Text style={styles.text}>Custom colors can be provided</Text>
80-
<SegmentedControlIOS
81-
values={this.state.values}
82-
selectedIndex={this.state.selectedIndex}
83-
onChange={this._onChange}
84-
onValueChange={this._onValueChange}
85-
/>
86-
<Text style={[styles.text, {marginTop: 10}]}>
80+
<View style={styles.segmentContainer}>
81+
<SegmentedControlIOS
82+
values={this.state.values}
83+
selectedIndex={this.state.selectedIndex}
84+
onChange={this._onChange}
85+
onValueChange={this._onValueChange}
86+
/>
87+
</View>
88+
<Text style={[styles.text]}>
8789
Value: {this.state.value} Index: {this.state.selectedIndex}
8890
</Text>
8991
</View>
9092
</ScrollView>
9193
);
9294
}
9395

94-
_onChange = event => {
96+
_onChange = (event) => {
9597
this.setState({
9698
selectedIndex: event.nativeEvent.selectedSegmentIndex,
9799
});
98100
};
99101

100-
_onValueChange = value => {
102+
_onValueChange = (value) => {
101103
this.setState({
102104
value: value,
103105
});
@@ -111,4 +113,13 @@ const styles = StyleSheet.create({
111113
fontWeight: '500',
112114
margin: 10,
113115
},
116+
segmentContainer: {
117+
marginBottom: 10,
118+
},
119+
segmentSection: {
120+
marginBottom: 25,
121+
},
122+
container: {
123+
paddingTop: 80,
124+
},
114125
});

package.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"start": "node node_modules/react-native/local-cli/cli.js start",
1515
"test": "yarn flow && yarn lint",
1616
"flow": "flow",
17-
"lint": "eslint .",
17+
"lint": "eslint . --cache",
1818
"tsc": "tsc --noEmit"
1919
},
2020
"peerDependencies": {
@@ -24,26 +24,25 @@
2424
"devDependencies": {
2525
"@babel/core": "^7.4.0",
2626
"@babel/runtime": "^7.4.2",
27-
"@react-native-community/eslint-config": "^0.0.5",
27+
"@react-native-community/eslint-config": "^1.0.0",
2828
"@semantic-release/git": "^8.0.0",
2929
"@types/react": "^16.9.17",
30-
"@types/react-native": "0.60.26",
31-
"babel-eslint": "^10.0.1",
30+
"@types/react-native": "^0.62.1",
31+
"babel-eslint": "^10.1.0",
3232
"babel-jest": "^25.1.0",
3333
"eslint": "^6.8.0",
3434
"eslint-plugin-prettier": "^3.1.2",
3535
"flow-bin": "0.105.2",
3636
"husky": "^4.0.10",
37-
"jest": "^25.1.0",
37+
"jest": "^25.2.4",
3838
"lint-staged": "^10.0.0",
3939
"metro-react-native-babel-preset": "0.56.0",
40-
"prettier": "^1.19.1",
4140
"react": "16.9.0",
4241
"react-native": "0.61.5",
4342
"react-test-renderer": "16.9.0",
44-
"rimraf": "^2.6.3",
43+
"rimraf": "^3.0.2",
4544
"semantic-release": "^17.0.4",
46-
"typescript": "^3.3.3"
45+
"typescript": "^3.8.3"
4746
},
4847
"jest": {
4948
"preset": "react-native",

0 commit comments

Comments
 (0)