Skip to content

Commit 8aaccdd

Browse files
committed
Merge branch 'master' into feat/change-tab-controller-center-selected-logic
* master: Fix lint error cleanup eslintrc file Infra/useDidUpdate (#1112) Support UI presets for Incubator.TextField and set a 'default' preset (#1111) Fix lint issues fix radioButton lint errors and generate types Fix/imageSource deprecation (#1115) Typescript/tab controller move to function component (#1098) Feat/radio button customize styling (#1092) bug fixes for TabBar refactor (#1106) Update ios target to 11 prettify file Fix icon size in badges example screen (#1104) icon prop - fix type to be both number and object. (#1086) enable eslint on both ts and js files (#1101) fix eslint (#1107) # Conflicts: # demo/src/screens/componentScreens/FaderScreen.tsx # src/components/fader/index.tsx # src/components/tabController/FadedScrollView.tsx # src/components/tabController/TabBar.tsx
2 parents cd65641 + 92def0c commit 8aaccdd

File tree

35 files changed

+1821
-413
lines changed

35 files changed

+1821
-413
lines changed

.eslintignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
/src/style/typography.js
2-
**/*.ts
3-
**/*.tsx
1+
/src/style/typography.js

.eslintrc.js

Lines changed: 23 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,44 @@
11
module.exports = {
22
extends: ['plugin:@typescript-eslint/recommended', 'wix/react-native', 'plugin:react-hooks/recommended'],
33
parser: '@typescript-eslint/parser',
4+
// plugins: ['@typescript-eslint'],
45
rules: {
6+
/* Disabled rules for typescript */
7+
'no-dupe-class-members': 'off',
8+
/* Other Rules */
9+
'no-unused-expressions': 'off',
510
'arrow-parens': 'off',
611
// TODO: remove after migration of legacy lifecycle methods
712
camelcase: 'off',
813
'comma-dangle': ['error', 'never'],
914
'no-mixed-operators': ['off'],
1015
'no-trailing-spaces': 'off',
1116
'operator-linebreak': 'off',
12-
'max-len': ['warn', {code: 120, "ignoreComments": true, "ignoreStrings": true}],
17+
'max-len': ['warn', {code: 120, ignoreComments: true, ignoreStrings: true}],
1318
'react/jsx-no-bind': [
1419
'off',
1520
{
1621
ignoreRefs: true,
1722
allowArrowFunctions: false,
18-
allowBind: false,
19-
},
23+
allowBind: false
24+
}
2025
],
2126
'function-paren-newline': ['warn', 'never'],
2227
'new-cap': ['off'], // TODO: fix this in colors.js and remove this
2328
'default-case': ['off'],
24-
"@typescript-eslint/no-use-before-define": 0,
25-
"@typescript-eslint/explicit-function-return-type": 0,
26-
"@typescript-eslint/no-var-requires": 0,
27-
"@typescript-eslint/no-explicit-any": 0,
28-
"@typescript-eslint/member-delimiter-style": 0,
29-
// "@typescript-eslint/no-unused-vars": [2, {"args": "all", "argsIgnorePattern": "^_"}],
30-
"@typescript-eslint/no-unused-vars": 0, //todo: uncomment this line and use the the better unused rule above ^
31-
"@typescript-eslint/no-non-null-assertion": 0,
32-
"@typescript-eslint/explicit-member-accessibility": 0,
33-
"@typescript-eslint/prefer-optional-chain": "error",
34-
"@typescript-eslint/ban-ts-ignore": 0,
35-
"@typescript-eslint/no-empty-function": 0,
36-
"@typescript-eslint/camelcase": 0,
37-
"@typescript-eslint/indent": 0
38-
},
39-
plugins: ['@typescript-eslint'],
29+
'@typescript-eslint/no-use-before-define': 0,
30+
'@typescript-eslint/explicit-function-return-type': 0,
31+
'@typescript-eslint/no-var-requires': 0,
32+
'@typescript-eslint/no-explicit-any': 0,
33+
'@typescript-eslint/member-delimiter-style': 0,
34+
'@typescript-eslint/no-unused-vars': [2, {args: 'all', argsIgnorePattern: '^_'}],
35+
// "@typescript-eslint/no-unused-vars": 0, //todo: uncomment this line and use the the better unused rule above ^
36+
'@typescript-eslint/no-non-null-assertion': 0,
37+
'@typescript-eslint/explicit-member-accessibility': 0,
38+
'@typescript-eslint/prefer-optional-chain': 'error',
39+
'@typescript-eslint/ban-ts-ignore': 0,
40+
'@typescript-eslint/no-empty-function': 0,
41+
'@typescript-eslint/camelcase': 0,
42+
'@typescript-eslint/indent': 0
43+
}
4044
};
41-
42-
// OLD ESlint configuration
43-
// const validColors = require('./src/style/colorsPalette').colorsPalette;
44-
// const extraFixColorsMap = require('./src/style/colorsPalette').extraFixColorsMap;
45-
// const assetsDepJson = require('./eslint-rules/tests/assets_deprecation.json');
46-
// const deprecationsJson = require('./eslint-rules/tests/component_deprecation.json');
47-
48-
// module.exports = {
49-
// parser: 'babel-eslint',
50-
// extends: 'wix/react-native',
51-
// // plugins: ['react', 'react-native', 'uilib'],
52-
// // extends: ['airbnb'],
53-
// rules: {
54-
// 'arrow-body-style': 'off',
55-
// 'arrow-parens': 'off',
56-
// // TODO: remove after migration of legacy lifecycle methods
57-
// 'camelcase': 'off',
58-
// 'class-methods-use-this': 'off',
59-
// 'consistent-return': 'off',
60-
// 'comma-dangle': 'off',
61-
// 'global-require': 'off',
62-
// 'max-len': [2, 130, 4, {ignoreUrls: true}],
63-
// 'no-nested-ternary': 'off',
64-
// 'no-else-return': 'off',
65-
// 'no-mixed-operators': ['off'],
66-
// 'no-param-reassign': ['warn'],
67-
// 'no-plusplus': 'off',
68-
// 'no-return-assign': 'off',
69-
// 'no-trailing-spaces': 'off',
70-
// 'no-use-before-define': 'off',
71-
// 'no-unneeded-ternary': 'off',
72-
// 'no-mixed-operators': 'off',
73-
// 'no-underscore-dangle': ['error', {'allowAfterThis': true}],
74-
// 'object-curly-spacing': 'off',
75-
// 'operator-linebreak': 'off',
76-
// 'react/forbid-prop-types': 'off',
77-
// 'react/jsx-filename-extension': 'off',
78-
// 'react/jsx-space-before-closing': 'off',
79-
// 'react/jsx-tag-spacing': 'off',
80-
// 'react/prefer-stateless-function': 'off',
81-
// 'react/prop-types': ['error', {ignore: ['children', 'style', 'testID']}],
82-
// 'react/require-default-props': 'off',
83-
// "react/sort-comp": ['warn'],
84-
// 'react/jsx-no-bind': [
85-
// 'warn',
86-
// {
87-
// ignoreRefs: true,
88-
// allowArrowFunctions: false,
89-
// allowBind: false,
90-
// },
91-
// ],
92-
// 'import/prefer-default-export': 'off'
93-
// },
94-
// env: {
95-
// browser: true,
96-
// node: true,
97-
// jest: true,
98-
// },
99-
// settings: {
100-
// 'import/resolver': {
101-
// node: {
102-
// extensions: ['.js', '.ios.js', '.android.js'],
103-
// },
104-
// },
105-
// },
106-
// };

