Skip to content

Commit 193fc80

Browse files
committed
Merge branch 'master' into feat/new-pan-view-with-reanimated-2
* master: Upgrade eslint-plugin-uilib to version 2.0.09 Typescript/wizard move to typescript (#1390) Feat/hint add props (#1399) Separate radioGroup and radioButton to fix their packages (#1388) Typescript/connection status bar (#1384) Fix typescript migration bug, code should enter here to calcylate tip position also when width is undefined (casting to 0) (#1396) Fix an exception with hard coded color rule (#1394) Add onChange to dependency array (#1391) fix colorPicker ts error Update stale.yml Typescript/general missing typings (#1389) fix hint animation (#1363) using renderInput instead renderExpandableInput was left out (#1386) DateTimePicker - Implement theme variant prop (#1357) Infra/Migrate Incubator.WheelPicker to reanimated 2 (#1379) Remove old typings that were migrated to generatedTypes Fix Hint export in generatedType/index Update react-native-gesture-handler to version 1.10.3 Fix export of AvatarHelper in src/index.ts (#1376) ExampleScreenPresenter - fix typo (#1374)
2 parents 0978cd6 + 58dc5f1 commit 193fc80

Some content is hidden

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

45 files changed

+893
-298
lines changed

.github/stale.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ onlyLabels: []
1414
exemptLabels:
1515
- pinned
1616
- WIP
17-
- bug
18-
- "feature request"
1917
- "typescript"
2018

2119
# Set to true to ignore issues in a project (defaults to false)

demo/src/screens/ExampleScreenPresenter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function renderBooleanGroup(title, options) {
4444
marginR-s2
4545
useCustomTheme
4646
key={key}
47-
textID={key}
47+
testID={key}
4848
value={value}
4949
onValueChange={value => this.setState({[key]: value})}
5050
/>

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@ import React, {Component} from 'react';
22
import {View, Text, StyleSheet} from 'react-native';
33
import {ConnectionStatusBar, Typography, Colors} from 'react-native-ui-lib'; //eslint-disable-line
44

5+
type ConnectionStatusBarScreenState = {
6+
isConnected: boolean;
7+
};
8+
59
ConnectionStatusBar.registerGlobalOnConnectionLost(() => {
610
// console.warn('what what?!? connection has been lost');
711
});
812

9-
export default class ConnectionStatusBarScreen extends Component {
10-
constructor(props) {
13+
export default class ConnectionStatusBarScreen extends Component<{}, ConnectionStatusBarScreenState> {
14+
constructor(props: any) {
1115
super(props);
1216
this.state = {
13-
isConnected: true,
17+
isConnected: true
1418
};
1519
}
1620

@@ -25,7 +29,7 @@ export default class ConnectionStatusBarScreen extends Component {
2529
textAlign: 'center',
2630
marginBottom: 10,
2731
...Typography.text60,
28-
color: Colors.dark40,
32+
color: Colors.dark40
2933
}}
3034
>
3135
Turn your wifi on/off to see the component in action
@@ -43,6 +47,6 @@ const styles = StyleSheet.create({
4347
flex: 1,
4448
alignItems: 'center',
4549
justifyContent: 'center',
46-
paddingHorizontal: 25,
47-
},
50+
paddingHorizontal: 25
51+
}
4852
});

demo/src/screens/componentScreens/DateTimePickerScreen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export default class DateTimePickerScreen extends Component {
7070
containerStyle={{marginVertical: 20}}
7171
title={'Date'}
7272
placeholder={'Select a date'}
73-
renderExpandableInput={this.renderCustomInput}
73+
renderInput={this.renderCustomInput}
7474
dateFormat={'MMM D, YYYY'}
7575
// value={new Date('2015-03-25T12:00:00-06:30')}
7676
/>

demo/src/screens/componentScreens/HintsScreen.tsx

Lines changed: 61 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
import _ from 'lodash';
12
import React, {Component} from 'react';
23
import {Alert} from 'react-native';
3-
import {View, Text, Hint, Button, RadioGroup, RadioButton, Switch} from 'react-native-ui-lib'; //eslint-disable-line
4+
import {Colors, View, Text, Hint, Button, RadioGroup, RadioButton, Switch} from 'react-native-ui-lib';
5+
46

57
const settingsIcon = require('../../assets/icons/settings.png');
8+
const reactions = ['❤️', '😮', '😔', '😂', '😡'];
69

710
type HintScreenProps = {};
811
type HintScreenState = {
@@ -14,11 +17,14 @@ type HintScreenState = {
1417
useTargetFrame?: boolean;
1518
useSideTip?: boolean;
1619
showCustomContent?: boolean;
20+
showReactionStrip?: boolean;
21+
enableShadow?: boolean
1722
};
1823

1924
export default class HintsScreen extends Component<HintScreenProps, HintScreenState> {
2025
constructor(props: HintScreenProps) {
2126
super(props);
27+
2228
this.state = {
2329
showHint: true,
2430
useShortMessage: false,
@@ -27,20 +33,46 @@ export default class HintsScreen extends Component<HintScreenProps, HintScreenSt
2733
targetPosition: 'flex-start',
2834
// useTargetFrame: true,
2935
useSideTip: false,
30-
showCustomContent: false
36+
showCustomContent: false,
37+
showReactionStrip: false,
38+
enableShadow: false
3139
};
3240
}
3341

34-
componentDidMount() {}
35-
3642
toggleHintPosition = () => {
3743
this.setState({
3844
showBottomHint: !this.state.showBottomHint
3945
});
4046
};
4147

4248
onHintPressed = () => {
43-
alert('Hint Pressed');
49+
Alert.alert('Hint Pressed');
50+
}
51+
52+
onReactionPress = () => {
53+
Alert.alert('Reaction button pressed');
54+
}
55+
56+
renderCustomContent() {
57+
return (
58+
<Text text70 white>
59+
Click
60+
<Text onPress={() => Alert.alert('custom content :)')} text70BO red40>
61+
{' here '}
62+
</Text>
63+
for more information
64+
</Text>
65+
);
66+
}
67+
68+
renderReactionStrip() {
69+
return (
70+
<View row padding-8>
71+
{_.map(reactions, (item, index) => (
72+
<Button round link key={index} label={item} onPress={this.onReactionPress}/>
73+
))}
74+
</View>
75+
);
4476
}
4577

4678
render() {
@@ -52,12 +84,14 @@ export default class HintsScreen extends Component<HintScreenProps, HintScreenSt
5284
useShortMessage,
5385
useSideTip,
5486
useTargetFrame,
55-
showCustomContent
87+
showCustomContent,
88+
showReactionStrip,
89+
enableShadow
5690
} = this.state;
5791
const targetFrame = {x: 140, y: 100, width: 10, height: 10};
58-
const message = useShortMessage
59-
? 'Add other cool and useful stuff.'
60-
: 'Add other cool and useful stuff through adding apps to your visitors to enjoy.';
92+
const message = useShortMessage ?
93+
'Add other cool and useful stuff.' :
94+
'Add other cool and useful stuff through adding apps to your visitors to enjoy.';
6195

6296
return (
6397
<View flex>
@@ -95,16 +129,12 @@ export default class HintsScreen extends Component<HintScreenProps, HintScreenSt
95129
// edgeMargins={30}
96130
// onBackgroundPress={() => this.setState({showHint: !showHint})}
97131
customContent={
98-
showCustomContent ? (
99-
<Text text70 white>
100-
Click
101-
<Text onPress={() => Alert.alert('custom content :)')} text70BO red40>
102-
{' here '}
103-
</Text>
104-
for more information
105-
</Text>
106-
) : undefined
132+
showCustomContent ?
133+
this.renderCustomContent() : showReactionStrip ? this.renderReactionStrip() : undefined
107134
}
135+
color={!showCustomContent && showReactionStrip ? Colors.white : undefined}
136+
removePaddings={!showCustomContent && showReactionStrip}
137+
enableShadow={enableShadow}
108138
testID={'Hint'}
109139
>
110140
{!useTargetFrame && (
@@ -174,6 +204,11 @@ export default class HintsScreen extends Component<HintScreenProps, HintScreenSt
174204
<Text marginL-10>Toggle Icon</Text>
175205
</View>
176206

207+
<View row centerV marginV-10>
208+
<Switch value={enableShadow} onValueChange={value => this.setState({enableShadow: value})}/>
209+
<Text marginL-10>Toggle shadow</Text>
210+
</View>
211+
177212
<View row centerV marginV-10>
178213
<Switch value={useTargetFrame} onValueChange={value => this.setState({useTargetFrame: value})}/>
179214
<Text marginL-10>Use random position</Text>
@@ -183,6 +218,14 @@ export default class HintsScreen extends Component<HintScreenProps, HintScreenSt
183218
<Switch value={showCustomContent} onValueChange={value => this.setState({showCustomContent: value})}/>
184219
<Text marginL-10>Show custom content</Text>
185220
</View>
221+
222+
<View row centerV marginV-10>
223+
<Switch
224+
value={showReactionStrip}
225+
onValueChange={value => this.setState({showReactionStrip: value, enableShadow: true})}
226+
/>
227+
<Text marginL-10>Show reaction strip</Text>
228+
</View>
186229
</View>
187230
</View>
188231
);

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

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,30 @@ const stepTypes = _.map(Wizard.States, state => {
99
return <Text key={state}>{state}</Text>;
1010
});
1111

12-
export default class WizardScreen extends Component {
13-
constructor(props) {
14-
super(props);
12+
interface State {
13+
activeIndex: number;
14+
completedStepIndex?: number;
15+
allTypesIndex: number;
16+
selectedFlavor: string;
17+
customerName?: string;
18+
toastMessage?: string;
19+
}
1520

16-
this.state = {
17-
activeIndex: 0,
18-
completedStepIndex: undefined,
19-
allTypesIndex: 0,
20-
selectedFlavor: initialFlavor,
21-
customerName: undefined,
22-
toastMessage: undefined
23-
};
24-
}
21+
export default class WizardScreen extends Component<{}, State> {
22+
state = {
23+
activeIndex: 0,
24+
completedStepIndex: undefined,
25+
allTypesIndex: 0,
26+
selectedFlavor: initialFlavor,
27+
customerName: undefined,
28+
toastMessage: undefined
29+
};
2530

26-
onActiveIndexChanged = activeIndex => {
31+
onActiveIndexChanged = (activeIndex: number) => {
2732
this.setState({activeIndex});
2833
};
2934

30-
onAllTypesIndexChanged = allTypesIndex => {
35+
onAllTypesIndexChanged = (allTypesIndex: number) => {
3136
this.setState({allTypesIndex});
3237
};
3338

@@ -88,7 +93,7 @@ export default class WizardScreen extends Component {
8893
}
8994
};
9095

91-
renderNextButton = disabled => {
96+
renderNextButton = (disabled?: boolean) => {
9297
const {activeIndex} = this.state;
9398
const label = activeIndex === 2 ? 'done & reset' : 'next';
9499

@@ -104,12 +109,12 @@ export default class WizardScreen extends Component {
104109
);
105110
};
106111

107-
renderFlavorRadioButton = index => {
112+
renderFlavorRadioButton = (index: number) => {
108113
const value = flavors[index];
109114
return <RadioButton testID={value} marginL-10={index > 0} value={value} label={value}/>;
110115
};
111116

112-
setSelectedFlavor = selectedFlavor => {
117+
setSelectedFlavor = (selectedFlavor: string) => {
113118
this.setState({selectedFlavor});
114119
};
115120

@@ -130,7 +135,7 @@ export default class WizardScreen extends Component {
130135
);
131136
};
132137

133-
onNameEntered = customerName => {
138+
onNameEntered = (customerName: string) => {
134139
this.setState({customerName});
135140
};
136141

@@ -178,7 +183,7 @@ export default class WizardScreen extends Component {
178183
}
179184
};
180185

181-
getStepState(index) {
186+
getStepState(index: number) {
182187
const {activeIndex, completedStepIndex} = this.state;
183188
let state = Wizard.States.DISABLED;
184189
if (completedStepIndex > index - 1) {

0 commit comments

Comments
 (0)