Skip to content

Commit 71e771a

Browse files
committed
Merge branch 'master' into release
2 parents eb67794 + 68471e8 commit 71e771a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+703
-415
lines changed

.github/ISSUE_TEMPLATE/bug-report.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,42 @@ assignees: ''
77

88
---
99

10-
**Describe the bug**
10+
### Describe the bug
11+
<!--
1112
A clear and concise description of what the bug is.
13+
-->
1214

13-
**To Reproduce**
15+
### To Reproduce
16+
<!--
1417
Steps to reproduce the behavior:
1518
1. Go to '...'
1619
2. Click on '....'
1720
3. Scroll down to '....'
1821
4. See error
22+
-->
1923

20-
**Expected behavior**
24+
### Expected behavior
25+
<!--
2126
A clear and concise description of what you expected to happen.
27+
-->
2228

23-
**Code snippet**
29+
### Code snippet
30+
<!--
2431
A code snippet that reproduce the issue.
32+
-->
2533

26-
**Screenshots**
34+
### Screenshots
35+
<!--
2736
If applicable, add screenshots to help explain your problem.
37+
-->
2838

29-
**Device (please complete the following information):**
39+
### Device (please complete the following information)
40+
<!--
3041
- Device: [e.g. iPhone6]
3142
- OS: [e.g. iOS8.1]
43+
-->
3244

33-
**Additional context**
45+
### Additional context
46+
<!--
3447
Add any other context about the problem here.
48+
-->

.github/ISSUE_TEMPLATE/docs-issue.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@ assignees: ''
77

88
---
99

10-
**Describe the bug**
10+
### Describe the bug
11+
<!--
1112
A clear and concise description of what the issue with the docs is.
13+
-->
1214

13-
**Component?**
15+
### Component?
16+
<!--
1417
Are there missing docs for a component? Which component?
18+
-->
1519

16-
**Is there a general issue with the docs site?**
20+
### Is there a general issue with the docs site?
1721

18-
**Is there an issue with the Expo snack app?**
22+
### Is there an issue with the Expo snack app?

.github/ISSUE_TEMPLATE/feature-request.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,17 @@ assignees: ''
77

88
---
99

10-
**Which component?**
10+
### Which component?
11+
<!--
12+
Which component is the feature is for?
13+
-->
1114

12-
**What is the new feature?**
15+
### What is the new feature?
16+
<!--
1317
A clear and concise description of what the required feature
18+
-->
1419

15-
**Code snippet**
20+
### Code snippet
21+
<!--
1622
How you would have use this feature? How the API will look like?
23+
-->

.github/ISSUE_TEMPLATE/question.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ assignees: ''
77

88
---
99

10-
## Ask us any question
10+
### Ask us any question
1111

1212
<!--
1313
Having trouble with using RNUILIB? Curious about a feature? Wondering about are future plans?

.github/ISSUE_TEMPLATE/typescript-issue.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ assignees: ''
77

88
---
99

10-
**Component**
10+
### Component
11+
<!--
1112
Which component has a missing or invalid typings?
13+
-->
1214

13-
**What's the issue?**
15+
### What's the issue?
16+
<!--
17+
Add relevant details
18+
-->

