react-native-ui-lib 7.40.1 → 7.41.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/scripts/docs/buildDocsCommon.js +2 -1
- package/scripts/release/prReleaseNotesCommon.js +2 -1
- package/src/components/WheelPicker/Item.d.ts +1 -0
- package/src/components/WheelPicker/Item.js +6 -1
- package/src/components/WheelPicker/wheelPicker.api.json +85 -13
- package/src/components/chip/chip.api.json +7 -1
- package/src/components/chipsInput/chipsInput.api.json +55 -9
- package/src/components/colorPalette/ColorPalette.api.json +12 -5
- package/src/components/colorPicker/colorPicker.api.json +19 -11
- package/src/components/drawer/drawer.api.json +112 -19
- package/src/components/drawer/index.d.ts +2 -0
- package/src/components/drawer/index.js +2 -2
- package/src/components/image/image.api.json +82 -14
- package/src/components/numberInput/numberInput.api.json +50 -6
- package/src/components/pageControl/pageControl.api.json +43 -5
- package/src/components/picker/PickerItemsList.js +4 -1
- package/src/components/picker/index.js +9 -3
- package/src/components/pieChart/pieChart.api.json +43 -5
- package/src/components/radioButton/radioButton.api.json +8 -4
- package/src/components/radioGroup/radioGroup.api.json +7 -6
- package/src/components/segmentedControl/segmentedControl.api.json +10 -12
- package/src/components/slider/slider.api.json +2 -2
- package/src/components/sortableGridList/sortableGridList.api.json +31 -3
- package/src/components/stepper/stepper.api.json +3 -1
- package/src/components/switch/switch.api.json +21 -16
- package/src/components/test.api.json +1 -1
- package/src/components/timeline/Point.js +5 -2
- package/src/components/timeline/index.js +3 -1
- package/src/components/timeline/types.d.ts +1 -0
- package/src/incubator/calendar/Agenda.js +25 -13
- package/src/incubator/calendar/Header.js +12 -2
- package/src/incubator/calendar/index.js +15 -16
- package/src/incubator/calendar/types.d.ts +0 -1
- package/src/incubator/index.d.ts +1 -1
- package/src/incubator/index.js +1 -1
- package/src/incubator/slider/slider.api.json +6 -6
|
@@ -81,17 +81,13 @@
|
|
|
81
81
|
"snippet": [
|
|
82
82
|
"function Example(props) {",
|
|
83
83
|
" const [value, setValue] = useState(false$1);",
|
|
84
|
-
" return
|
|
85
|
-
" <div>",
|
|
86
|
-
" <Switch value={value$2} onValueChange={setValue$3}/>",
|
|
87
|
-
" </div>",
|
|
88
|
-
" );",
|
|
84
|
+
" return <Switch margin-20 value={value$2} onValueChange={setValue$3}/>;",
|
|
89
85
|
"}"
|
|
90
86
|
],
|
|
91
87
|
"docs": {
|
|
92
88
|
"hero": {
|
|
93
89
|
"title": "Switch",
|
|
94
|
-
"description": "Use switches to toggle a single option on or off, activate or deactivate, and switch between two different states.
|
|
90
|
+
"description": "Use switches to toggle a single option on or off, activate or deactivate, and switch between two different states. \n\nConsider using switch instead of checkbox, when appropriate. \nConsider using switch instead of radio buttons if there’s only two options to choose from. ",
|
|
95
91
|
"type": "hero",
|
|
96
92
|
"layout": "horizontal",
|
|
97
93
|
"content": [
|
|
@@ -125,7 +121,8 @@
|
|
|
125
121
|
"description": "",
|
|
126
122
|
"content": [
|
|
127
123
|
{
|
|
128
|
-
"
|
|
124
|
+
"background": "#A6ACB1",
|
|
125
|
+
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Switch/SwitchLight.png"
|
|
129
126
|
}
|
|
130
127
|
]
|
|
131
128
|
}
|
|
@@ -149,7 +146,8 @@
|
|
|
149
146
|
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components Docs/Switch/switch_overview_state_default_on.png"
|
|
150
147
|
},
|
|
151
148
|
{
|
|
152
|
-
"
|
|
149
|
+
"background": "#A6ACB1",
|
|
150
|
+
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Switch/SwitchLight.png"
|
|
153
151
|
}
|
|
154
152
|
]
|
|
155
153
|
},
|
|
@@ -161,7 +159,8 @@
|
|
|
161
159
|
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components Docs/Switch/switch_overview_state_default_off.png"
|
|
162
160
|
},
|
|
163
161
|
{
|
|
164
|
-
"
|
|
162
|
+
"background": "#A6ACB1",
|
|
163
|
+
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Switch/SwitchLightOff.png"
|
|
165
164
|
}
|
|
166
165
|
]
|
|
167
166
|
},
|
|
@@ -173,7 +172,8 @@
|
|
|
173
172
|
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components Docs/Switch/switch_overview_state_default_disabledOn.png"
|
|
174
173
|
},
|
|
175
174
|
{
|
|
176
|
-
"
|
|
175
|
+
"background": "#A6ACB1",
|
|
176
|
+
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Switch/SwitchLightDisabled.png"
|
|
177
177
|
}
|
|
178
178
|
]
|
|
179
179
|
},
|
|
@@ -185,7 +185,8 @@
|
|
|
185
185
|
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components Docs/Switch/switch_overview_state_default_disabledOff.png"
|
|
186
186
|
},
|
|
187
187
|
{
|
|
188
|
-
"
|
|
188
|
+
"background": "#A6ACB1",
|
|
189
|
+
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Switch/SwitchLightDisabledOff.png"
|
|
189
190
|
}
|
|
190
191
|
]
|
|
191
192
|
}
|
|
@@ -197,17 +198,21 @@
|
|
|
197
198
|
"type": "list",
|
|
198
199
|
"items": [
|
|
199
200
|
{
|
|
200
|
-
"title": "",
|
|
201
|
-
"description": "
|
|
201
|
+
"title": "Size",
|
|
202
|
+
"description": "Currently, only one size available for the ToggleSwitch.",
|
|
202
203
|
"content": [
|
|
203
204
|
{
|
|
204
|
-
"value": "https://
|
|
205
|
+
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Switch/switch_overview_spec_size.png"
|
|
205
206
|
}
|
|
206
207
|
]
|
|
207
208
|
},
|
|
208
209
|
{
|
|
209
|
-
"title": "",
|
|
210
|
-
"description": "markdown:
|
|
210
|
+
"title": "Colors",
|
|
211
|
+
"description": "markdown:<b>ON</b><br>Background color: $backgroundPrimaryHeavy<br>Knob color: $iconDefaultLight<br><b>OFF</b><br>Background color: $backgroundNeutralHeavy<br>Knob color: $iconDefaultLight<br><b>Disabled</b><br>Background color: $backgroundDisabled<br>Knob color: $iconDefaultLight"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"title": "Haptic ",
|
|
215
|
+
"description": "Haptic is played on tap. Haptic preset: [impactMedium]",
|
|
211
216
|
"content": [
|
|
212
217
|
{
|
|
213
218
|
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components Docs/Switch/switch_overview_spec_haptic.png"
|
|
@@ -49,14 +49,17 @@ const Point = props => {
|
|
|
49
49
|
}, [type, color, label, removeIconBackground, icon]);
|
|
50
50
|
const renderPointContent = () => {
|
|
51
51
|
const {
|
|
52
|
-
removeIconBackground
|
|
52
|
+
removeIconBackground,
|
|
53
|
+
labelColor
|
|
53
54
|
} = props;
|
|
54
55
|
const tintColor = removeIconBackground ? Colors.$iconDefault : Colors.$iconDefaultLight;
|
|
55
56
|
const iconSize = removeIconBackground ? undefined : ICON_SIZE;
|
|
56
57
|
if (icon) {
|
|
57
58
|
return <Icon tintColor={tintColor} {...iconProps} size={iconSize} source={icon} />;
|
|
58
59
|
} else if (label) {
|
|
59
|
-
return <Text recorderTag={'unmask'} $textDefaultLight subtextBold
|
|
60
|
+
return <Text recorderTag={'unmask'} $textDefaultLight subtextBold color={labelColor}>
|
|
61
|
+
{label}
|
|
62
|
+
</Text>;
|
|
60
63
|
}
|
|
61
64
|
};
|
|
62
65
|
return <View center style={pointStyle} onLayout={onLayout}>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useMemo, useEffect, useState, useRef } from 'react';
|
|
2
2
|
import { StyleSheet } from 'react-native';
|
|
3
3
|
import { Colors, Spacings } from "../../style";
|
|
4
|
+
import { useThemeProps } from "../../hooks";
|
|
4
5
|
import View from "../view";
|
|
5
6
|
import Point from "./Point";
|
|
6
7
|
import Line from "./Line";
|
|
@@ -9,12 +10,13 @@ export { TimelineProps, PointProps as TimelinePointProps, LineProps as TimelineL
|
|
|
9
10
|
const CONTENT_CONTAINER_PADDINGS = Spacings.s2;
|
|
10
11
|
const ENTRY_POINT_HEIGHT = 2;
|
|
11
12
|
const Timeline = props => {
|
|
13
|
+
const themeProps = useThemeProps(props, 'Timeline');
|
|
12
14
|
const {
|
|
13
15
|
topLine,
|
|
14
16
|
bottomLine,
|
|
15
17
|
point,
|
|
16
18
|
children
|
|
17
|
-
} =
|
|
19
|
+
} = themeProps;
|
|
18
20
|
const [anchorMeasurements, setAnchorMeasurements] = useState();
|
|
19
21
|
const [contentContainerMeasurements, setContentContainerMeasurements] = useState();
|
|
20
22
|
const [pointMeasurements, setPointMeasurements] = useState();
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
import React, { useContext, useCallback, useRef } from 'react';
|
|
1
|
+
import React, { useContext, useCallback, useRef, useState } from 'react';
|
|
2
2
|
import { ActivityIndicator, StyleSheet } from 'react-native';
|
|
3
3
|
import { runOnJS, useAnimatedReaction, useSharedValue } from 'react-native-reanimated';
|
|
4
4
|
import { FlashListPackage } from "../../optionalDependencies";
|
|
5
5
|
import { BorderRadiuses, Colors } from "../../style";
|
|
6
|
+
import { useDidUpdate } from "../../hooks";
|
|
6
7
|
import View from "../../components/view";
|
|
7
8
|
import Text from "../../components/text";
|
|
8
9
|
import { isSameDay, isSameMonth } from "./helpers/DateUtils";
|
|
9
10
|
import { UpdateSource } from "./types";
|
|
10
11
|
import CalendarContext from "./CalendarContext";
|
|
11
12
|
const FlashList = FlashListPackage?.FlashList;
|
|
12
|
-
|
|
13
|
-
// TODO: Fix initial scrolling
|
|
14
13
|
function Agenda(props) {
|
|
15
14
|
const {
|
|
16
15
|
renderEvent,
|
|
17
16
|
renderHeader,
|
|
18
|
-
itemHeight = 50,
|
|
19
17
|
onEndReached,
|
|
20
18
|
showLoader
|
|
21
19
|
} = props;
|
|
@@ -28,18 +26,27 @@ function Agenda(props) {
|
|
|
28
26
|
const flashList = useRef(null);
|
|
29
27
|
const closestSectionHeader = useSharedValue(null);
|
|
30
28
|
const scrolledByUser = useSharedValue(false);
|
|
29
|
+
const [stickyHeaderIndices, setStickyHeaderIndices] = useState([]);
|
|
30
|
+
const lastDateBeforeLoadingNewEvents = useSharedValue(selectedDate.value);
|
|
31
31
|
|
|
32
32
|
/* const keyExtractor = useCallback((item: InternalEvent) => {
|
|
33
33
|
return item.type === 'Event' ? item.id : item.header;
|
|
34
34
|
}, []); */
|
|
35
35
|
|
|
36
|
+
useDidUpdate(() => {
|
|
37
|
+
const result = findClosestDateAfter(lastDateBeforeLoadingNewEvents.value);
|
|
38
|
+
if (result?.index) {
|
|
39
|
+
setTimeout(() => scrollToIndex(result?.index, false), 200);
|
|
40
|
+
}
|
|
41
|
+
const headerIndices = data.map((e, index) => e.type === 'Header' ? index : undefined).filter(i => i !== undefined);
|
|
42
|
+
// @ts-expect-error
|
|
43
|
+
setStickyHeaderIndices(headerIndices);
|
|
44
|
+
}, [data]);
|
|
36
45
|
const _renderEvent = useCallback(eventItem => {
|
|
37
46
|
if (renderEvent) {
|
|
38
|
-
return <View
|
|
39
|
-
{renderEvent(eventItem)}
|
|
40
|
-
</View>;
|
|
47
|
+
return <View style={styles.eventContainer}>{renderEvent(eventItem)}</View>;
|
|
41
48
|
}
|
|
42
|
-
return <View marginV-1 marginH-10 paddingH-10
|
|
49
|
+
return <View marginV-1 marginH-10 paddingH-10 centerV style={styles.event}>
|
|
43
50
|
<Text>
|
|
44
51
|
Item for
|
|
45
52
|
{new Date(eventItem.start).toLocaleString('en-GB', {
|
|
@@ -56,15 +63,15 @@ function Agenda(props) {
|
|
|
56
63
|
})}
|
|
57
64
|
</Text>
|
|
58
65
|
</View>;
|
|
59
|
-
}, [renderEvent
|
|
66
|
+
}, [renderEvent]);
|
|
60
67
|
const _renderHeader = useCallback(headerItem => {
|
|
61
68
|
if (renderHeader) {
|
|
62
|
-
return <View
|
|
69
|
+
return <View>{renderHeader(headerItem)}</View>;
|
|
63
70
|
}
|
|
64
|
-
return <View bottom marginB-5 marginH-20
|
|
71
|
+
return <View bg-$backgroundDefault bottom marginB-5 marginH-20>
|
|
65
72
|
<Text>{headerItem.header}</Text>
|
|
66
73
|
</View>;
|
|
67
|
-
}, [renderHeader
|
|
74
|
+
}, [renderHeader]);
|
|
68
75
|
const renderItem = useCallback(({
|
|
69
76
|
item
|
|
70
77
|
}) => {
|
|
@@ -116,6 +123,10 @@ function Agenda(props) {
|
|
|
116
123
|
const _isSameMonth = isSameMonth(selected, previous);
|
|
117
124
|
runOnJS(scrollToIndex)(index, _isSameMonth);
|
|
118
125
|
}
|
|
126
|
+
} else {
|
|
127
|
+
// Note: We got here because we are missing future agenda events to scroll to.
|
|
128
|
+
// therefor we should expect and new events data load
|
|
129
|
+
lastDateBeforeLoadingNewEvents.value = selectedDate.value;
|
|
119
130
|
}
|
|
120
131
|
}
|
|
121
132
|
}
|
|
@@ -148,6 +159,7 @@ function Agenda(props) {
|
|
|
148
159
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
149
160
|
}, []);
|
|
150
161
|
const _onEndReached = useCallback(() => {
|
|
162
|
+
lastDateBeforeLoadingNewEvents.value = selectedDate.value;
|
|
151
163
|
onEndReached?.(selectedDate.value);
|
|
152
164
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
153
165
|
}, [onEndReached]);
|
|
@@ -155,7 +167,7 @@ function Agenda(props) {
|
|
|
155
167
|
<FlashList ref={flashList} estimatedItemSize={52} data={data}
|
|
156
168
|
// TODO: Not sure we need key extractor in flash list
|
|
157
169
|
// keyExtractor={keyExtractor}
|
|
158
|
-
renderItem={renderItem} getItemType={getItemType} onViewableItemsChanged={onViewableItemsChanged} onMomentumScrollBegin={onMomentumScrollBegin} onScrollBeginDrag={onScrollBeginDrag} initialScrollIndex={findClosestDateAfter(selectedDate.value)?.index ?? 0} onEndReached={_onEndReached} />
|
|
170
|
+
renderItem={renderItem} getItemType={getItemType} stickyHeaderIndices={stickyHeaderIndices} onViewableItemsChanged={onViewableItemsChanged} onMomentumScrollBegin={onMomentumScrollBegin} onScrollBeginDrag={onScrollBeginDrag} initialScrollIndex={findClosestDateAfter(selectedDate.value)?.index ?? 0} onEndReached={_onEndReached} />
|
|
159
171
|
{showLoader && <View absF center style={{
|
|
160
172
|
backgroundColor: Colors.rgba(Colors.grey10, 0.2)
|
|
161
173
|
}}>
|
|
@@ -9,6 +9,16 @@ import { getDateObject, getMonthForIndex, addMonths } from "./helpers/DateUtils"
|
|
|
9
9
|
import { DayNamesFormat, UpdateSource } from "./types";
|
|
10
10
|
import CalendarContext from "./CalendarContext";
|
|
11
11
|
import WeekDaysNames from "./WeekDaysNames";
|
|
12
|
+
|
|
13
|
+
// Note: this fixes the updates on the header month title
|
|
14
|
+
Reanimated.addWhitelistedNativeProps({
|
|
15
|
+
text: true
|
|
16
|
+
});
|
|
17
|
+
const ARROWS_THROTTLE_TIME = 300;
|
|
18
|
+
const ARROWS_THROTTLE_OPTIONS = {
|
|
19
|
+
leading: true,
|
|
20
|
+
trailing: false
|
|
21
|
+
};
|
|
12
22
|
const WEEK_NUMBER_WIDTH = 32;
|
|
13
23
|
const ARROW_NEXT = require("./assets/arrowNext.png");
|
|
14
24
|
const ARROW_BACK = require("./assets/arrowBack.png");
|
|
@@ -31,10 +41,10 @@ const Header = props => {
|
|
|
31
41
|
}, []);
|
|
32
42
|
const onLeftArrowPress = useCallback(throttle(() => {
|
|
33
43
|
setDate(getNewDate(-1), UpdateSource.MONTH_ARROW);
|
|
34
|
-
},
|
|
44
|
+
}, ARROWS_THROTTLE_TIME, ARROWS_THROTTLE_OPTIONS), [setDate, getNewDate]);
|
|
35
45
|
const onRightArrowPress = useCallback(throttle(() => {
|
|
36
46
|
setDate(getNewDate(1), UpdateSource.MONTH_ARROW);
|
|
37
|
-
},
|
|
47
|
+
}, ARROWS_THROTTLE_TIME, ARROWS_THROTTLE_OPTIONS), [setDate, getNewDate]);
|
|
38
48
|
const getTitle = useCallback(date => {
|
|
39
49
|
'worklet';
|
|
40
50
|
|
|
@@ -15,12 +15,11 @@ import { useDidUpdate } from "../../hooks";
|
|
|
15
15
|
const FlashList = FlashListPackage?.FlashList;
|
|
16
16
|
const VIEWABILITY_CONFIG = {
|
|
17
17
|
itemVisiblePercentThreshold: 95,
|
|
18
|
-
minimumViewTime:
|
|
18
|
+
minimumViewTime: 1000
|
|
19
19
|
};
|
|
20
|
-
const YEARS_RANGE =
|
|
20
|
+
const YEARS_RANGE = 5;
|
|
21
21
|
const PAGE_RELOAD_THRESHOLD = 3;
|
|
22
|
-
const NOW = Date.
|
|
23
|
-
|
|
22
|
+
const NOW = new Date().setHours(0, 0, 0, 0);
|
|
24
23
|
function Calendar(props) {
|
|
25
24
|
const {
|
|
26
25
|
data,
|
|
@@ -31,20 +30,20 @@ function Calendar(props) {
|
|
|
31
30
|
staticHeader = false,
|
|
32
31
|
showExtraDays = true
|
|
33
32
|
} = props;
|
|
34
|
-
const [
|
|
33
|
+
const [monthItems] = useState(() => generateMonthItems(initialDate, YEARS_RANGE, YEARS_RANGE));
|
|
35
34
|
const getItemIndex = useCallback(date => {
|
|
36
35
|
'worklet';
|
|
37
36
|
|
|
38
37
|
const dateObject = getDateObject(date);
|
|
39
|
-
for (let i = 0; i <
|
|
40
|
-
if (
|
|
38
|
+
for (let i = 0; i < monthItems.length; i++) {
|
|
39
|
+
if (monthItems[i].month === dateObject.month && monthItems[i].year === dateObject.year) {
|
|
41
40
|
return i;
|
|
42
41
|
}
|
|
43
42
|
}
|
|
44
43
|
return -1;
|
|
45
|
-
}, [
|
|
44
|
+
}, [monthItems]);
|
|
46
45
|
const flashListRef = useRef();
|
|
47
|
-
const current = useSharedValue(initialDate);
|
|
46
|
+
const current = useSharedValue(new Date(initialDate).setHours(0, 0, 0, 0));
|
|
48
47
|
const initialMonthIndex = useRef(getItemIndex(current.value));
|
|
49
48
|
const lastUpdateSource = useSharedValue(UpdateSource.INIT);
|
|
50
49
|
const processedData = useMemo(() => addHeaders(data), [data]);
|
|
@@ -74,7 +73,7 @@ function Calendar(props) {
|
|
|
74
73
|
console.log('Update items');
|
|
75
74
|
const index = getItemIndex(current.value);
|
|
76
75
|
scrollToIndex(index);
|
|
77
|
-
}, [
|
|
76
|
+
}, [monthItems, getItemIndex]);
|
|
78
77
|
const setHeaderHeight = useCallback(height => {
|
|
79
78
|
headerHeight.value = height;
|
|
80
79
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -116,21 +115,21 @@ function Calendar(props) {
|
|
|
116
115
|
// const newDate = addYears(current.value, prepend ? -1 : 1);
|
|
117
116
|
// const newItems = generateMonthItems(newDate, pastRange, futureRange);
|
|
118
117
|
// const newArray = mergeArrays(prepend, items, newItems);
|
|
119
|
-
//
|
|
118
|
+
// setMonthItems(newArray);
|
|
120
119
|
// // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
121
|
-
}, [
|
|
120
|
+
}, [monthItems]);
|
|
122
121
|
const shouldAddPages = useCallback(index => {
|
|
123
122
|
'worklet';
|
|
124
123
|
|
|
125
|
-
return index !== -1 && (index < PAGE_RELOAD_THRESHOLD || index >
|
|
124
|
+
return index !== -1 && (index < PAGE_RELOAD_THRESHOLD || index > monthItems.length - PAGE_RELOAD_THRESHOLD);
|
|
126
125
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
127
|
-
}, [
|
|
126
|
+
}, [monthItems]);
|
|
128
127
|
useAnimatedReaction(() => {
|
|
129
128
|
return current.value;
|
|
130
129
|
}, (selected, previous) => {
|
|
131
130
|
const index = getItemIndex(selected);
|
|
132
131
|
if (shouldAddPages(index)) {
|
|
133
|
-
console.log('Add new pages: ', index,
|
|
132
|
+
console.log('Add new pages: ', index, monthItems.length);
|
|
134
133
|
runOnJS(addPages)(/* index */);
|
|
135
134
|
} else if (lastUpdateSource.value !== UpdateSource.MONTH_SCROLL) {
|
|
136
135
|
if (previous && !isSameMonth(selected, previous)) {
|
|
@@ -176,7 +175,7 @@ function Calendar(props) {
|
|
|
176
175
|
}, []);
|
|
177
176
|
return <CalendarContext.Provider value={contextValue}>
|
|
178
177
|
{staticHeader && <Header />}
|
|
179
|
-
<FlashList ref={flashListRef} estimatedItemSize={Constants.screenWidth} data={
|
|
178
|
+
<FlashList ref={flashListRef} estimatedItemSize={Constants.screenWidth} data={monthItems} initialScrollIndex={initialMonthIndex.current} estimatedFirstItemOffset={0} renderItem={renderCalendarItem} horizontal pagingEnabled showsHorizontalScrollIndicator={false}
|
|
180
179
|
// TODO: Consider moving this shared logic with Agenda to a hook
|
|
181
180
|
onViewableItemsChanged={onViewableItemsChanged} viewabilityConfig={VIEWABILITY_CONFIG} onMomentumScrollBegin={onMomentumScrollBegin} onScrollBeginDrag={onScrollBeginDrag} />
|
|
182
181
|
{children}
|
|
@@ -113,7 +113,6 @@ export interface CalendarProps {
|
|
|
113
113
|
export interface AgendaProps {
|
|
114
114
|
renderEvent?: (event: Event) => React.ReactElement | null;
|
|
115
115
|
renderHeader?: (header: DateSectionHeader) => React.ReactElement | null;
|
|
116
|
-
itemHeight?: number;
|
|
117
116
|
showLoader?: boolean;
|
|
118
117
|
onEndReached?: (date: number) => void;
|
|
119
118
|
}
|
package/src/incubator/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { default as TextField, TextFieldProps, FieldContextType, TextFieldMethod
|
|
|
4
4
|
export { default as Toast, ToastProps, ToastPresets } from './toast';
|
|
5
5
|
export { default as TouchableOpacity, TouchableOpacityProps } from './TouchableOpacity';
|
|
6
6
|
export { default as PanView, PanViewProps, PanViewDirections, PanViewDismissThreshold } from './panView';
|
|
7
|
-
export { default as Slider, SliderRef } from './slider';
|
|
7
|
+
export { default as Slider, SliderRef, SliderProps } from './slider';
|
|
8
8
|
export { default as Dialog, DialogProps, DialogHeaderProps, DialogStatics, DialogImperativeMethods } from './dialog';
|
|
9
9
|
export { default as ChipsInput, ChipsInputProps, ChipsInputChangeReason, ChipsInputChipProps } from '../components/chipsInput';
|
|
10
10
|
export { default as WheelPicker, WheelPickerProps, WheelPickerItemProps, WheelPickerAlign, WheelPickerItemValue } from '../components/WheelPicker';
|
package/src/incubator/index.js
CHANGED
|
@@ -5,7 +5,7 @@ export { default as TextField, TextFieldProps, FieldContextType, TextFieldMethod
|
|
|
5
5
|
export { default as Toast, ToastProps, ToastPresets } from "./toast";
|
|
6
6
|
export { default as TouchableOpacity, TouchableOpacityProps } from "./TouchableOpacity";
|
|
7
7
|
export { default as PanView, PanViewProps, PanViewDirections, PanViewDismissThreshold } from "./panView";
|
|
8
|
-
export { default as Slider, SliderRef } from "./slider";
|
|
8
|
+
export { default as Slider, SliderRef, SliderProps } from "./slider";
|
|
9
9
|
export { default as Dialog, DialogProps, DialogHeaderProps, DialogStatics, DialogImperativeMethods } from "./dialog";
|
|
10
10
|
// TODO: delete exports after fully removing from private
|
|
11
11
|
export { default as ChipsInput, ChipsInputProps, ChipsInputChangeReason, ChipsInputChipProps } from "../components/chipsInput";
|
|
@@ -100,10 +100,10 @@
|
|
|
100
100
|
],
|
|
101
101
|
"snippet": [
|
|
102
102
|
"<Incubator.Slider",
|
|
103
|
-
" value={0
|
|
104
|
-
" minimumValue={0
|
|
105
|
-
" maximumValue={10
|
|
106
|
-
" onValueChange={value => console.log(\\`value changed: \\${value}\\`)
|
|
103
|
+
" value={0}",
|
|
104
|
+
" minimumValue={0}",
|
|
105
|
+
" maximumValue={10}",
|
|
106
|
+
" onValueChange={value => console.log(\\`value changed: \\${value}\\`)}",
|
|
107
107
|
"/>"
|
|
108
108
|
],
|
|
109
109
|
"docs": {
|
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
}
|
|
188
188
|
],
|
|
189
189
|
"title": "Spec",
|
|
190
|
-
"description": "**Linear slider**\n\n**Default**\nThumb: 24px \nOutline: 1.5px\n\n**On tap**\nThumb: 40px\nOutline: 1.5px\n\n**Disabled**"
|
|
190
|
+
"description": "markdown: **Linear slider**\n\n**Default**\nThumb: 24px \nOutline: 1.5px\n\n**On tap**\nThumb: 40px\nOutline: 1.5px\n\n**Disabled**"
|
|
191
191
|
},
|
|
192
192
|
{
|
|
193
193
|
"type": "section",
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/Slider/slider_spec_range.png"
|
|
198
198
|
}
|
|
199
199
|
],
|
|
200
|
-
"description": "**Range slider**\n\n**Initial state**\nWidest range is displayed by default.\n\n**Thumbs**\nThumbs should not cross each other and keep minimum distance between them of S2 (8px). Thumbs shouldn’t overlap each other when idle.\n\n**Spacing**\nMinimum spacing between idle Thumbs - S2"
|
|
200
|
+
"description": "markdown: **Range slider**\n\n**Initial state**\nWidest range is displayed by default.\n\n**Thumbs**\nThumbs should not cross each other and keep minimum distance between them of S2 (8px). Thumbs shouldn’t overlap each other when idle.\n\n**Spacing**\nMinimum spacing between idle Thumbs - S2"
|
|
201
201
|
}
|
|
202
202
|
]
|
|
203
203
|
}
|