@fountain-ui/lab 2.0.0-beta.45 → 2.0.0-beta.47
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/build/commonjs/ComicViewer/ComicViewer.js +36 -7
- package/build/commonjs/ComicViewer/ComicViewer.js.map +1 -1
- package/build/commonjs/ComicViewer/ComicViewerProps.js.map +1 -1
- package/build/commonjs/ComicViewer/FastScroll.js +162 -0
- package/build/commonjs/ComicViewer/FastScroll.js.map +1 -0
- package/build/commonjs/ComicViewer/FastScrollProps.js +6 -0
- package/build/commonjs/ComicViewer/FastScrollProps.js.map +1 -0
- package/build/commonjs/ComicViewer/index.js.map +1 -1
- package/build/commonjs/ComicViewer/util.js +27 -0
- package/build/commonjs/ComicViewer/util.js.map +1 -0
- package/build/module/ComicViewer/ComicViewer.js +35 -7
- package/build/module/ComicViewer/ComicViewer.js.map +1 -1
- package/build/module/ComicViewer/ComicViewerProps.js.map +1 -1
- package/build/module/ComicViewer/FastScroll.js +141 -0
- package/build/module/ComicViewer/FastScroll.js.map +1 -0
- package/build/module/ComicViewer/FastScrollProps.js +2 -0
- package/build/module/ComicViewer/FastScrollProps.js.map +1 -0
- package/build/module/ComicViewer/index.js.map +1 -1
- package/build/module/ComicViewer/util.js +15 -0
- package/build/module/ComicViewer/util.js.map +1 -0
- package/build/typescript/AnimatedY/AnimatedY.d.ts +1 -0
- package/build/typescript/BottomSheet/BottomSheetNative.d.ts +1 -0
- package/build/typescript/BottomSheet/BottomSheetWeb.d.ts +1 -0
- package/build/typescript/BottomSheet/TransparentBackdrop.d.ts +1 -0
- package/build/typescript/ComicViewer/ComicViewer.d.ts +1 -0
- package/build/typescript/ComicViewer/ComicViewerProps.d.ts +13 -0
- package/build/typescript/ComicViewer/FastScroll.d.ts +4 -0
- package/build/typescript/ComicViewer/FastScrollProps.d.ts +70 -0
- package/build/typescript/ComicViewer/ReloadButton.d.ts +1 -0
- package/build/typescript/ComicViewer/ViewerItem.d.ts +1 -0
- package/build/typescript/ComicViewer/index.d.ts +1 -0
- package/build/typescript/ComicViewer/util.d.ts +2 -0
- package/build/typescript/DateTimePicker/DateTimePicker.d.ts +1 -0
- package/build/typescript/DateTimePicker/YearPicker.d.ts +1 -0
- package/build/typescript/FlipCard/FlipCard.d.ts +1 -0
- package/build/typescript/StatusBarProvider/StatusBarProvider.d.ts +1 -0
- package/build/typescript/ViewabilityTrackerView/ViewabilityTrackerView.d.ts +1 -0
- package/package.json +3 -3
- package/src/ComicViewer/ComicViewer.tsx +50 -17
- package/src/ComicViewer/ComicViewerProps.ts +16 -0
- package/src/ComicViewer/FastScroll.tsx +158 -0
- package/src/ComicViewer/FastScrollProps.ts +83 -0
- package/src/ComicViewer/index.ts +6 -0
- package/src/ComicViewer/util.ts +15 -0
- package/yarn-error.log +103 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
-
import { FlatList, ListRenderItem, ViewToken } from 'react-native';
|
|
2
|
+
import { FlatList, ListRenderItem, NativeScrollEvent, NativeSyntheticEvent, ViewToken } from 'react-native';
|
|
3
3
|
import * as R from 'ramda';
|
|
4
4
|
import { useDebounce } from '@fountain-ui/core';
|
|
5
5
|
import { default as ComicViewerProps, Dimension } from './ComicViewerProps';
|
|
6
6
|
import ViewerItem from './ViewerItem';
|
|
7
|
+
import FastScroll from './FastScroll';
|
|
7
8
|
|
|
8
9
|
const appender = (left: number, right: number): [number, number] => [left + right, left + right];
|
|
9
10
|
const getHeightAccum = (heights: number[]): [number, number[]] => R.mapAccum(appender, 0, heights);
|
|
@@ -56,6 +57,7 @@ export default function ComicViewer(props: ComicViewerProps) {
|
|
|
56
57
|
const {
|
|
57
58
|
debounceMillis = 100,
|
|
58
59
|
autoHandleErrorCount = 3,
|
|
60
|
+
fastScrollOptions,
|
|
59
61
|
getUrlByIndex,
|
|
60
62
|
initialNumToRender = 1,
|
|
61
63
|
initialScrollPercentage = 0,
|
|
@@ -63,12 +65,17 @@ export default function ComicViewer(props: ComicViewerProps) {
|
|
|
63
65
|
intrinsicDimensions,
|
|
64
66
|
maxContentWidth = MAXIMUM_WIDTH,
|
|
65
67
|
onItemPress,
|
|
68
|
+
onScroll,
|
|
69
|
+
onError,
|
|
70
|
+
onReloadPress,
|
|
66
71
|
viewportWidth,
|
|
67
72
|
invisiblePaddingTop = 0,
|
|
68
73
|
windowSize = 3,
|
|
69
74
|
...otherProps
|
|
70
75
|
} = props;
|
|
71
76
|
|
|
77
|
+
const fastScrollRef = fastScrollOptions?.ref;
|
|
78
|
+
|
|
72
79
|
const flatListRef = useRef<FlatList>(null);
|
|
73
80
|
|
|
74
81
|
const maybeLoadableItemsIndexRange = useRef<[number, number]>([-1, 0]);
|
|
@@ -210,8 +217,23 @@ export default function ComicViewer(props: ComicViewerProps) {
|
|
|
210
217
|
loadItemsDebounce();
|
|
211
218
|
});
|
|
212
219
|
|
|
220
|
+
const handleScroll = useCallback((event: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
221
|
+
fastScrollRef?.current?.onContentScroll(event);
|
|
222
|
+
|
|
223
|
+
onScroll?.(event);
|
|
224
|
+
}, [onScroll]);
|
|
225
|
+
|
|
226
|
+
const scrollContentToOffset = (offset: number) => {
|
|
227
|
+
flatListRef.current?.scrollToOffset({
|
|
228
|
+
offset,
|
|
229
|
+
animated: false,
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
|
|
213
233
|
const renderItem: ListRenderItem<ItemState> = useCallback(({ item, index }) => {
|
|
214
|
-
const
|
|
234
|
+
const handleError = () => {
|
|
235
|
+
onError && onError();
|
|
236
|
+
|
|
215
237
|
updateImageState((imageState, i) => {
|
|
216
238
|
const urlState = imageState.urlState;
|
|
217
239
|
|
|
@@ -239,7 +261,9 @@ export default function ComicViewer(props: ComicViewerProps) {
|
|
|
239
261
|
}
|
|
240
262
|
};
|
|
241
263
|
|
|
242
|
-
const
|
|
264
|
+
const handleReloadPress = () => {
|
|
265
|
+
onReloadPress && onReloadPress();
|
|
266
|
+
|
|
243
267
|
const [startIndex, endIndex] = maybeLoadableItemsIndexRange.current;
|
|
244
268
|
if (index >= startIndex || index < endIndex) {
|
|
245
269
|
loadUrlByIndex([index]);
|
|
@@ -266,10 +290,10 @@ export default function ComicViewer(props: ComicViewerProps) {
|
|
|
266
290
|
|
|
267
291
|
return (
|
|
268
292
|
<ViewerItem
|
|
269
|
-
onError={
|
|
293
|
+
onError={handleError}
|
|
270
294
|
onLoad={onLoad}
|
|
271
295
|
onPress={onItemPress}
|
|
272
|
-
onReloadPress={
|
|
296
|
+
onReloadPress={handleReloadPress}
|
|
273
297
|
url={item.url}
|
|
274
298
|
invisiblePaddingTop={index === 0 ? invisiblePaddingTop : 0}
|
|
275
299
|
width={renderedDimensions[index]?.width ?? 0}
|
|
@@ -288,17 +312,26 @@ export default function ComicViewer(props: ComicViewerProps) {
|
|
|
288
312
|
}, []);
|
|
289
313
|
|
|
290
314
|
return (
|
|
291
|
-
<
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
315
|
+
<React.Fragment>
|
|
316
|
+
<FlatList
|
|
317
|
+
data={itemStates}
|
|
318
|
+
getItemLayout={getItemLayout}
|
|
319
|
+
initialNumToRender={initialNumToRender}
|
|
320
|
+
keyExtractor={keyExtractor}
|
|
321
|
+
onViewableItemsChanged={onViewableItemsChanged.current}
|
|
322
|
+
ref={flatListRef}
|
|
323
|
+
renderItem={renderItem}
|
|
324
|
+
viewabilityConfig={viewabilityConfig}
|
|
325
|
+
windowSize={windowSize}
|
|
326
|
+
onScroll={handleScroll}
|
|
327
|
+
{...otherProps}
|
|
328
|
+
/>
|
|
329
|
+
|
|
330
|
+
<FastScroll
|
|
331
|
+
{...fastScrollOptions}
|
|
332
|
+
contentLength={totalHeight}
|
|
333
|
+
scrollContentToOffset={scrollContentToOffset}
|
|
334
|
+
/>
|
|
335
|
+
</React.Fragment>
|
|
303
336
|
);
|
|
304
337
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ComponentProps } from '@fountain-ui/core';
|
|
3
3
|
import { NativeScrollEvent, NativeSyntheticEvent } from 'react-native';
|
|
4
|
+
import { FastScrollOptions } from './FastScrollProps';
|
|
4
5
|
|
|
5
6
|
export interface Dimension {
|
|
6
7
|
width: number;
|
|
@@ -67,6 +68,11 @@ export default interface ComicViewerProps extends ComponentProps <{
|
|
|
67
68
|
*/
|
|
68
69
|
windowSize?: number;
|
|
69
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Options for fastscroll component.
|
|
73
|
+
*/
|
|
74
|
+
fastScrollOptions: FastScrollOptions;
|
|
75
|
+
|
|
70
76
|
/**
|
|
71
77
|
* Get contents urls by indexes.
|
|
72
78
|
*/
|
|
@@ -83,6 +89,16 @@ export default interface ComicViewerProps extends ComponentProps <{
|
|
|
83
89
|
*/
|
|
84
90
|
onItemPress?: () => void;
|
|
85
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Handle image loading fail event.
|
|
94
|
+
*/
|
|
95
|
+
onError?: () => void;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Handle reload button press event.
|
|
99
|
+
*/
|
|
100
|
+
onReloadPress?: () => void;
|
|
101
|
+
|
|
86
102
|
/**
|
|
87
103
|
* Component for comic viewer footer.
|
|
88
104
|
*/
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import React, { useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
2
|
+
import { NativeScrollEvent, NativeSyntheticEvent, View } from 'react-native';
|
|
3
|
+
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
4
|
+
import Animated, { runOnJS, useAnimatedStyle, useSharedValue, withDelay, withTiming } from 'react-native-reanimated';
|
|
5
|
+
import { ChevronDown, ChevronUp } from '@fountain-ui/icons';
|
|
6
|
+
import { StyleSheet } from '@fountain-ui/core';
|
|
7
|
+
import FastScrollProps from './FastScrollProps';
|
|
8
|
+
import { offsetToPercentage, percentageToOffset } from './util';
|
|
9
|
+
|
|
10
|
+
const styles = StyleSheet.create({
|
|
11
|
+
indicator: {
|
|
12
|
+
width: 24,
|
|
13
|
+
height: 40,
|
|
14
|
+
backgroundColor: '#767676',
|
|
15
|
+
flexDirection: 'column',
|
|
16
|
+
alignItems: 'center',
|
|
17
|
+
borderRadius: 4,
|
|
18
|
+
},
|
|
19
|
+
view: { position: 'absolute' },
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const FastScroll = React.forwardRef((props: FastScrollProps, ref) => {
|
|
23
|
+
const {
|
|
24
|
+
absolutePosition,
|
|
25
|
+
additionalLength = 0,
|
|
26
|
+
contentLength,
|
|
27
|
+
movementRange,
|
|
28
|
+
scrollContentToOffset,
|
|
29
|
+
visibleDurations = { hideMillis: 200, showMillis: 350 },
|
|
30
|
+
} = props;
|
|
31
|
+
|
|
32
|
+
const lastIndicatorOffset = useSharedValue(0);
|
|
33
|
+
const indicatorOffset = useSharedValue(lastIndicatorOffset.value);
|
|
34
|
+
|
|
35
|
+
const isIndicatorDragging = useRef(false);
|
|
36
|
+
|
|
37
|
+
const indicatorOpacity = useSharedValue(1);
|
|
38
|
+
const [visible, setVisible] = useState(true);
|
|
39
|
+
|
|
40
|
+
const animatedStyle = useAnimatedStyle(() => ({
|
|
41
|
+
transform: [{ translateY: indicatorOffset.value }],
|
|
42
|
+
opacity: indicatorOpacity.value,
|
|
43
|
+
}));
|
|
44
|
+
|
|
45
|
+
const totalContentLength = contentLength + additionalLength;
|
|
46
|
+
|
|
47
|
+
const onContentScroll = (event: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
48
|
+
if (isIndicatorDragging.current === false) {
|
|
49
|
+
const contentPercentage = offsetToPercentage(event.nativeEvent.contentOffset.y, totalContentLength);
|
|
50
|
+
const offset = percentageToOffset(contentPercentage, movementRange);
|
|
51
|
+
|
|
52
|
+
if (offset < 0 || indicatorOffset.value < 0) {
|
|
53
|
+
lastIndicatorOffset.value = 0;
|
|
54
|
+
indicatorOffset.value = 0;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (offset > movementRange || indicatorOffset.value > movementRange) {
|
|
59
|
+
lastIndicatorOffset.value = movementRange;
|
|
60
|
+
indicatorOffset.value = movementRange;
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
lastIndicatorOffset.value = offset;
|
|
65
|
+
} else {
|
|
66
|
+
setVisible(true);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const getIsIndicatorDragging = () => isIndicatorDragging.current;
|
|
71
|
+
|
|
72
|
+
useImperativeHandle(
|
|
73
|
+
ref,
|
|
74
|
+
() => ({
|
|
75
|
+
getIsIndicatorDragging,
|
|
76
|
+
onContentScroll,
|
|
77
|
+
setVisible,
|
|
78
|
+
}),
|
|
79
|
+
[],
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const handleUpdate = () => {
|
|
83
|
+
const contentPercentage = offsetToPercentage(indicatorOffset.value, movementRange);
|
|
84
|
+
const offset = percentageToOffset(contentPercentage, totalContentLength);
|
|
85
|
+
|
|
86
|
+
scrollContentToOffset(offset);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const setIsIndicatorDragging = (value: boolean) => isIndicatorDragging.current = value;
|
|
90
|
+
|
|
91
|
+
const pan = Gesture.Pan()
|
|
92
|
+
.onBegin((e) => {
|
|
93
|
+
indicatorOffset.value = lastIndicatorOffset.value;
|
|
94
|
+
runOnJS(setIsIndicatorDragging)(true);
|
|
95
|
+
})
|
|
96
|
+
.onUpdate((e) => {
|
|
97
|
+
if (indicatorOffset.value <= 0 && e.translationY < 0) {
|
|
98
|
+
indicatorOffset.value = 0;
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (indicatorOffset.value >= movementRange && e.translationY > 0) {
|
|
103
|
+
indicatorOffset.value = movementRange;
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
indicatorOffset.value = lastIndicatorOffset.value + e.translationY;
|
|
108
|
+
|
|
109
|
+
runOnJS(handleUpdate)();
|
|
110
|
+
})
|
|
111
|
+
.onFinalize((e) => {
|
|
112
|
+
lastIndicatorOffset.value = indicatorOffset.value;
|
|
113
|
+
runOnJS(setIsIndicatorDragging)(false);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
const hide = () => indicatorOpacity.value = withDelay(0, withTiming(0, { duration: visibleDurations.hideMillis }));
|
|
117
|
+
|
|
118
|
+
const show = () => indicatorOpacity.value = withDelay(0, withTiming(1, { duration: visibleDurations.showMillis }));
|
|
119
|
+
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
if (visible) {
|
|
122
|
+
indicatorOffset.value = lastIndicatorOffset.value;
|
|
123
|
+
show();
|
|
124
|
+
} else {
|
|
125
|
+
hide();
|
|
126
|
+
}
|
|
127
|
+
}, [visible]);
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<View
|
|
131
|
+
style={[
|
|
132
|
+
{ height: movementRange },
|
|
133
|
+
styles.view,
|
|
134
|
+
absolutePosition,
|
|
135
|
+
]}
|
|
136
|
+
>
|
|
137
|
+
<GestureDetector gesture={pan}>
|
|
138
|
+
<Animated.View style={[
|
|
139
|
+
animatedStyle,
|
|
140
|
+
styles.indicator,
|
|
141
|
+
]}>
|
|
142
|
+
<ChevronUp
|
|
143
|
+
fill={'#ededed'}
|
|
144
|
+
height={20}
|
|
145
|
+
width={20}
|
|
146
|
+
/>
|
|
147
|
+
<ChevronDown
|
|
148
|
+
fill={'#ededed'}
|
|
149
|
+
height={20}
|
|
150
|
+
width={20}
|
|
151
|
+
/>
|
|
152
|
+
</Animated.View>
|
|
153
|
+
</GestureDetector>
|
|
154
|
+
</View>
|
|
155
|
+
);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
export default FastScroll;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { NativeScrollEvent, NativeSyntheticEvent } from 'react-native';
|
|
3
|
+
import type { RefObject } from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Position infos with display: 'position'.
|
|
7
|
+
*/
|
|
8
|
+
export type AbsolutePosition = {
|
|
9
|
+
top: number;
|
|
10
|
+
bottom: number;
|
|
11
|
+
right: number;
|
|
12
|
+
left: number;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Durations(millis) for show, hide animation.
|
|
17
|
+
*/
|
|
18
|
+
export type VisibleDurations = {
|
|
19
|
+
hideMillis: number;
|
|
20
|
+
showMillis: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface FastScrollInstance {
|
|
24
|
+
/**
|
|
25
|
+
* Handle content scroll event, not using fast scroll indicator.
|
|
26
|
+
* @param event Function onScroll event params.
|
|
27
|
+
*/
|
|
28
|
+
onContentScroll: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Set indicator visible state.
|
|
32
|
+
*/
|
|
33
|
+
setVisible: React.Dispatch<React.SetStateAction<boolean>>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Return true, if pan gesture state is begin to finalize.
|
|
37
|
+
*/
|
|
38
|
+
getIsIndicatorDragging: () => boolean,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface FastScrollOptions {
|
|
42
|
+
/**
|
|
43
|
+
* Ref for React.forwardRef.
|
|
44
|
+
*/
|
|
45
|
+
ref: RefObject<FastScrollInstance>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Range within which the indicator can move.
|
|
49
|
+
*/
|
|
50
|
+
movementRange: number;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Scrollbar positions for 'display: position'.
|
|
54
|
+
*/
|
|
55
|
+
absolutePosition?: Partial<AbsolutePosition>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Durations(millis) for show, hide animation.
|
|
59
|
+
* @default { hide: 200, show: 350 }
|
|
60
|
+
*/
|
|
61
|
+
visibleDurations?: VisibleDurations;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Additional height except contentLength.
|
|
65
|
+
* @default 0
|
|
66
|
+
*/
|
|
67
|
+
additionalLength?: number;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
interface FastScrollProps extends FastScrollOptions {
|
|
71
|
+
/**
|
|
72
|
+
* Total length of scrollable content.
|
|
73
|
+
*/
|
|
74
|
+
contentLength: number;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Scroll content to offset appropriate for the indicator location.
|
|
78
|
+
* @param offset Content offset.
|
|
79
|
+
*/
|
|
80
|
+
scrollContentToOffset: (offset: number) => void;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export default FastScrollProps;
|
package/src/ComicViewer/index.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
export { default } from './ComicViewer';
|
|
2
2
|
export type { Dimension, default as ComicViewerProps } from './ComicViewerProps';
|
|
3
3
|
export type { ViewerItemProps } from './ViewerItem';
|
|
4
|
+
export type {
|
|
5
|
+
AbsolutePosition,
|
|
6
|
+
FastScrollInstance,
|
|
7
|
+
FastScrollOptions,
|
|
8
|
+
VisibleDurations,
|
|
9
|
+
} from './FastScrollProps';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const offsetToPercentage = (offset: number, total: number) => {
|
|
2
|
+
if (offset === 0 || total === 0) {
|
|
3
|
+
return 0;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
return offset / total * 100;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const percentageToOffset = (percentage: number, total: number) => {
|
|
10
|
+
if (percentage === 0 || total === 0) {
|
|
11
|
+
return 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return percentage / 100 * total;
|
|
15
|
+
};
|
package/yarn-error.log
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
Arguments:
|
|
2
|
+
/Users/chan/.nvm/versions/node/v16.16.0/bin/node /usr/local/Cellar/yarn/1.22.19/libexec/bin/yarn.js add react-native-device-info
|
|
3
|
+
|
|
4
|
+
PATH:
|
|
5
|
+
/Users/chan/.nvm/versions/node/v16.16.0/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/chan/IdeaProjects/tappytoon/bin/git-ext:/Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/chan/IdeaProjects/tappytoon/bin/git-ext:/Users/chan/Library/Android/sdk/tools:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/chan/IdeaProjects/tappytoon/bin/git-ext:/Users/chan/Library/Android/sdk/platform-tools:/Users/chan/library/android/sdk/tools:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/chan/IdeaProjects/tappytoon/bin/git-ext:/Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/chan/IdeaProjects/tappytoon/bin/git-ext:/Users/chan/Library/Android/sdk/tools:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/chan/IdeaProjects/tappytoon/bin/git-ext:/Users/chan/Library/Android/sdk/platform-tools:/Users/hyungchanyuk/library/android/sdk/platform-tools:/Users/chan/WebstormProjects/tappytoon/bin/git-ext
|
|
6
|
+
|
|
7
|
+
Yarn version:
|
|
8
|
+
1.22.19
|
|
9
|
+
|
|
10
|
+
Node version:
|
|
11
|
+
16.16.0
|
|
12
|
+
|
|
13
|
+
Platform:
|
|
14
|
+
darwin x64
|
|
15
|
+
|
|
16
|
+
Trace:
|
|
17
|
+
SyntaxError: /Users/chan/WebstormProjects/tappytoon/nodejs/fountain-ui/packages/fountain-ui-lab/package.json: Unexpected token } in JSON at position 681
|
|
18
|
+
at JSON.parse (<anonymous>)
|
|
19
|
+
at /usr/local/Cellar/yarn/1.22.19/libexec/lib/cli.js:1629:59
|
|
20
|
+
at Generator.next (<anonymous>)
|
|
21
|
+
at step (/usr/local/Cellar/yarn/1.22.19/libexec/lib/cli.js:310:30)
|
|
22
|
+
at /usr/local/Cellar/yarn/1.22.19/libexec/lib/cli.js:321:13
|
|
23
|
+
|
|
24
|
+
npm manifest:
|
|
25
|
+
{
|
|
26
|
+
"name": "@fountain-ui/lab",
|
|
27
|
+
"version": "2.0.0-beta.45",
|
|
28
|
+
"private": false,
|
|
29
|
+
"author": "Fountain-UI Team",
|
|
30
|
+
"description": "Incubator for Fountain-UI React components.",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"main": "./build/commonjs/index.js",
|
|
33
|
+
"module": "./build/module/index.js",
|
|
34
|
+
"react-native": "./src/index.ts",
|
|
35
|
+
"source": "./src/index.ts",
|
|
36
|
+
"types": "./build/typescript/index.d.ts",
|
|
37
|
+
"scripts": {
|
|
38
|
+
"clean": "rimraf build",
|
|
39
|
+
"prepare": "bob build"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@emotion/react": "^11.10.0",
|
|
43
|
+
"@emotion/styled": "^11.10.0",
|
|
44
|
+
"@fountain-ui/icons": "^2.0.0-beta.9",
|
|
45
|
+
"@fountain-ui/utils": "^2.0.0-beta.4",
|
|
46
|
+
"react-native-calendars": "1.1267.0",
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"@fountain-ui/core": "^2.0.0-beta.3",
|
|
50
|
+
"@gorhom/bottom-sheet": "^4.5.0",
|
|
51
|
+
"date-fns": "^2.0.0",
|
|
52
|
+
"react": "^16.8.0 || ^17.0.0",
|
|
53
|
+
"react-dom": "^16.8.0 || ^17.0.0",
|
|
54
|
+
"react-native": "^0.63.0",
|
|
55
|
+
"react-native-gesture-handler": "^2.0.0",
|
|
56
|
+
"react-native-pager-view": "^4.0.0"
|
|
57
|
+
},
|
|
58
|
+
"peerDependenciesMeta": {
|
|
59
|
+
"@gorhom/bottom-sheet": {
|
|
60
|
+
"optional": true
|
|
61
|
+
},
|
|
62
|
+
"react-dom": {
|
|
63
|
+
"optional": true
|
|
64
|
+
},
|
|
65
|
+
"react-native-pager-view": {
|
|
66
|
+
"optional": true
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"devDependencies": {
|
|
70
|
+
"@gorhom/bottom-sheet": "^4.5.0",
|
|
71
|
+
"date-fns": "^2.23.0",
|
|
72
|
+
"react-native-pager-view": "^4.2.4",
|
|
73
|
+
"react-native-safe-area-context": "^4.0.0"
|
|
74
|
+
},
|
|
75
|
+
"react-native-builder-bob": {
|
|
76
|
+
"source": "./src",
|
|
77
|
+
"output": "./build",
|
|
78
|
+
"targets": [
|
|
79
|
+
"commonjs",
|
|
80
|
+
"module",
|
|
81
|
+
[
|
|
82
|
+
"typescript",
|
|
83
|
+
{
|
|
84
|
+
"project": "tsconfig.build.json",
|
|
85
|
+
"tsc": "../../node_modules/.bin/tsc"
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
],
|
|
89
|
+
"files": [
|
|
90
|
+
"./src",
|
|
91
|
+
"./build"
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
"publishConfig": {
|
|
95
|
+
"access": "public"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
yarn manifest:
|
|
100
|
+
No manifest
|
|
101
|
+
|
|
102
|
+
Lockfile:
|
|
103
|
+
No lockfile
|