demo/src/screens/MenuStructure.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ export const navigationData = {
149149
title: 'Incubator (Experimental)',
150150
screens: [
151151
{title: 'Native TouchableOpacity', tags: 'touchable native', screen: 'unicorn.incubator.TouchableOpacityScreen'},
152-
{title: '(New) TextField', tags: 'text field input', screen: 'unicorn.components.IncubatorTextFieldScreen'}
152+
{title: '(New) TextField', tags: 'text field input', screen: 'unicorn.components.IncubatorTextFieldScreen'},
153+
{title: 'WheelPicker (Incubator)', tags: 'wheel picker spinner experimental', screen: 'unicorn.incubator.WheelPickerScreen'}
153154
]
154155
},
155156
Inspirations: {
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import React, {useCallback} from 'react';
2+
import {View, Text, Incubator, Colors, Typography} from 'react-native-ui-lib';
3+
import _ from 'lodash';
4+
import {ItemProps} from 'src/incubator/WheelPicker/Item';
5+
6+
// Months
7+
const months = [
8+
'January',
9+
'February',
10+
'March',
11+
'April',
12+
'May',
13+
'June',
14+
'July',
15+
'August',
16+
'September',
17+
'October',
18+
'November',
19+
'December'
20+
];
21+
22+
// Years
23+
const years = _.times(2020, i => i);
24+
25+
export default () => {
26+
27+
const onChange = useCallback((index: number, item?: ItemProps) => {
28+
console.log(item, index);
29+
}, []);
30+
31+
return (
32+
<View flex padding-page>
33+
<Text h1>Wheel Picker</Text>
34+
<View flex centerV centerH paddingT-page>
35+
<Text h3>Months</Text>
36+
<Incubator.WheelPicker
37+
onChange={onChange}
38+
activeTextColor={Colors.primary}
39+
inactiveTextColor={Colors.grey20}
40+
items={_.map(months, i => ({text: i, value: i}))}
41+
textStyle={{...Typography.text60R}}
42+
/>
43+
44+
<Text h3 marginT-s5>Years</Text>
45+
<Incubator.WheelPicker onChange={onChange} items={_.map(years, i => ({text: '' + i, value: i}))} />
46+
</View>
47+
</View>
48+
);
49+
};

demo/src/screens/incubatorScreens/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@ import {gestureHandlerRootHOC} from 'react-native-gesture-handler';
22

33
export function registerScreens(registrar) {
44
registrar('unicorn.incubator.TouchableOpacityScreen', () =>
5-
gestureHandlerRootHOC(require('./TouchableOpacityScreen').default));
5+
gestureHandlerRootHOC(require('./TouchableOpacityScreen').default)
6+
);
7+
registrar('unicorn.incubator.WheelPickerScreen', () =>
8+
gestureHandlerRootHOC(require('./WheelPickerScreen').default)
9+
);
610
}

