unicorn-demo-app 6.11.3 → 6.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/screens/MenuStructure.js +1 -1
- package/src/screens/PlaygroundScreen.tsx +1 -1
- package/src/screens/SettingsScreen.js +4 -2
- package/src/screens/componentScreens/ButtonsScreen.tsx +2 -2
- package/src/screens/componentScreens/GridViewScreen.tsx +3 -3
- package/src/screens/componentScreens/{PickerScreen.js → PickerScreen.tsx} +78 -67
- package/src/screens/componentScreens/{PickerScreenLongOptions.js → PickerScreenLongOptions.ts} +2 -2
- package/src/screens/componentScreens/TabControllerScreen/index.tsx +1 -1
- package/src/screens/incubatorScreens/IncubatorTextFieldScreen.tsx +23 -12
- package/src/screens/nativeComponentScreens/KeyboardTrackingViewScreen.js +19 -22
- package/src/screens/nativeComponentScreens/index.js +1 -2
- package/src/screens/nativeComponentScreens/{keyboardInput/KeyboardInputViewScreen.js → keyboardAccessory/KeyboardAccessoryViewScreen.js} +26 -22
- package/src/screens/nativeComponentScreens/{keyboardInput → keyboardAccessory}/demoKeyboards.js +4 -10
package/package.json
CHANGED
|
@@ -135,7 +135,7 @@ export const navigationData = {
|
|
|
135
135
|
tags: 'KeyboardTracking',
|
|
136
136
|
screen: 'unicorn.nativeComponents.KeyboardTrackingViewScreen'
|
|
137
137
|
},
|
|
138
|
-
{title: 'KeyboardAccessoryView', tags: 'KeyboardInput', screen: 'unicorn.nativeComponents.
|
|
138
|
+
{title: 'KeyboardAccessoryView', tags: 'KeyboardInput', screen: 'unicorn.nativeComponents.KeyboardAccessoryViewScreen'}
|
|
139
139
|
]
|
|
140
140
|
},
|
|
141
141
|
AnimationsAndGestures: {
|
|
@@ -8,7 +8,7 @@ export default class PlaygroundScreen extends Component {
|
|
|
8
8
|
return (
|
|
9
9
|
<View bg-grey80 flex padding-20>
|
|
10
10
|
<View marginT-20>
|
|
11
|
-
<TextField placeholder="Placeholder" />
|
|
11
|
+
<TextField migrate placeholder="Placeholder" />
|
|
12
12
|
</View>
|
|
13
13
|
<Card height={100} center padding-20>
|
|
14
14
|
<Text text50>Playground Screen</Text>
|
|
@@ -73,11 +73,13 @@ class SettingsScreen extends Component {
|
|
|
73
73
|
testID={'uilib.defaultScreenPicker'}
|
|
74
74
|
placeholder="Pick default screen..."
|
|
75
75
|
showSearch
|
|
76
|
-
value={defaultScreen}
|
|
76
|
+
value={defaultScreen?.value}
|
|
77
|
+
label={'Default Screen'}
|
|
77
78
|
onChange={this.setDefaultScreen}
|
|
79
|
+
migrateTextField
|
|
78
80
|
>
|
|
79
81
|
{_.map(filteredScreens, screen => (
|
|
80
|
-
<Picker.Item key={screen.value} value={screen}/>
|
|
82
|
+
<Picker.Item key={screen.value} value={screen.value} label={screen.label}/>
|
|
81
83
|
))}
|
|
82
84
|
</Picker>
|
|
83
85
|
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
} from 'react-native-ui-lib'; //eslint-disable-line
|
|
12
12
|
|
|
13
13
|
const ButtonSpace = 20;
|
|
14
|
-
const plusIcon =
|
|
15
|
-
const settingsIcon =
|
|
14
|
+
const plusIcon = Assets.getAssetByPath('icons.demo.plus');
|
|
15
|
+
const settingsIcon = Assets.getAssetByPath('icons.demo.settings');
|
|
16
16
|
const labelButton = {label: 'Animated'};
|
|
17
17
|
const iconButton = {round: true, iconStyle: {tintColor: Colors.white}};
|
|
18
18
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
|
-
import {View, Text, Image, Colors, Constants, Avatar, GridView,
|
|
2
|
+
import {View, Text, Image, Colors, Constants, Avatar, GridView, Card} from 'react-native-ui-lib';
|
|
3
3
|
import React, {Component} from 'react';
|
|
4
4
|
import {Alert, ScrollView} from 'react-native';
|
|
5
5
|
import conversations from '../../data/conversations';
|
|
@@ -153,7 +153,7 @@ class GridViewScreen extends Component {
|
|
|
153
153
|
items={contacts}
|
|
154
154
|
// viewWidth={300}
|
|
155
155
|
numColumns={6}
|
|
156
|
-
lastItemOverlayColor={Colors.primary}
|
|
156
|
+
lastItemOverlayColor={Colors.rgba(Colors.primary, 0.6)}
|
|
157
157
|
lastItemLabel={7}
|
|
158
158
|
/>
|
|
159
159
|
|
|
@@ -163,7 +163,7 @@ class GridViewScreen extends Component {
|
|
|
163
163
|
<GridView
|
|
164
164
|
items={products}
|
|
165
165
|
numColumns={4}
|
|
166
|
-
lastItemOverlayColor={Colors.primary}
|
|
166
|
+
lastItemOverlayColor={Colors.rgba(Colors.primary, 0.6)}
|
|
167
167
|
lastItemLabel={42}
|
|
168
168
|
keepItemSize
|
|
169
169
|
/>
|
|
@@ -11,14 +11,17 @@ import {
|
|
|
11
11
|
Avatar,
|
|
12
12
|
Assets,
|
|
13
13
|
PanningProvider,
|
|
14
|
-
Typography
|
|
14
|
+
Typography,
|
|
15
|
+
PickerProps,
|
|
16
|
+
DialogProps
|
|
15
17
|
} from 'react-native-ui-lib'; //eslint-disable-line
|
|
16
18
|
import contactsData from '../../data/conversations';
|
|
17
|
-
import tagIcon from '../../assets/icons/tags.png';
|
|
18
|
-
import dropdown from '../../assets/icons/chevronDown.png';
|
|
19
19
|
import {longOptions} from './PickerScreenLongOptions';
|
|
20
20
|
|
|
21
|
-
const
|
|
21
|
+
const tagIcon = require('../../assets/icons/tags.png');
|
|
22
|
+
const dropdown = require('../../assets/icons/chevronDown.png');
|
|
23
|
+
|
|
24
|
+
const contacts = _.map(contactsData, (c, index) => ({...c, value: index, label: c.name}));
|
|
22
25
|
|
|
23
26
|
const options = [
|
|
24
27
|
{label: 'JavaScript', value: 'js'},
|
|
@@ -35,26 +38,19 @@ const filters = [
|
|
|
35
38
|
];
|
|
36
39
|
|
|
37
40
|
export default class PickerScreen extends Component {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
filter: filters[0],
|
|
50
|
-
contact: contacts[0],
|
|
51
|
-
tags: [{label: 'Amit'}, {label: 'Ethan'}],
|
|
52
|
-
tags2: ['Tags', 'Input'],
|
|
53
|
-
tags3: ['Non', 'Removable', 'Tags']
|
|
54
|
-
};
|
|
55
|
-
}
|
|
41
|
+
state = {
|
|
42
|
+
itemsCount: 1,
|
|
43
|
+
// language: {value: 'java', label: 'Java'},
|
|
44
|
+
language: undefined,
|
|
45
|
+
language2: options[2].value, // for migrated picker example
|
|
46
|
+
languages: [],
|
|
47
|
+
nativePickerValue: 'java',
|
|
48
|
+
customModalValues: [],
|
|
49
|
+
filter: filters[0],
|
|
50
|
+
contact: 0
|
|
51
|
+
};
|
|
56
52
|
|
|
57
|
-
dialogHeader = props => {
|
|
53
|
+
dialogHeader: DialogProps['renderPannableHeader'] = props => {
|
|
58
54
|
const {title} = props;
|
|
59
55
|
return (
|
|
60
56
|
<Text margin-15 text60>
|
|
@@ -63,7 +59,7 @@ export default class PickerScreen extends Component {
|
|
|
63
59
|
);
|
|
64
60
|
};
|
|
65
61
|
|
|
66
|
-
renderDialog = modalProps => {
|
|
62
|
+
renderDialog: PickerProps['renderCustomModal'] = modalProps => {
|
|
67
63
|
const {visible, children, toggleModal, onDone} = modalProps;
|
|
68
64
|
|
|
69
65
|
return (
|
|
@@ -99,19 +95,18 @@ export default class PickerScreen extends Component {
|
|
|
99
95
|
enableModalBlur={false}
|
|
100
96
|
onChange={item => this.setState({language: item})}
|
|
101
97
|
topBarProps={{title: 'Languages'}}
|
|
102
|
-
style={{color: Colors.red20}}
|
|
98
|
+
// style={{color: Colors.red20}}
|
|
103
99
|
showSearch
|
|
104
100
|
searchPlaceholder={'Search a language'}
|
|
105
101
|
searchStyle={{color: Colors.blue30, placeholderTextColor: Colors.grey50}}
|
|
106
102
|
// onSearchChange={value => console.warn('value', value)}
|
|
107
103
|
>
|
|
108
104
|
{_.map(longOptions, option => (
|
|
109
|
-
<Picker.Item key={option.value} value={option} disabled={option.disabled}/>
|
|
105
|
+
<Picker.Item key={option.value} value={option} label={''} disabled={option.disabled}/>
|
|
110
106
|
))}
|
|
111
107
|
</Picker>
|
|
112
108
|
|
|
113
109
|
<Picker
|
|
114
|
-
marginT-20
|
|
115
110
|
placeholder="Favorite Languages (up to 3)"
|
|
116
111
|
value={this.state.languages}
|
|
117
112
|
onChange={items => this.setState({languages: items})}
|
|
@@ -120,7 +115,7 @@ export default class PickerScreen extends Component {
|
|
|
120
115
|
rightIconSource={dropdown}
|
|
121
116
|
>
|
|
122
117
|
{_.map(options, option => (
|
|
123
|
-
<Picker.Item key={option.value} value={option} disabled={option.disabled}/>
|
|
118
|
+
<Picker.Item key={option.value} value={option} label={''} disabled={option.disabled}/>
|
|
124
119
|
))}
|
|
125
120
|
</Picker>
|
|
126
121
|
|
|
@@ -131,7 +126,7 @@ export default class PickerScreen extends Component {
|
|
|
131
126
|
value={this.state.nativePickerValue}
|
|
132
127
|
onChange={nativePickerValue => this.setState({nativePickerValue})}
|
|
133
128
|
rightIconSource={dropdown}
|
|
134
|
-
containerStyle={{marginTop: 20}}
|
|
129
|
+
// containerStyle={{marginTop: 20}}
|
|
135
130
|
// renderPicker={() => {
|
|
136
131
|
// return (
|
|
137
132
|
// <View>
|
|
@@ -154,7 +149,6 @@ export default class PickerScreen extends Component {
|
|
|
154
149
|
</Picker>
|
|
155
150
|
|
|
156
151
|
<Picker
|
|
157
|
-
marginT-20
|
|
158
152
|
title="Custom modal"
|
|
159
153
|
placeholder="Pick multiple Languages"
|
|
160
154
|
value={this.state.customModalValues}
|
|
@@ -174,13 +168,13 @@ export default class PickerScreen extends Component {
|
|
|
174
168
|
))}
|
|
175
169
|
</Picker>
|
|
176
170
|
|
|
177
|
-
<Text
|
|
171
|
+
<Text marginB-10 text70>
|
|
178
172
|
Custom Picker:
|
|
179
173
|
</Text>
|
|
180
174
|
<Picker
|
|
181
175
|
value={this.state.filter}
|
|
182
176
|
onChange={filter => this.setState({filter})}
|
|
183
|
-
renderPicker={(
|
|
177
|
+
renderPicker={(_value?: any, label?: string) => {
|
|
184
178
|
return (
|
|
185
179
|
<View row>
|
|
186
180
|
<Icon style={{marginRight: 1, height: 16, resizeMode: 'contain'}} source={tagIcon}/>
|
|
@@ -192,24 +186,40 @@ export default class PickerScreen extends Component {
|
|
|
192
186
|
}}
|
|
193
187
|
>
|
|
194
188
|
{_.map(filters, filter => (
|
|
195
|
-
<Picker.Item key={filter.value} value={filter}/>
|
|
189
|
+
<Picker.Item key={filter.value} value={filter} label={''}/>
|
|
196
190
|
))}
|
|
197
191
|
</Picker>
|
|
198
192
|
|
|
199
|
-
<Text marginT-
|
|
193
|
+
<Text text60 marginT-s5>
|
|
194
|
+
Migrated Pickers
|
|
195
|
+
</Text>
|
|
196
|
+
|
|
197
|
+
<Text marginT-20 marginB-10 text70>
|
|
200
198
|
Custom Picker Items:
|
|
201
199
|
</Text>
|
|
202
200
|
<Picker
|
|
201
|
+
migrate
|
|
203
202
|
value={this.state.contact}
|
|
204
|
-
onChange={contact =>
|
|
205
|
-
|
|
206
|
-
|
|
203
|
+
onChange={contact => {
|
|
204
|
+
this.setState({contact});
|
|
205
|
+
}}
|
|
206
|
+
// getItemValue={contact => contact?.value}
|
|
207
|
+
renderPicker={(contactValue?: number) => {
|
|
208
|
+
const contact = contacts[contactValue!] ?? undefined;
|
|
207
209
|
return (
|
|
208
210
|
<View row>
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
211
|
+
{contact ? (
|
|
212
|
+
<>
|
|
213
|
+
<Avatar size={30} source={{uri: contact?.thumbnail}}/>
|
|
214
|
+
<Text text70 marginL-10>
|
|
215
|
+
{contact?.name}
|
|
216
|
+
</Text>
|
|
217
|
+
</>
|
|
218
|
+
) : (
|
|
219
|
+
<Text text70 grey30>
|
|
220
|
+
Pick a contact
|
|
221
|
+
</Text>
|
|
222
|
+
)}
|
|
213
223
|
</View>
|
|
214
224
|
);
|
|
215
225
|
}}
|
|
@@ -217,37 +227,37 @@ export default class PickerScreen extends Component {
|
|
|
217
227
|
{_.map(contacts, contact => (
|
|
218
228
|
<Picker.Item
|
|
219
229
|
key={contact.name}
|
|
220
|
-
value={contact}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
230
|
+
value={contact.value}
|
|
231
|
+
label={contact.label}
|
|
232
|
+
renderItem={(contactValue, props) => {
|
|
233
|
+
const contact = contacts[contactValue as number];
|
|
234
|
+
return (
|
|
235
|
+
<View
|
|
236
|
+
style={{
|
|
237
|
+
height: 56,
|
|
238
|
+
borderBottomWidth: 1,
|
|
239
|
+
borderColor: Colors.grey80
|
|
240
|
+
}}
|
|
241
|
+
paddingH-15
|
|
242
|
+
row
|
|
243
|
+
centerV
|
|
244
|
+
spread
|
|
245
|
+
>
|
|
246
|
+
<View row centerV>
|
|
247
|
+
<Avatar size={35} source={{uri: contact?.thumbnail}}/>
|
|
248
|
+
<Text marginL-10 text70 grey10>
|
|
249
|
+
{contact?.name}
|
|
250
|
+
</Text>
|
|
251
|
+
</View>
|
|
252
|
+
{props.isSelected && <Icon source={Assets.icons.check}/>}
|
|
238
253
|
</View>
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
getItemLabel={item => item.name}
|
|
254
|
+
);
|
|
255
|
+
}}
|
|
256
|
+
getItemLabel={contactValue => contacts[contactValue as number]?.name}
|
|
243
257
|
/>
|
|
244
258
|
))}
|
|
245
259
|
</Picker>
|
|
246
260
|
|
|
247
|
-
<Text text60 marginT-s5 marginB-s2>
|
|
248
|
-
Migrated Picker
|
|
249
|
-
</Text>
|
|
250
|
-
|
|
251
261
|
<Picker
|
|
252
262
|
migrate
|
|
253
263
|
migrateTextField
|
|
@@ -259,6 +269,7 @@ export default class PickerScreen extends Component {
|
|
|
259
269
|
showSearch
|
|
260
270
|
searchPlaceholder={'Search a language'}
|
|
261
271
|
searchStyle={{color: Colors.blue30, placeholderTextColor: Colors.grey50}}
|
|
272
|
+
marginT-s4
|
|
262
273
|
// mode={Picker.modes.MULTI}
|
|
263
274
|
// useNativePicker
|
|
264
275
|
>
|
package/src/screens/componentScreens/{PickerScreenLongOptions.js → PickerScreenLongOptions.ts}
RENAMED
|
@@ -3,13 +3,13 @@ export const longOptions = [
|
|
|
3
3
|
{label: 'ABAP2', value: 'ABAP2'},
|
|
4
4
|
{label: 'ABAP3', value: 'ABAP3'},
|
|
5
5
|
{label: 'ABAP4', value: 'ABAP4'},
|
|
6
|
-
{label: 'ABAP5', value: 'ABAP5'},
|
|
6
|
+
{label: 'ABAP5', value: 'ABAP5', disabled: true},
|
|
7
7
|
{label: 'ActionScript1', value: 'ActionScript1'},
|
|
8
8
|
{label: 'ActionScript2', value: 'ActionScript2'},
|
|
9
9
|
{label: 'ActionScript3', value: 'ActionScript3'},
|
|
10
10
|
{label: 'ActionScript4', value: 'ActionScript4'},
|
|
11
11
|
{label: 'ActionScript5', value: 'ActionScript5'},
|
|
12
|
-
{label: 'Ada1', value: 'Ada1'},
|
|
12
|
+
{label: 'Ada1', value: 'Ada1', disabled: true},
|
|
13
13
|
{label: 'Ada2', value: 'Ada2'},
|
|
14
14
|
{label: 'Ada3', value: 'Ada3'},
|
|
15
15
|
{label: 'Ada4', value: 'Ada4'},
|
|
@@ -150,7 +150,7 @@ class TabControllerScreen extends Component<{}, State> {
|
|
|
150
150
|
render() {
|
|
151
151
|
const {key, initialIndex, /* selectedIndex, */ asCarousel, centerSelected, fewItems, items} = this.state;
|
|
152
152
|
return (
|
|
153
|
-
<View flex bg
|
|
153
|
+
<View flex bg-$backgroundDefault>
|
|
154
154
|
<TabController
|
|
155
155
|
key={key}
|
|
156
156
|
asCarousel={asCarousel}
|
|
@@ -30,14 +30,14 @@ export default class TextFieldScreen extends Component {
|
|
|
30
30
|
renderTrailingAccessory() {
|
|
31
31
|
const {searching} = this.state;
|
|
32
32
|
if (searching) {
|
|
33
|
-
return <ActivityIndicator color={Colors
|
|
33
|
+
return <ActivityIndicator color={Colors.$iconDefault}/>;
|
|
34
34
|
} else {
|
|
35
35
|
return (
|
|
36
36
|
<Button
|
|
37
37
|
iconSource={Assets.icons.demo.search}
|
|
38
38
|
link
|
|
39
39
|
marginL-s2
|
|
40
|
-
|
|
40
|
+
$iconDefault
|
|
41
41
|
onPress={() => {
|
|
42
42
|
this.setState({searching: true});
|
|
43
43
|
setTimeout(() => {
|
|
@@ -68,8 +68,8 @@ export default class TextFieldScreen extends Component {
|
|
|
68
68
|
placeholder="Floating placeholder"
|
|
69
69
|
floatingPlaceholder
|
|
70
70
|
floatingPlaceholderColor={{
|
|
71
|
-
focus: Colors
|
|
72
|
-
default: Colors
|
|
71
|
+
focus: Colors.$textDefault,
|
|
72
|
+
default: Colors.$textNeutral
|
|
73
73
|
}}
|
|
74
74
|
// floatingPlaceholderStyle={Typography.text60}
|
|
75
75
|
// style={Typography.text60}
|
|
@@ -114,7 +114,7 @@ export default class TextFieldScreen extends Component {
|
|
|
114
114
|
placeholder="Enter weight"
|
|
115
115
|
text70
|
|
116
116
|
trailingAccessory={
|
|
117
|
-
<Text text70
|
|
117
|
+
<Text text70 $textNeutral>
|
|
118
118
|
Kg.
|
|
119
119
|
</Text>
|
|
120
120
|
}
|
|
@@ -191,7 +191,12 @@ export default class TextFieldScreen extends Component {
|
|
|
191
191
|
|
|
192
192
|
<TextField
|
|
193
193
|
label="Email"
|
|
194
|
-
labelColor={{
|
|
194
|
+
labelColor={{
|
|
195
|
+
default: Colors.$textDefault,
|
|
196
|
+
focus: Colors.$textGeneral,
|
|
197
|
+
error: Colors.$textDangerLight,
|
|
198
|
+
disabled: Colors.$textDisabled
|
|
199
|
+
}}
|
|
195
200
|
placeholder="Enter valid email"
|
|
196
201
|
validationMessage="Email is invalid"
|
|
197
202
|
validate={'email'}
|
|
@@ -215,7 +220,9 @@ export default class TextFieldScreen extends Component {
|
|
|
215
220
|
label="Label"
|
|
216
221
|
placeholder="Enter text..."
|
|
217
222
|
preset={preset}
|
|
218
|
-
dynamicFieldStyle={(_state, {preset}) =>
|
|
223
|
+
dynamicFieldStyle={(_state, {preset}) =>
|
|
224
|
+
preset === 'withUnderline' ? styles.withUnderline : styles.withFrame
|
|
225
|
+
}
|
|
219
226
|
editable={!shouldDisable}
|
|
220
227
|
/>
|
|
221
228
|
|
|
@@ -233,7 +240,7 @@ export default class TextFieldScreen extends Component {
|
|
|
233
240
|
{Assets.emojis.grapes} {Assets.emojis.melon} {Assets.emojis.banana}
|
|
234
241
|
</Text>
|
|
235
242
|
}
|
|
236
|
-
charCounterStyle={{color: Colors
|
|
243
|
+
charCounterStyle={{color: Colors.$textGeneral}}
|
|
237
244
|
maxLength={20}
|
|
238
245
|
fieldStyle={styles.withFrame}
|
|
239
246
|
/>
|
|
@@ -257,8 +264,12 @@ export default class TextFieldScreen extends Component {
|
|
|
257
264
|
validate={'number'}
|
|
258
265
|
validationMessage="Invalid price"
|
|
259
266
|
// @ts-expect-error
|
|
260
|
-
formatter={
|
|
261
|
-
leadingAccessory={
|
|
267
|
+
formatter={value => (isNaN(value) ? value : priceFormatter.format(Number(value)))}
|
|
268
|
+
leadingAccessory={
|
|
269
|
+
<Text marginR-s1 $textNeutral>
|
|
270
|
+
$
|
|
271
|
+
</Text>
|
|
272
|
+
}
|
|
262
273
|
fieldStyle={styles.withUnderline}
|
|
263
274
|
/>
|
|
264
275
|
</View>
|
|
@@ -272,12 +283,12 @@ const styles = StyleSheet.create({
|
|
|
272
283
|
container: {},
|
|
273
284
|
withUnderline: {
|
|
274
285
|
borderBottomWidth: 1,
|
|
275
|
-
borderColor: Colors
|
|
286
|
+
borderColor: Colors.$outlineDisabledHeavy,
|
|
276
287
|
paddingBottom: 4
|
|
277
288
|
},
|
|
278
289
|
withFrame: {
|
|
279
290
|
borderWidth: 1,
|
|
280
|
-
borderColor: Colors
|
|
291
|
+
borderColor: Colors.$outlineDisabledHeavy,
|
|
281
292
|
padding: 4,
|
|
282
293
|
borderRadius: 2
|
|
283
294
|
}
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
1
2
|
import React, {PureComponent} from 'react';
|
|
2
3
|
import {ScrollView, StyleSheet} from 'react-native';
|
|
3
4
|
import {
|
|
5
|
+
Constants,
|
|
6
|
+
Colors,
|
|
7
|
+
Spacings,
|
|
4
8
|
Keyboard,
|
|
5
|
-
Text,
|
|
6
9
|
View,
|
|
10
|
+
Text,
|
|
7
11
|
TextField,
|
|
8
|
-
Image,
|
|
9
12
|
Button,
|
|
10
|
-
|
|
11
|
-
Switch,
|
|
12
|
-
Constants,
|
|
13
|
-
Spacings
|
|
13
|
+
Switch
|
|
14
14
|
} from 'react-native-ui-lib';
|
|
15
|
-
import _ from 'lodash';
|
|
16
15
|
|
|
17
16
|
const KeyboardTrackingView = Keyboard.KeyboardTrackingView;
|
|
18
|
-
|
|
19
17
|
const messages = [
|
|
20
18
|
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
|
|
21
19
|
'integer feugiat scelerisque varius morbi enim nunc faucibus a pellentesque sit amet porttitor eget dolor',
|
|
@@ -68,6 +66,7 @@ export default class KeyboardTrackingViewScreen extends PureComponent {
|
|
|
68
66
|
<ScrollView
|
|
69
67
|
contentContainerStyle={styles.scrollContainer}
|
|
70
68
|
keyboardDismissMode={trackInteractive ? 'interactive' : 'none'}
|
|
69
|
+
showsVerticalScrollIndicator={false}
|
|
71
70
|
>
|
|
72
71
|
<Text h1 grey10 marginB-s1>
|
|
73
72
|
Keyboard Tracking View
|
|
@@ -88,23 +87,18 @@ export default class KeyboardTrackingViewScreen extends PureComponent {
|
|
|
88
87
|
<KeyboardTrackingView
|
|
89
88
|
style={styles.trackingToolbarContainer}
|
|
90
89
|
trackInteractive={trackInteractive}
|
|
90
|
+
useSafeArea
|
|
91
91
|
>
|
|
92
92
|
<View bg-white row spread centerV paddingH-s5 paddingV-s3>
|
|
93
93
|
<TextField
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
paddingVertical: Spacings.s2,
|
|
98
|
-
paddingHorizontal: Spacings.s4,
|
|
99
|
-
borderRadius: 8
|
|
100
|
-
}}
|
|
101
|
-
hideUnderline
|
|
94
|
+
migrate
|
|
95
|
+
containerStyle={styles.textField}
|
|
96
|
+
preset={null}
|
|
102
97
|
placeholder={'Message'}
|
|
103
98
|
floatingPlaceholder={false}
|
|
104
|
-
floatOnFocus
|
|
105
99
|
enableErrors={false}
|
|
106
100
|
/>
|
|
107
|
-
<Button label="Send" link marginL-s4
|
|
101
|
+
<Button label="Send" link marginL-s4/>
|
|
108
102
|
</View>
|
|
109
103
|
</KeyboardTrackingView>
|
|
110
104
|
</View>
|
|
@@ -116,15 +110,18 @@ const styles = StyleSheet.create({
|
|
|
116
110
|
scrollContainer: {
|
|
117
111
|
paddingHorizontal: Spacings.s5
|
|
118
112
|
},
|
|
119
|
-
image: {
|
|
120
|
-
height: 250,
|
|
121
|
-
marginBottom: Spacings.s3
|
|
122
|
-
},
|
|
123
113
|
trackingToolbarContainer: {
|
|
124
114
|
position: Constants.isIOS ? 'absolute' : 'relative',
|
|
125
115
|
bottom: 0,
|
|
126
116
|
width: '100%',
|
|
127
117
|
borderWidth: 1,
|
|
128
118
|
borderColor: Colors.grey60
|
|
119
|
+
},
|
|
120
|
+
textField: {
|
|
121
|
+
flex: 1,
|
|
122
|
+
backgroundColor: Colors.grey60,
|
|
123
|
+
paddingVertical: Spacings.s2,
|
|
124
|
+
paddingHorizontal: Spacings.s4,
|
|
125
|
+
borderRadius: 8
|
|
129
126
|
}
|
|
130
127
|
});
|
|
@@ -3,6 +3,5 @@ export function registerScreens(registrar) {
|
|
|
3
3
|
registrar('unicorn.nativeComponents.SafeAreaSpacerViewScreen', () => require('./SafeAreaSpacerViewScreen').default);
|
|
4
4
|
registrar('unicorn.nativeComponents.WheelPickerViewScreen', () => require('./WheelPickerViewScreen').default);
|
|
5
5
|
registrar('unicorn.nativeComponents.KeyboardTrackingViewScreen', () => require('./KeyboardTrackingViewScreen').default);
|
|
6
|
-
registrar('unicorn.nativeComponents.
|
|
6
|
+
registrar('unicorn.nativeComponents.KeyboardAccessoryViewScreen', () => require('./keyboardAccessory/KeyboardAccessoryViewScreen').default);
|
|
7
7
|
}
|
|
8
|
-
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
1
2
|
import React, {PureComponent} from 'react';
|
|
2
|
-
import {ScrollView, StyleSheet
|
|
3
|
+
import {ScrollView, StyleSheet} from 'react-native';
|
|
3
4
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
View,
|
|
5
|
+
Constants,
|
|
6
|
+
Assets,
|
|
7
7
|
Colors,
|
|
8
8
|
Spacings,
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
Keyboard,
|
|
10
|
+
View,
|
|
11
|
+
Text,
|
|
12
|
+
TextField,
|
|
11
13
|
Button,
|
|
12
|
-
Switch
|
|
13
|
-
Assets
|
|
14
|
+
Switch
|
|
14
15
|
} from 'react-native-ui-lib';
|
|
15
|
-
import _ from 'lodash';
|
|
16
16
|
import './demoKeyboards';
|
|
17
17
|
|
|
18
18
|
const KeyboardAccessoryView = Keyboard.KeyboardAccessoryView;
|
|
@@ -20,7 +20,7 @@ const KeyboardUtils = Keyboard.KeyboardUtils;
|
|
|
20
20
|
const KeyboardRegistry = Keyboard.KeyboardRegistry;
|
|
21
21
|
const TrackInteractive = true;
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const demoKeyboards = [
|
|
24
24
|
{
|
|
25
25
|
id: 'unicorn.ImagesKeyboard',
|
|
26
26
|
icon: Assets.icons.demo.image
|
|
@@ -31,7 +31,7 @@ const keyboards = [
|
|
|
31
31
|
}
|
|
32
32
|
];
|
|
33
33
|
|
|
34
|
-
export default class
|
|
34
|
+
export default class KeyboardAccessoryViewScreen extends PureComponent {
|
|
35
35
|
state = {
|
|
36
36
|
customKeyboard: {
|
|
37
37
|
component: undefined,
|
|
@@ -105,21 +105,24 @@ export default class KeyboardInputViewScreen extends PureComponent {
|
|
|
105
105
|
renderKeyboardAccessoryViewContent = () => {
|
|
106
106
|
return (
|
|
107
107
|
<View style={styles.keyboardContainer} paddingV-s4>
|
|
108
|
-
<View row paddingH-
|
|
109
|
-
<
|
|
110
|
-
|
|
108
|
+
<View bg-white row spread centerV paddingH-s5 paddingV-s3>
|
|
109
|
+
<TextField
|
|
110
|
+
migrate
|
|
111
111
|
ref={r => {
|
|
112
112
|
this.textInputRef = r;
|
|
113
113
|
}}
|
|
114
|
+
containerStyle={styles.textField}
|
|
115
|
+
preset={null}
|
|
114
116
|
placeholder={'Message'}
|
|
115
|
-
|
|
117
|
+
floatingPlaceholder={false}
|
|
118
|
+
enableErrors={false}
|
|
116
119
|
onFocus={this.resetKeyboardView}
|
|
117
120
|
/>
|
|
118
121
|
<Button link grey10 iconSource={Assets.icons.demo.close} onPress={KeyboardUtils.dismiss} marginL-s2/>
|
|
119
122
|
</View>
|
|
120
123
|
<View row paddingH-s4 marginT-s2 spread>
|
|
121
124
|
<View row>
|
|
122
|
-
{
|
|
125
|
+
{demoKeyboards.map(keyboard => (
|
|
123
126
|
<Button
|
|
124
127
|
key={keyboard.id}
|
|
125
128
|
grey10
|
|
@@ -170,8 +173,9 @@ export default class KeyboardInputViewScreen extends PureComponent {
|
|
|
170
173
|
};
|
|
171
174
|
|
|
172
175
|
render() {
|
|
173
|
-
const {message} = this.props;
|
|
176
|
+
const {message/* , isModal */} = this.props;
|
|
174
177
|
const {receivedKeyboardData, customKeyboard, useSafeArea} = this.state;
|
|
178
|
+
|
|
175
179
|
return (
|
|
176
180
|
<View flex bg-grey80>
|
|
177
181
|
<Text h2 marginT-page marginL-page>
|
|
@@ -180,6 +184,7 @@ export default class KeyboardInputViewScreen extends PureComponent {
|
|
|
180
184
|
<ScrollView
|
|
181
185
|
contentContainerStyle={styles.scrollContainer}
|
|
182
186
|
keyboardDismissMode={TrackInteractive ? 'interactive' : 'none'}
|
|
187
|
+
showsVerticalScrollIndicator={false}
|
|
183
188
|
>
|
|
184
189
|
<Text text40 grey10 marginV-20 center>
|
|
185
190
|
{message}
|
|
@@ -201,6 +206,7 @@ export default class KeyboardInputViewScreen extends PureComponent {
|
|
|
201
206
|
revealKeyboardInteractive
|
|
202
207
|
onRequestShowKeyboard={this.onRequestShowKeyboard}
|
|
203
208
|
useSafeArea={useSafeArea}
|
|
209
|
+
// usesBottomTabs={!isModal}
|
|
204
210
|
/>
|
|
205
211
|
</View>
|
|
206
212
|
);
|
|
@@ -213,13 +219,11 @@ const styles = StyleSheet.create({
|
|
|
213
219
|
flex: 1,
|
|
214
220
|
justifyContent: 'center'
|
|
215
221
|
},
|
|
216
|
-
|
|
222
|
+
textField: {
|
|
217
223
|
flex: 1,
|
|
218
|
-
paddingVertical: Spacings.s2,
|
|
219
|
-
paddingHorizontal: Spacings.s3,
|
|
220
|
-
...Typography.text70,
|
|
221
|
-
lineHeight: undefined,
|
|
222
224
|
backgroundColor: Colors.grey60,
|
|
225
|
+
paddingVertical: Spacings.s2,
|
|
226
|
+
paddingHorizontal: Spacings.s4,
|
|
223
227
|
borderRadius: 8
|
|
224
228
|
},
|
|
225
229
|
button: {
|
package/src/screens/nativeComponentScreens/{keyboardInput → keyboardAccessory}/demoKeyboards.js
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import {ScrollView} from 'react-native';
|
|
3
4
|
import {Keyboard, View, Text, Image, Spacings} from 'react-native-ui-lib';
|
|
4
|
-
import _ from 'lodash';
|
|
5
|
-
const KeyboardRegistry = Keyboard.KeyboardRegistry;
|
|
6
5
|
|
|
6
|
+
const KeyboardRegistry = Keyboard.KeyboardRegistry;
|
|
7
7
|
const images = [
|
|
8
8
|
'https://images.pexels.com/photos/1148521/pexels-photo-1148521.jpeg?auto=compress&cs=tinysrgb&dpr=1&h=200',
|
|
9
9
|
'https://images.pexels.com/photos/1528975/pexels-photo-1528975.jpeg?auto=compress&cs=tinysrgb&dpr=1&h=200',
|
|
@@ -43,11 +43,5 @@ function CustomKeyboard() {
|
|
|
43
43
|
);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
KeyboardRegistry.registerKeyboard(
|
|
47
|
-
|
|
48
|
-
() => ImagesKeyboard
|
|
49
|
-
);
|
|
50
|
-
KeyboardRegistry.registerKeyboard(
|
|
51
|
-
'unicorn.CustomKeyboard',
|
|
52
|
-
() => CustomKeyboard
|
|
53
|
-
);
|
|
46
|
+
KeyboardRegistry.registerKeyboard('unicorn.ImagesKeyboard', () => ImagesKeyboard);
|
|
47
|
+
KeyboardRegistry.registerKeyboard('unicorn.CustomKeyboard', () => CustomKeyboard);
|