Skip to content

Commit ae027dc

Browse files
committed
Merge branch 'master' into feat/change-tab-controller-center-selected-logic
* master: Add missing functionality for Incubator.TextField (#1121) Update all app icons sizes for iOS project Adding 'defaultSource' for image source in case of an error (#1116) DateTimePicker - adding 'headerStyle' prop to adjust iOS dialog header style (#1117) add prepush script Infra/use did update (#1119) SettingsScreen - rename to UNSAFE (#1118) Create a middleware TextField migrator to migrate people to the new TextField implementation (#1113) Fix issue with missing selected indicator in Picker items (#1065) Fix issue for Android on rn63 - when passing null as tintColor to an image, the image is not displayed (#1055) Fix issue #1052 - PickerItem ignore renderItem prop (#1054) Dialog - RN63 broke Modal's onDismiss method, this fixes our API (#1026) pass containerStyle to checkbox when there's no label render checkbox container only if there's label (#1039)
2 parents 57d42f0 + e57b534 commit ae027dc

File tree

32 files changed

+281
-77
lines changed

32 files changed

+281
-77
lines changed

demo/src/screens/SettingsScreen.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ class SettingsScreen extends Component {
3030
};
3131
}
3232

33-
async componentWillMount() {
33+
async UNSAFE_componentWillMount() {
3434
const {screens} = this.state;
3535
const defaultScreenId = await AsyncStorage.getItem('uilib.defaultScreen');
3636
const defaultScreen = _.find(screens, {value: defaultScreenId});
37-
37+
3838
const isRTLString = await AsyncStorage.getItem('uilib.isRTL');
3939
const isRTL = isRTLString === 'true';
40-
40+
4141
this.setState({defaultScreen, isRTL});
4242
}
4343

@@ -63,7 +63,7 @@ class SettingsScreen extends Component {
6363
const {defaultScreen, showRefreshMessage, isRTL, screens} = this.state;
6464
const {extraSettingsUI} = this.props;
6565
const filteredScreens = _.filter(screens, screen => !_.isUndefined(screen.value));
66-
66+
6767
return (
6868
<View flex padding-25 bg-grey80>
6969
<View flex>
@@ -82,7 +82,7 @@ class SettingsScreen extends Component {
8282
<Picker.Item key={screen.value} value={screen}/>
8383
))}
8484
</Picker>
85-
85+
8686
<View style={{borderWidth: 1, borderColor: Colors.dark70, marginTop: 40}}>
8787
<View style={[{padding: 5, borderBottomWidth: 1}, styles.block]}>
8888
<Text text80 dark20>Current layout direction</Text>

demo/src/screens/componentScreens/IncubatorTextFieldScreen.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ export default class TextFieldScreen extends Component {
146146
validationMessagePosition={errorPosition}
147147
validate={['required', 'email']}
148148
validateOnChange
149+
onChangeValidity={(isValid: boolean) => console.warn('validity changed:', isValid, Date.now())}
149150
// validateOnStart
150151
// validateOnBlur
151152
fieldStyle={styles.withUnderline}

generatedTypes/components/chip/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ declare const _default: React.ComponentClass<ViewProps & Pick<import("react-nati
313313
/**
314314
* Additional icon props
315315
*/
316-
iconProps?: Pick<ImageProps, "margin" | "marginL" | "marginT" | "marginR" | "marginB" | "marginH" | "marginV" | "style" | "testID" | "onLayout" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "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;
316+
iconProps?: Pick<ImageProps, "margin" | "marginL" | "marginT" | "marginR" | "marginB" | "marginH" | "marginV" | "style" | "testID" | "onLayout" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "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" | "errorSource"> | undefined;
317317
/**
318318
* Icon style
319319
*/

generatedTypes/components/image/index.d.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { PureComponent } from 'react';
2-
import { ImageProps as RNImageProps, ImageSourcePropType } from 'react-native';
2+
import { ImageProps as RNImageProps, ImageSourcePropType, NativeSyntheticEvent, ImageErrorEventData } from 'react-native';
33
import { ForwardRefInjectedProps, BaseComponentInjectedProps, MarginModifiers } from '../../commons/new';
44
import { OverlayTypeType } from '../overlay';
55
export declare type ImageProps = RNImageProps & MarginModifiers & {
@@ -44,14 +44,22 @@ export declare type ImageProps = RNImageProps & MarginModifiers & {
4444
* Render an overlay with custom content
4545
*/
4646
customOverlayContent?: JSX.Element;
47+
/**
48+
* Default image source in case of an error
49+
*/
50+
errorSource?: ImageSourcePropType;
4751
};
4852
declare type Props = ImageProps & ForwardRefInjectedProps & BaseComponentInjectedProps;
53+
declare type State = {
54+
error: boolean;
55+
prevSource: ImageSourcePropType;
56+
};
4957
/**
5058
* @description: Image wrapper with extra functionality like source transform and assets support
5159
* @extends: Image
5260
* @extendslink: https://facebook.github.io/react-native/docs/image.html
5361
*/
54-
declare class Image extends PureComponent<Props> {
62+
declare class Image extends PureComponent<Props, State> {
5563
static displayName: string;
5664
static defaultProps: {
5765
assetGroup: string;
@@ -64,9 +72,14 @@ declare class Image extends PureComponent<Props> {
6472
};
6573
sourceTransformer?: (props: any) => ImageSourcePropType;
6674
constructor(props: Props);
75+
static getDerivedStateFromProps(nextProps: Partial<Props>, prevState: State): {
76+
error: boolean;
77+
} | null;
6778
isGif(): boolean | undefined;
6879
shouldUseImageBackground(): boolean;
80+
getVerifiedSource(source?: ImageSourcePropType): any;
6981
getImageSource(): any;
82+
onError: (event: NativeSyntheticEvent<ImageErrorEventData>) => void;
7083
render(): JSX.Element;
7184
}
7285
export { Image };
@@ -112,6 +125,10 @@ declare const _default: React.ComponentClass<RNImageProps & Partial<Record<"marg
112125
* Render an overlay with custom content
113126
*/
114127
customOverlayContent?: JSX.Element | undefined;
128+
/**
129+
* Default image source in case of an error
130+
*/
131+
errorSource?: number | import("react-native").ImageURISource | import("react-native").ImageURISource[] | undefined;
115132
} & {
116133
useCustomTheme?: boolean | undefined;
117134
}, any>;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import React from 'react';
2+
declare const _default: React.ForwardRefExoticComponent<Pick<any, string | number | symbol> & React.RefAttributes<unknown>>;
3+
export default _default;

generatedTypes/incubator/TextField/index.d.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ export declare type TextFieldProps = MarginModifiers & PaddingModifiers & Typogr
4747
* Should validate when losing focus of TextField
4848
*/
4949
validateOnBlur?: boolean;
50+
/**
51+
* Callback for when field validity has changed
52+
*/
53+
onChangeValidity?: (isValid: boolean) => void;
5054
/**
5155
* The position of the validation message (top/bottom)
5256
*/
@@ -101,6 +105,10 @@ declare const _default: React.ComponentClass<(Partial<Record<"margin" | "marginL
101105
* Should validate when losing focus of TextField
102106
*/
103107
validateOnBlur?: boolean | undefined;
108+
/**
109+
* Callback for when field validity has changed
110+
*/
111+
onChangeValidity?: ((isValid: boolean) => void) | undefined;
104112
/**
105113
* The position of the validation message (top/bottom)
106114
*/
@@ -152,6 +160,10 @@ declare const _default: React.ComponentClass<(Partial<Record<"margin" | "marginL
152160
* Should validate when losing focus of TextField
153161
*/
154162
validateOnBlur?: boolean | undefined;
163+
/**
164+
* Callback for when field validity has changed
165+
*/
166+
onChangeValidity?: ((isValid: boolean) => void) | undefined;
155167
/**
156168
* The position of the validation message (top/bottom)
157169
*/
@@ -203,6 +215,10 @@ declare const _default: React.ComponentClass<(Partial<Record<"margin" | "marginL
203215
* Should validate when losing focus of TextField
204216
*/
205217
validateOnBlur?: boolean | undefined;
218+
/**
219+
* Callback for when field validity has changed
220+
*/
221+
onChangeValidity?: ((isValid: boolean) => void) | undefined;
206222
/**
207223
* The position of the validation message (top/bottom)
208224
*/
@@ -254,6 +270,10 @@ declare const _default: React.ComponentClass<(Partial<Record<"margin" | "marginL
254270
* Should validate when losing focus of TextField
255271
*/
256272
validateOnBlur?: boolean | undefined;
273+
/**
274+
* Callback for when field validity has changed
275+
*/
276+
onChangeValidity?: ((isValid: boolean) => void) | undefined;
257277
/**
258278
* The position of the validation message (top/bottom)
259279
*/

generatedTypes/incubator/TextField/useFieldState.d.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ export interface FieldStateProps extends TextInputProps {
88
* A single or multiple validator. Can be a string (required, email) or custom function.
99
*/
1010
validate?: Validator | Validator[];
11+
/**
12+
* Callback for when field validity has changed
13+
*/
14+
onChangeValidity?: (isValid: boolean) => void;
1115
}
12-
export default function useFieldState({ validate, validateOnBlur, validateOnChange, validateOnStart, ...props }: FieldStateProps): {
16+
export default function useFieldState({ validate, validateOnBlur, validateOnChange, validateOnStart, onChangeValidity, ...props }: FieldStateProps): {
1317
onFocus: (...args: any) => void;
1418
onBlur: (...args: any) => void;
1519
onChangeText: (text: any) => void;

generatedTypes/incubator/TextField/usePreset.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ export default function usePreset({ preset, ...props }: InternalTextFieldProps):
204204
validateOnStart?: boolean | undefined;
205205
validateOnChange?: boolean | undefined;
206206
validateOnBlur?: boolean | undefined;
207+
onChangeValidity?: ((isValid: boolean) => void) | undefined;
207208
fieldStyle?: import("react-native").ViewStyle | undefined;
208209
containerStyle?: import("react-native").ViewStyle | undefined;
209210
modifiers: import("../../commons/modifiers").ExtractedStyle;
@@ -581,6 +582,7 @@ export default function usePreset({ preset, ...props }: InternalTextFieldProps):
581582
validateOnStart?: boolean | undefined;
582583
validateOnChange?: boolean | undefined;
583584
validateOnBlur?: boolean | undefined;
585+
onChangeValidity?: ((isValid: boolean) => void) | undefined;
584586
fieldStyle?: import("react-native").ViewStyle | undefined;
585587
containerStyle?: import("react-native").ViewStyle | undefined;
586588
modifiers: import("../../commons/modifiers").ExtractedStyle;
@@ -1078,6 +1080,7 @@ export default function usePreset({ preset, ...props }: InternalTextFieldProps):
10781080
validateOnStart?: boolean | undefined;
10791081
validateOnChange?: boolean | undefined;
10801082
validateOnBlur: boolean;
1083+
onChangeValidity?: ((isValid: boolean) => void) | undefined;
10811084
fieldStyle: import("react-native").ViewStyle | {
10821085
borderBottomWidth: number;
10831086
borderBottomColor: string;
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Lines changed: 57 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,116 @@
11
{
22
"images" : [
33
{
4+
"filename" : "40.png",
45
"idiom" : "iphone",
5-
"size" : "20x20",
6-
"scale" : "2x"
6+
"scale" : "2x",
7+
"size" : "20x20"
78
},
89
{
10+
"filename" : "60.png",
911
"idiom" : "iphone",
10-
"size" : "20x20",
11-
"scale" : "3x"
12+
"scale" : "3x",
13+
"size" : "20x20"
1214
},
1315
{
16+
"filename" : "58.png",
1417
"idiom" : "iphone",
15-
"size" : "29x29",
16-
"scale" : "2x"
18+
"scale" : "2x",
19+
"size" : "29x29"
1720
},
1821
{
22+
"filename" : "87.png",
1923
"idiom" : "iphone",
20-
"size" : "29x29",
21-
"scale" : "3x"
24+
"scale" : "3x",
25+
"size" : "29x29"
2226
},
2327
{
28+
"filename" : "80.png",
2429
"idiom" : "iphone",
25-
"size" : "40x40",
26-
"scale" : "2x"
30+
"scale" : "2x",
31+
"size" : "40x40"
2732
},
2833
{
34+
"filename" : "120-1.png",
2935
"idiom" : "iphone",
30-
"size" : "40x40",
31-
"scale" : "3x"
36+
"scale" : "3x",
37+
"size" : "40x40"
3238
},
3339
{
34-
"size" : "60x60",
35-
"idiom" : "iphone",
3640
"filename" : "120.png",
37-
"scale" : "2x"
41+
"idiom" : "iphone",
42+
"scale" : "2x",
43+
"size" : "60x60"
3844
},
3945
{
40-
"size" : "60x60",
41-
"idiom" : "iphone",
4246
"filename" : "180.png",
43-
"scale" : "3x"
47+
"idiom" : "iphone",
48+
"scale" : "3x",
49+
"size" : "60x60"
4450
},
4551
{
52+
"filename" : "20.png",
4653
"idiom" : "ipad",
47-
"size" : "20x20",
48-
"scale" : "1x"
54+
"scale" : "1x",
55+
"size" : "20x20"
4956
},
5057
{
58+
"filename" : "40-1.png",
5159
"idiom" : "ipad",
52-
"size" : "20x20",
53-
"scale" : "2x"
60+
"scale" : "2x",
61+
"size" : "20x20"
5462
},
5563
{
64+
"filename" : "29.png",
5665
"idiom" : "ipad",
57-
"size" : "29x29",
58-
"scale" : "1x"
66+
"scale" : "1x",
67+
"size" : "29x29"
5968
},
6069
{
70+
"filename" : "58-1.png",
6171
"idiom" : "ipad",
62-
"size" : "29x29",
63-
"scale" : "2x"
72+
"scale" : "2x",
73+
"size" : "29x29"
6474
},
6575
{
76+
"filename" : "40-2.png",
6677
"idiom" : "ipad",
67-
"size" : "40x40",
68-
"scale" : "1x"
78+
"scale" : "1x",
79+
"size" : "40x40"
6980
},
7081
{
82+
"filename" : "80-1.png",
7183
"idiom" : "ipad",
72-
"size" : "40x40",
73-
"scale" : "2x"
84+
"scale" : "2x",
85+
"size" : "40x40"
7486
},
7587
{
76-
"size" : "76x76",
77-
"idiom" : "ipad",
7888
"filename" : "76.png",
79-
"scale" : "1x"
89+
"idiom" : "ipad",
90+
"scale" : "1x",
91+
"size" : "76x76"
8092
},
8193
{
82-
"size" : "76x76",
83-
"idiom" : "ipad",
8494
"filename" : "152.png",
85-
"scale" : "2x"
95+
"idiom" : "ipad",
96+
"scale" : "2x",
97+
"size" : "76x76"
8698
},
8799
{
88-
"size" : "83.5x83.5",
89-
"idiom" : "ipad",
90100
"filename" : "167.png",
91-
"scale" : "2x"
101+
"idiom" : "ipad",
102+
"scale" : "2x",
103+
"size" : "83.5x83.5"
92104
},
93105
{
106+
"filename" : "1024.png",
94107
"idiom" : "ios-marketing",
95-
"size" : "1024x1024",
96-
"scale" : "1x"
108+
"scale" : "1x",
109+
"size" : "1024x1024"
97110
}
98111
],
99112
"info" : {
100-
"version" : 1,
101-
"author" : "xcode"
113+
"author" : "xcode",
114+
"version" : 1
102115
}
103-
}
116+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"build:exports": "./node_modules/.bin/babel src --out-dir src --config-file ./src/.babelrc.json --extensions '.ts,.tsx' --ignore 'src/index.ts'",
3131
"build:packages": "node scripts/buildPackages.js",
3232
"build": "tsc --p tsconfig.build.json && npm run build:exports && npm run build:packages",
33+
"prepush": "npm run build:dev && npm run test",
3334
"log": "react-native log-ios | grep 'ethan -'",
3435
"docs:install": "(cd ./uilib-docs && rm -rf node_modules && rm -rf package-lock.json && npm install)",
3536
"docs:deploy": "(cd ./uilib-docs && gatsby build --prefix-paths && gh-pages -d public --branch gh-pages)",

0 commit comments

Comments
 (0)