eslint-rules/lib/rules/no-direct-import.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ module.exports = {
3131
try {
3232
const origin = context.options[0].origin;
3333
const destination = context.options[0].destination;
34-
const msg = `Do not import directly from '${origin}'. Please use '${destination}' (autofix available).`;
34+
const message = `Do not import directly from '${origin}'. Please use '${destination}' (autofix available).`;
3535
context.report({
3636
node,
37-
message: `${msg}`,
37+
message,
3838
fix(fixer) {
3939
if (node && destination) {
4040
return fixer.replaceText(node.source, `'${destination}'`);
@@ -46,7 +46,7 @@ module.exports = {
4646
}
4747
}
4848

49-
function checkImportDeclaretion(node) {
49+
function checkImportDeclaration(node) {
5050
const origin = context.options[0].origin;
5151
const source = node.source.value;
5252
if (source && origin && source === origin) {
@@ -55,7 +55,7 @@ module.exports = {
5555
}
5656

5757
return {
58-
ImportDeclaration: node => checkImportDeclaretion(node),
58+
ImportDeclaration: checkImportDeclaration
5959
};
6060
},
6161
};

eslint-rules/tests/lib/rules/no-direct-import.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,21 @@ RuleTester.setDefaultConfig({
1010

1111
const ruleTester = new RuleTester();
1212

13-
const valideExample = `import {Component} from 'another-module';`;
14-
const invalideExample = `import {Component} from 'some-module';`;
13+
const validExample = `import {Component} from 'another-module';`;
14+
const invalidExample = `import {Component} from 'some-module';`;
1515

1616
ruleTester.run('no-direct-import', rule, {
1717
valid: [
1818
{
1919
options: ruleOptions,
20-
code: valideExample,
20+
code: validExample,
2121
},
2222
],
2323
invalid: [
2424
{
2525
options: ruleOptions,
26-
code: invalideExample,
26+
code: invalidExample,
27+
output: `import {Component} from 'another-module';`,
2728
errors: [
2829
{ message: `Do not import directly from 'some-module'. Please use 'another-module' (autofix available).` },
2930
],
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
import React from 'react';
22
export default class UIComponent<P = {}, S = {}, SS = any> extends React.PureComponent<P, S, SS> {
3+
static defaultProps: any;
34
}

generatedTypes/commons/modifiers.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export declare function extractModifierProps(props: Dictionary<any>): _.Dictiona
9393
* @deprecated switch to Modifiers#extractComponentProps
9494
*/
9595
export declare function extractOwnProps(props: Dictionary<any>, ignoreProps: string[]): Pick<Partial<Dictionary<any>>, number>;
96-
export declare function extractComponentProps(component: any, props: Dictionary<any>, ignoreProps: string[]): Pick<Partial<Dictionary<any>>, number>;
96+
export declare function extractComponentProps(component: any, props: Dictionary<any>, ignoreProps?: string[]): Pick<Partial<Dictionary<any>>, number>;
9797
export declare function getThemeProps(props?: any, context?: any): any;
9898
export declare function generateModifiersStyle(options: {
9999
color: boolean;

generatedTypes/components/checkbox/index.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ export interface CheckboxProps extends TouchableOpacityProps {
1717
* The Checkbox color
1818
*/
1919
color?: string;
20+
/**
21+
* alternative Checkbox outline style
22+
*/
23+
outline?: boolean;
2024
/**
2125
* The size of the checkbox. affect both width and height
2226
*/

generatedTypes/components/chip/index.d.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import React from 'react';
2-
import { StyleProp, ViewStyle, ViewProps, ImageStyle, ImageProps, TextStyle, ImageSourcePropType } from 'react-native';
2+
import { StyleProp, ViewStyle, ViewProps, ImageStyle, TextStyle, ImageSourcePropType } from 'react-native';
33
import { AvatarProps } from '../avatar';
44
import { BadgeProps } from '../badge';
5+
import { ImageProps } from '../image';
56
import { TouchableOpacityProps } from '../touchableOpacity';
67
export declare type ChipProps = ViewProps & TouchableOpacityProps & {
78
/**
@@ -58,7 +59,7 @@ export declare type ChipProps = ViewProps & TouchableOpacityProps & {
5859
/**
5960
* Additional icon props
6061
*/
61-
iconProps?: ImageProps;
62+
iconProps?: Omit<ImageProps, 'source'>;
6263
/**
6364
* Icon style
6465
*/
@@ -160,7 +161,7 @@ declare const _default: React.ComponentClass<ViewProps & Pick<import("react-nati
160161
/**
161162
* Additional icon props
162163
*/
163-
iconProps?: ImageProps | undefined;
164+
iconProps?: Pick<ImageProps, "margin" | "marginL" | "marginT" | "marginR" | "marginB" | "marginH" | "marginV" | "style" | "testID" | "onLayout" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityStates" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityComponentType" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityTraits" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "width" | "height" | "borderRadius" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderTopLeftRadius" | "borderTopRightRadius" | "aspectRatio" | "onError" | "onLoad" | "onLoadEnd" | "onLoadStart" | "progressiveRenderingEnabled" | "resizeMode" | "resizeMethod" | "loadingIndicatorSource" | "defaultSource" | "blurRadius" | "capInsets" | "onProgress" | "onPartialLoad" | "fadeDuration" | "cover" | "sourceTransformer" | "assetName" | "assetGroup" | "tintColor" | "supportRTL" | "overlayType" | "overlayColor" | "customOverlayContent"> | undefined;
164165
/**
165166
* Icon style
166167
*/

generatedTypes/components/drawer/Swipeable.d.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component } from 'react';
22
import { Animated } from 'react-native';
3-
export declare type PropType = {
3+
declare type Props = {
44
children: any;
55
friction: number;
66
leftThreshold?: number;
@@ -42,7 +42,8 @@ declare type StateType = {
4242
rightOffset: number | typeof undefined;
4343
rowWidth: number | typeof undefined;
4444
};
45-
export default class Swipeable extends Component<PropType, StateType> {
45+
export declare type SwipeableProps = Props;
46+
export default class Swipeable extends Component<Props, StateType> {
4647
static displayName: string;
4748
static defaultProps: {
4849
friction: number;
@@ -51,7 +52,7 @@ export default class Swipeable extends Component<PropType, StateType> {
5152
fullLeftThreshold: number;
5253
fullRightThreshold: number;
5354
};
54-
constructor(props: PropType);
55+
constructor(props: Props);
5556
_handleDrag: (e: any) => void;
5657
getTransX: () => Animated.AnimatedInterpolation;
5758
getShowLeftAction: () => Animated.Value | Animated.AnimatedInterpolation;

generatedTypes/components/drawer/index.d.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { PureComponent, RefObject } from 'react';
22
import { Animated, ViewStyle, TextStyle } from 'react-native';
3-
import Swipeable, { PropType as SwipeableProps } from './Swipeable';
3+
import Swipeable, { SwipeableProps } from './Swipeable';
44
interface ItemProps {
55
width?: number;
66
background?: string;
@@ -11,7 +11,7 @@ interface ItemProps {
1111
style?: ViewStyle;
1212
testID?: string;
1313
}
14-
interface DrawerProps {
14+
interface Props {
1515
/**
1616
* The drawer animation bounciness
1717
*/
@@ -92,14 +92,32 @@ interface DrawerProps {
9292
* Style
9393
*/
9494
style?: ViewStyle;
95+
/**
96+
* Callback for open action
97+
*/
98+
onSwipeableWillOpen?: Function;
99+
/**
100+
* Callback for close action
101+
*/
102+
onSwipeableWillClose?: Function;
103+
/**
104+
* Custom value of any type to pass on to the component and receive back in the action callbacks
105+
*/
106+
customValue?: any;
107+
/**
108+
* Used as testing identifier
109+
*/
110+
testID?: string;
95111
}
112+
export declare type DrawerProps = Props;
113+
export declare type DrawerItemProps = ItemProps;
96114
/**
97115
* @description: Drawer Component
98116
* @important: If your app works with RNN, your screen must be wrapped
99117
* with gestureHandlerRootHOC from 'react-native-gesture-handler'. see
100118
* @importantLink: https://kmagiera.github.io/react-native-gesture-handler/docs/getting-started.html#with-wix-react-native-navigation-https-githubcom-wix-react-native-navigation
101119
*/
102-
declare class Drawer extends PureComponent<DrawerProps> {
120+
declare class Drawer extends PureComponent<Props> {
103121
static displayName: string;
104122
static defaultProps: {
105123
itemsTintColor: string;
@@ -137,7 +155,7 @@ declare class Drawer extends PureComponent<DrawerProps> {
137155
private renderAction;
138156
render(): JSX.Element;
139157
}
140-
declare const _default: React.ComponentClass<DrawerProps & {
158+
declare const _default: React.ComponentClass<Props & {
141159
useCustomTheme?: boolean | undefined;
142160
}, any> & typeof Drawer;
143161
export default _default;

generatedTypes/components/floatingButton/index.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ export interface FloatingButtonProps {
2929
* Whether to show background overlay
3030
*/
3131
hideBackgroundOverlay?: boolean;
32+
/**
33+
* Used as testing identifier
34+
*/
35+
testID?: string;
3236
}
3337
declare const _default: React.ComponentClass<FloatingButtonProps & {
3438
useCustomTheme?: boolean | undefined;

0 commit comments

Comments
 (0)