demo/src/screens/componentScreens/BadgesScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ export default class BadgesScreen extends Component {
141141
Counter Icon Badges
142142
</Text>
143143
<View row paddingH-15>
144-
<Badge marginR-10 withCounterIcon label={'9999'} labelFormatterLimit={3} icon={bell} backgroundColor={Colors.red30} iconStyle={{height: 18, width: 18}}/>
145-
<Badge marginR-10 withCounterIcon label={'4'} icon={bell} backgroundColor={Colors.red30} color={Colors.blue30} iconStyle={{height: 18, width: 18}}/>
144+
<Badge marginR-10 label={'9999'} labelFormatterLimit={3} icon={bell} backgroundColor={Colors.red30}/>
145+
<Badge marginR-10 label={'4'} icon={bell} backgroundColor={Colors.red30}/>
146146
</View>
147147

148148
</ScrollView>

demo/src/screens/componentScreens/FaderScreen.tsx

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
import _ from 'lodash';
22
import React, {Component} from 'react';
33
import {StyleSheet, ScrollView} from 'react-native';
4-
import {
5-
Constants,
6-
Colors,
7-
Text,
8-
View,
9-
Fader,
10-
withScrollReached,
11-
WithScrollReachedProps
12-
} from 'react-native-ui-lib';
4+
import {Colors, Text, View, Fader, withScrollReached, WithScrollReachedProps} from 'react-native-ui-lib';
5+
// @ts-ignore
136
import {renderHeader} from '../ExampleScreenPresenter';
147

158
const numberOfItems = 3;
@@ -18,9 +11,8 @@ const itemWidth = 100;
1811
const itemHeight = 100;
1912
const tintColor = undefined;
2013

21-
const horizontal =
22-
faderPosition === Fader.position.LEFT ||
23-
faderPosition === Fader.position.RIGHT;
14+
// @ts-ignore
15+
const horizontal = faderPosition === Fader.position.START || faderPosition === Fader.position.END;
2416

2517
class FaderScreen extends Component<WithScrollReachedProps> {
2618
renderItem = (index: number) => {
@@ -34,8 +26,7 @@ class FaderScreen extends Component<WithScrollReachedProps> {
3426
render() {
3527
const {scrollReachedProps} = this.props;
3628
const visible =
37-
faderPosition === Fader.position.BOTTOM ||
38-
(faderPosition === Fader.position.RIGHT && !Constants.isRTL)
29+
faderPosition === Fader.position.BOTTOM || faderPosition === Fader.position.END
3930
? !scrollReachedProps.isScrollAtEnd
4031
: !scrollReachedProps.isScrollAtStart;
4132

@@ -54,12 +45,7 @@ class FaderScreen extends Component<WithScrollReachedProps> {
5445
>
5546
{_.times(numberOfItems, this.renderItem)}
5647
</ScrollView>
57-
<Fader
58-
supportRTL
59-
visible={visible}
60-
position={faderPosition}
61-
tintColor={tintColor}
62-
/>
48+
<Fader visible={visible} position={faderPosition} tintColor={tintColor}/>
6349
</View>
6450
</View>
6551
</View>

demo/src/screens/componentScreens/ScrollBarScreen.js renamed to demo/src/screens/componentScreens/ScrollBarScreen.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import React, {Component} from 'react';
22
import {View, Text, ScrollBar, Button} from 'react-native-ui-lib';
3+
4+
35
class ScrollBarScreen extends Component {
46
state = {
57
selectedIndex: 0

generatedTypes/components/fader/index.d.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
/// <reference types="react" />
22
import { ImageProps } from '../image';
33
export declare enum FaderPosition {
4+
/**
5+
* @deprecated please use START instead
6+
*/
47
LEFT = "LEFT",
8+
START = "START",
9+
/**
10+
* @deprecated please use END instead
11+
*/
512
RIGHT = "RIGHT",
13+
END = "END",
614
TOP = "TOP",
715
BOTTOM = "BOTTOM"
816
}
@@ -12,7 +20,7 @@ export declare type FaderProps = Pick<ImageProps, 'supportRTL'> & {
1220
*/
1321
visible?: boolean;
1422
/**
15-
* The position of the fader (the image is different), defaults to Fader.position.RIGHT
23+
* The position of the fader (the image is different), defaults to Fader.position.END
1624
*/
1725
position?: FaderPosition;
1826
/**

generatedTypes/components/radioButton/RadioButton.d.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { TextStyle, ImageSourcePropType, ImageStyle, ViewProps } from 'react-native';
2+
import { TextStyle, StyleProp, ImageSourcePropType, ImageStyle, ViewStyle, ViewProps } from 'react-native';
33
import { RadioGroupContextProps } from './RadioGroupContext';
44
export declare type RadioButtonProps = RadioGroupContextProps & ViewProps & {
55
/**
@@ -51,9 +51,13 @@ export declare type RadioButtonProps = RadioGroupContextProps & ViewProps & {
5151
*/
5252
iconOnRight?: boolean;
5353
/**
54-
* Should the content be rendered right to the button
55-
*/
54+
* Should the content be rendered right to the button
55+
*/
5656
contentOnRight?: boolean;
57+
/**
58+
* Additional styling for the container
59+
*/
60+
containerStyle?: StyleProp<ViewStyle>;
5761
};
5862
export declare type RadioButtonPropTypes = RadioButtonProps;
5963
declare const _default: React.ComponentClass<RadioGroupContextProps & ViewProps & {
@@ -106,9 +110,13 @@ declare const _default: React.ComponentClass<RadioGroupContextProps & ViewProps
106110
*/
107111
iconOnRight?: boolean | undefined;
108112
/**
109-
* Should the content be rendered right to the button
110-
*/
113+
* Should the content be rendered right to the button
114+
*/
111115
contentOnRight?: boolean | undefined;
116+
/**
117+
* Additional styling for the container
118+
*/
119+
containerStyle?: StyleProp<ViewStyle>;
112120
} & {
113121
useCustomTheme?: boolean | undefined;
114122
}, any>;

generatedTypes/components/scrollBar/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export interface ScrollBarProps extends FlatListProps<any> {
99
/**
1010
* The element to use as a container, instead of a View
1111
*/
12-
containerView?: JSX.Element;
12+
containerView?: React.ComponentClass;
1313
/**
1414
* The props to pass the container
1515
*/

generatedTypes/hooks/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export { default as useToggleValue } from './useToggleValue';
2+
export { default as useDidUpdate } from './useDidUpdate';
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/**
2+
* This hook avoid calling useEffect on the initial value of his dependency array
3+
*/
4+
declare const useDidUpdate: (callback: () => void, dep: [any]) => void;
5+
export default useDidUpdate;

0 commit comments

Comments
 (0)