@mpxjs/webpack-plugin 2.10.7 → 2.10.8-beta.3
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/lib/dependencies/RecordPageConfigsMapDependency.js +1 -1
- package/lib/dependencies/RequireExternalDependency.js +61 -0
- package/lib/file-loader.js +3 -2
- package/lib/index.js +55 -9
- package/lib/json-compiler/index.js +1 -0
- package/lib/parser.js +1 -1
- package/lib/platform/json/wx/index.js +43 -25
- package/lib/platform/style/wx/index.js +7 -0
- package/lib/platform/template/wx/component-config/fix-component-name.js +2 -2
- package/lib/platform/template/wx/component-config/index.js +9 -1
- package/lib/platform/template/wx/component-config/nav-container.js +27 -0
- package/lib/platform/template/wx/component-config/page-container.js +19 -0
- package/lib/platform/template/wx/component-config/sticky-header.js +23 -0
- package/lib/platform/template/wx/component-config/sticky-section.js +23 -0
- package/lib/platform/template/wx/component-config/unsupported.js +1 -1
- package/lib/react/LoadAsyncChunkModule.js +74 -0
- package/lib/react/index.js +3 -1
- package/lib/react/processJSON.js +74 -13
- package/lib/react/processScript.js +6 -6
- package/lib/react/script-helper.js +100 -41
- package/lib/runtime/components/ali/mpx-nav-container.mpx +3 -0
- package/lib/runtime/components/react/context.ts +27 -7
- package/lib/runtime/components/react/dist/context.d.ts +78 -0
- package/lib/runtime/components/react/dist/context.js +5 -1
- package/lib/runtime/components/react/dist/event.config.d.ts +7 -0
- package/lib/runtime/components/react/dist/getInnerListeners.d.ts +7 -0
- package/lib/runtime/components/react/dist/mpx-async-suspense.d.ts +12 -0
- package/lib/runtime/components/react/dist/mpx-async-suspense.jsx +135 -0
- package/lib/runtime/components/react/dist/mpx-button.d.ts +68 -0
- package/lib/runtime/components/react/dist/mpx-button.jsx +2 -2
- package/lib/runtime/components/react/dist/mpx-canvas/Bus.d.ts +23 -0
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.d.ts +7 -0
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.d.ts +6 -0
- package/lib/runtime/components/react/dist/mpx-canvas/Image.d.ts +20 -0
- package/lib/runtime/components/react/dist/mpx-canvas/ImageData.d.ts +8 -0
- package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.d.ts +10 -0
- package/lib/runtime/components/react/dist/mpx-canvas/html.d.ts +2 -0
- package/lib/runtime/components/react/dist/mpx-canvas/index.d.ts +32 -0
- package/lib/runtime/components/react/dist/mpx-canvas/utils.d.ts +52 -0
- package/lib/runtime/components/react/dist/mpx-checkbox-group.d.ts +20 -0
- package/lib/runtime/components/react/dist/mpx-checkbox.d.ts +32 -0
- package/lib/runtime/components/react/dist/mpx-form.d.ts +27 -0
- package/lib/runtime/components/react/dist/mpx-icon/index.d.ts +18 -0
- package/lib/runtime/components/react/dist/mpx-image.d.ts +21 -0
- package/lib/runtime/components/react/dist/mpx-inline-text.d.ts +7 -0
- package/lib/runtime/components/react/dist/mpx-input.d.ts +49 -0
- package/lib/runtime/components/react/dist/mpx-input.jsx +28 -9
- package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.d.ts +12 -0
- package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.jsx +42 -46
- package/lib/runtime/components/react/dist/mpx-label.d.ts +20 -0
- package/lib/runtime/components/react/dist/mpx-movable-area.d.ts +20 -0
- package/lib/runtime/components/react/dist/mpx-movable-view.d.ts +63 -0
- package/lib/runtime/components/react/dist/mpx-movable-view.jsx +8 -6
- package/lib/runtime/components/react/dist/mpx-nav-container.d.ts +9 -0
- package/lib/runtime/components/react/dist/mpx-nav-container.jsx +23 -0
- package/lib/runtime/components/react/dist/mpx-navigator.d.ts +9 -0
- package/lib/runtime/components/react/dist/mpx-page-container.d.ts +27 -0
- package/lib/runtime/components/react/dist/mpx-page-container.jsx +255 -0
- package/lib/runtime/components/react/dist/mpx-picker/date.d.ts +6 -0
- package/lib/runtime/components/react/dist/mpx-picker/dateData.d.ts +7 -0
- package/lib/runtime/components/react/dist/mpx-picker/index.d.ts +6 -0
- package/lib/runtime/components/react/dist/mpx-picker/multiSelector.d.ts +6 -0
- package/lib/runtime/components/react/dist/mpx-picker/region.d.ts +6 -0
- package/lib/runtime/components/react/dist/mpx-picker/regionData.d.ts +2 -0
- package/lib/runtime/components/react/dist/mpx-picker/selector.d.ts +6 -0
- package/lib/runtime/components/react/dist/mpx-picker/time.d.ts +6 -0
- package/lib/runtime/components/react/dist/mpx-picker/type.d.ts +106 -0
- package/lib/runtime/components/react/dist/mpx-picker-view/index.d.ts +31 -0
- package/lib/runtime/components/react/dist/mpx-picker-view/pickerVIewContext.d.ts +8 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/index.d.ts +22 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.d.ts +14 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewFaces.d.ts +16 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewIndicator.d.ts +12 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewMask.d.ts +11 -0
- package/lib/runtime/components/react/dist/mpx-popup/index.d.ts +22 -0
- package/lib/runtime/components/react/dist/mpx-popup/popupBase.d.ts +16 -0
- package/lib/runtime/components/react/dist/mpx-portal/index.d.ts +15 -0
- package/lib/runtime/components/react/dist/mpx-portal/portal-host.d.ts +29 -0
- package/lib/runtime/components/react/dist/mpx-portal/portal-manager.d.ts +9 -0
- package/lib/runtime/components/react/dist/mpx-radio-group.d.ts +20 -0
- package/lib/runtime/components/react/dist/mpx-radio.d.ts +26 -0
- package/lib/runtime/components/react/dist/mpx-rich-text/html.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-rich-text/index.d.ts +24 -0
- package/lib/runtime/components/react/dist/mpx-root-portal.d.ts +14 -0
- package/lib/runtime/components/react/dist/mpx-scroll-view.d.ts +54 -0
- package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +31 -15
- package/lib/runtime/components/react/dist/mpx-simple-text.d.ts +7 -0
- package/lib/runtime/components/react/dist/mpx-simple-view.d.ts +7 -0
- package/lib/runtime/components/react/dist/mpx-sticky-header.d.ts +17 -0
- package/lib/runtime/components/react/dist/mpx-sticky-header.jsx +117 -0
- package/lib/runtime/components/react/dist/mpx-sticky-section.d.ts +15 -0
- package/lib/runtime/components/react/dist/mpx-sticky-section.jsx +45 -0
- package/lib/runtime/components/react/dist/mpx-swiper-item.d.ts +18 -0
- package/lib/runtime/components/react/dist/mpx-swiper.d.ts +52 -0
- package/lib/runtime/components/react/dist/mpx-swiper.jsx +3 -2
- package/lib/runtime/components/react/dist/mpx-switch.d.ts +26 -0
- package/lib/runtime/components/react/dist/mpx-text.d.ts +21 -0
- package/lib/runtime/components/react/dist/mpx-textarea.d.ts +7 -0
- package/lib/runtime/components/react/dist/mpx-video.d.ts +101 -0
- package/lib/runtime/components/react/dist/mpx-view.d.ts +34 -0
- package/lib/runtime/components/react/dist/mpx-web-view.d.ts +22 -0
- package/lib/runtime/components/react/dist/nav.d.ts +11 -0
- package/lib/runtime/components/react/dist/nav.jsx +141 -0
- package/lib/runtime/components/react/dist/parser.d.ts +39 -0
- package/lib/runtime/components/react/dist/useAnimationHooks.d.ts +32 -0
- package/lib/runtime/components/react/dist/useNavShared.d.ts +2 -0
- package/lib/runtime/components/react/dist/useNavShared.js +6 -0
- package/lib/runtime/components/react/dist/useNodesRef.d.ts +11 -0
- package/lib/runtime/components/react/dist/utils.d.ts +121 -0
- package/lib/runtime/components/react/mpx-async-suspense.tsx +180 -0
- package/lib/runtime/components/react/mpx-button.tsx +3 -2
- package/lib/runtime/components/react/mpx-input.tsx +35 -16
- package/lib/runtime/components/react/mpx-keyboard-avoiding-view.tsx +46 -45
- package/lib/runtime/components/react/mpx-movable-view.tsx +8 -4
- package/lib/runtime/components/react/mpx-nav-container.tsx +33 -0
- package/lib/runtime/components/react/mpx-page-container.tsx +394 -0
- package/lib/runtime/components/react/mpx-scroll-view.tsx +84 -59
- package/lib/runtime/components/react/mpx-sticky-header.tsx +181 -0
- package/lib/runtime/components/react/mpx-sticky-section.tsx +96 -0
- package/lib/runtime/components/react/mpx-swiper.tsx +4 -2
- package/lib/runtime/components/react/nav.tsx +172 -0
- package/lib/runtime/components/react/types/common.d.ts +19 -0
- package/lib/runtime/components/react/useNavShared.ts +8 -0
- package/lib/runtime/components/web/mpx-nav-container.vue +13 -0
- package/lib/runtime/components/web/mpx-scroll-view.vue +18 -4
- package/lib/runtime/components/web/mpx-sticky-header.vue +99 -0
- package/lib/runtime/components/web/mpx-sticky-section.vue +15 -0
- package/lib/runtime/components/wx/mpx-nav-container.mpx +9 -0
- package/lib/runtime/optionProcessorReact.d.ts +18 -0
- package/lib/runtime/optionProcessorReact.js +30 -0
- package/lib/script-setup-compiler/index.js +27 -5
- package/lib/template-compiler/bind-this.js +2 -1
- package/lib/template-compiler/compiler.js +27 -6
- package/lib/utils/dom-tag-config.js +18 -4
- package/lib/utils/trans-async-sub-rules.js +19 -0
- package/lib/web/script-helper.js +1 -1
- package/package.json +4 -4
- package/LICENSE +0 -433
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { TimeProps } from './type';
|
|
4
|
+
import { HandlerRef } from '../useNodesRef';
|
|
5
|
+
declare const PickerTime: React.ForwardRefExoticComponent<Omit<TimeProps, "ref"> & React.RefAttributes<HandlerRef<View, TimeProps>>>;
|
|
6
|
+
export default PickerTime;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const enum PickerMode {
|
|
3
|
+
SELECTOR = "selector",
|
|
4
|
+
MULTI_SELECTOR = "multiSelector",
|
|
5
|
+
TIME = "time",
|
|
6
|
+
DATE = "date",
|
|
7
|
+
REGION = "region"
|
|
8
|
+
}
|
|
9
|
+
export type PickerValue = number;
|
|
10
|
+
export type Obj = Record<string, any>;
|
|
11
|
+
export type RangeItem = Obj | number | string;
|
|
12
|
+
export type TimeValue = `${number}-${number}-${number}` | '';
|
|
13
|
+
/** 通用属性 */
|
|
14
|
+
export interface BasePickerProps {
|
|
15
|
+
/** --- 小程序属性 --- */
|
|
16
|
+
/** 选择器类型, 默认值 selector */
|
|
17
|
+
mode?: PickerMode;
|
|
18
|
+
/** 是否禁用, 默认值 false */
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/** 点击取消按钮时触发 */
|
|
21
|
+
bindcancel?: Function;
|
|
22
|
+
/** 头部标题 */
|
|
23
|
+
'header-text'?: string;
|
|
24
|
+
/** --- 内部组件属性 --- */
|
|
25
|
+
/** 作为表单组件时的名称 */
|
|
26
|
+
name?: string;
|
|
27
|
+
style?: Record<string, any>;
|
|
28
|
+
children?: React.ReactNode;
|
|
29
|
+
range?: RangeItem[];
|
|
30
|
+
ref?: any;
|
|
31
|
+
}
|
|
32
|
+
export interface SelectorProps extends BasePickerProps {
|
|
33
|
+
mode: PickerMode.SELECTOR;
|
|
34
|
+
/** 默认值 0 */
|
|
35
|
+
value?: number;
|
|
36
|
+
/** 默认值 [] */
|
|
37
|
+
range?: RangeItem[];
|
|
38
|
+
'range-key'?: string;
|
|
39
|
+
/** 点击确认按钮后触发 change 事件, event.detail = {value} */
|
|
40
|
+
bindchange?: Function;
|
|
41
|
+
}
|
|
42
|
+
export interface MultiSelectorProps extends BasePickerProps {
|
|
43
|
+
mode: PickerMode.MULTI_SELECTOR;
|
|
44
|
+
/** 默认值 [] */
|
|
45
|
+
value?: number[];
|
|
46
|
+
range?: RangeItem[];
|
|
47
|
+
'range-key'?: string;
|
|
48
|
+
bindchange?: Function;
|
|
49
|
+
bindcolumnchange?: Function;
|
|
50
|
+
}
|
|
51
|
+
export interface TimeProps extends BasePickerProps {
|
|
52
|
+
mode: PickerMode.TIME;
|
|
53
|
+
/** 表示选中的时间,格式为"hh:mm" */
|
|
54
|
+
value?: string;
|
|
55
|
+
start?: string;
|
|
56
|
+
end?: string;
|
|
57
|
+
bindchange?: Function;
|
|
58
|
+
}
|
|
59
|
+
export interface DateProps extends BasePickerProps {
|
|
60
|
+
mode: PickerMode.DATE;
|
|
61
|
+
/** 默认值 '' */
|
|
62
|
+
value?: TimeValue;
|
|
63
|
+
start?: TimeValue;
|
|
64
|
+
end?: TimeValue;
|
|
65
|
+
/** 有效值 year,month,day,表示选择器的粒度 */
|
|
66
|
+
fields?: 'day' | 'month' | 'year';
|
|
67
|
+
bindchange?: Function;
|
|
68
|
+
}
|
|
69
|
+
export interface RegionProps extends BasePickerProps {
|
|
70
|
+
mode: PickerMode.REGION;
|
|
71
|
+
/** 表示选中的省市区,默认选中每一列的第一个值, 默认值 [] */
|
|
72
|
+
value?: string[];
|
|
73
|
+
/** 默认值 region */
|
|
74
|
+
level?: 'province' | 'city' | 'region' | 'sub-district';
|
|
75
|
+
/** 可为每一列的顶部添加一个自定义的项 */
|
|
76
|
+
'custom-item'?: string;
|
|
77
|
+
/** value 改变时触发 change 事件, event.detail = {value, code, postcode},
|
|
78
|
+
* 其中字段 code 是统计用区划代码, postcode 是邮政编码 */
|
|
79
|
+
bindchange?: Function;
|
|
80
|
+
}
|
|
81
|
+
export interface RegionObj {
|
|
82
|
+
value: string;
|
|
83
|
+
code: string;
|
|
84
|
+
postcode?: string;
|
|
85
|
+
children?: RegionObj[];
|
|
86
|
+
}
|
|
87
|
+
export interface PickerData {
|
|
88
|
+
value: string;
|
|
89
|
+
label: string;
|
|
90
|
+
children?: Object[];
|
|
91
|
+
}
|
|
92
|
+
export interface EventType {
|
|
93
|
+
detail: {
|
|
94
|
+
value: PickerValue[];
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
export interface LayoutType {
|
|
98
|
+
nativeEvent: {
|
|
99
|
+
layout: Obj;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export interface FormType {
|
|
103
|
+
name: string;
|
|
104
|
+
}
|
|
105
|
+
export type PickerProps = SelectorProps | MultiSelectorProps | TimeProps | DateProps | RegionProps;
|
|
106
|
+
export type LanguageCode = 'zh-CN' | 'en-US';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { HandlerRef } from '../useNodesRef';
|
|
4
|
+
import type { AnyFunc } from '../types/common';
|
|
5
|
+
/**
|
|
6
|
+
* ✔ value
|
|
7
|
+
* ✔ bindchange
|
|
8
|
+
* ✘ bindpickstart
|
|
9
|
+
* ✘ bindpickend
|
|
10
|
+
* ✔ mask-class
|
|
11
|
+
* ✔ indicator-style: 优先级indicator-style.height > pick-view-column中的子元素设置的height
|
|
12
|
+
* WebView Only:
|
|
13
|
+
* ✔ indicator-class
|
|
14
|
+
* ✔ mask-style
|
|
15
|
+
* ✘ immediate-change
|
|
16
|
+
*/
|
|
17
|
+
interface PickerViewProps {
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
value?: Array<number>;
|
|
20
|
+
bindchange?: AnyFunc;
|
|
21
|
+
style?: {
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
};
|
|
24
|
+
'indicator-style'?: Record<string, any>;
|
|
25
|
+
'mask-style'?: Record<string, any>;
|
|
26
|
+
'enable-var'?: boolean;
|
|
27
|
+
'external-var-context'?: Record<string, any>;
|
|
28
|
+
'enable-offset'?: boolean;
|
|
29
|
+
}
|
|
30
|
+
declare const _PickerView: React.ForwardRefExoticComponent<PickerViewProps & React.RefAttributes<HandlerRef<View, PickerViewProps>>>;
|
|
31
|
+
export default _PickerView;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SharedValue } from 'react-native-reanimated';
|
|
3
|
+
type ContextValue = SharedValue<number>;
|
|
4
|
+
export declare const PickerViewColumnAnimationContext: import("react").Context<ContextValue | undefined>;
|
|
5
|
+
export declare const usePickerViewColumnAnimationContext: () => ContextValue;
|
|
6
|
+
export declare const PickerViewStyleContext: import("react").Context<Record<string, any> | undefined>;
|
|
7
|
+
export declare const usePickerViewStyleContext: () => Record<string, any> | undefined;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ScrollView, View } from 'react-native';
|
|
3
|
+
import { HandlerRef } from '../useNodesRef';
|
|
4
|
+
interface ColumnProps {
|
|
5
|
+
columnIndex: number;
|
|
6
|
+
columnData: React.ReactNode[];
|
|
7
|
+
initialIndex: number;
|
|
8
|
+
onSelectChange: Function;
|
|
9
|
+
style: {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
};
|
|
12
|
+
'enable-var'?: boolean;
|
|
13
|
+
'external-var-context'?: Record<string, any>;
|
|
14
|
+
wrapperStyle: {
|
|
15
|
+
height: number;
|
|
16
|
+
itemHeight: number;
|
|
17
|
+
};
|
|
18
|
+
pickerMaskStyle: Record<string, any>;
|
|
19
|
+
pickerIndicatorStyle: Record<string, any>;
|
|
20
|
+
}
|
|
21
|
+
declare const _PickerViewColumn: React.ForwardRefExoticComponent<ColumnProps & React.RefAttributes<HandlerRef<ScrollView & View, ColumnProps>>>;
|
|
22
|
+
export default _PickerViewColumn;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LayoutChangeEvent } from 'react-native';
|
|
3
|
+
interface PickerColumnItemProps {
|
|
4
|
+
item: React.ReactElement;
|
|
5
|
+
index: number;
|
|
6
|
+
itemHeight: number;
|
|
7
|
+
itemWidth?: number | '100%';
|
|
8
|
+
textStyle: Record<string, any>;
|
|
9
|
+
visibleCount: number;
|
|
10
|
+
textProps?: any;
|
|
11
|
+
onItemLayout?: (e: LayoutChangeEvent) => void;
|
|
12
|
+
}
|
|
13
|
+
declare const PickerViewColumnItem: React.FC<PickerColumnItemProps>;
|
|
14
|
+
export default PickerViewColumnItem;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Borrowed from open-source code: https://github.com/quidone/react-native-wheel-picker
|
|
3
|
+
* Special thanks to the authors for their contribution to the open-source community.
|
|
4
|
+
*/
|
|
5
|
+
export type Faces = {
|
|
6
|
+
index: number;
|
|
7
|
+
deg: number;
|
|
8
|
+
offsetY: number;
|
|
9
|
+
opacity: number;
|
|
10
|
+
scale: number;
|
|
11
|
+
screenHeight: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const degToRad: (deg: number) => number;
|
|
14
|
+
export declare const calcPickerHeight: (faces: Faces[], itemHeight: number) => number;
|
|
15
|
+
export declare const calcHeightOffsets: (itemHeight: number) => number[];
|
|
16
|
+
export declare const createFaces: (itemHeight: number, visibleCount: number) => Faces[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
type IndicatorProps = {
|
|
4
|
+
itemHeight: number;
|
|
5
|
+
indicatorItemStyle?: StyleProp<ViewStyle>;
|
|
6
|
+
indicatorContainerStyle?: StyleProp<ViewStyle>;
|
|
7
|
+
};
|
|
8
|
+
declare const _PickerViewIndicator: {
|
|
9
|
+
({ itemHeight, indicatorItemStyle, indicatorContainerStyle }: IndicatorProps): React.JSX.Element;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
12
|
+
export default _PickerViewIndicator;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
type MaskProps = {
|
|
4
|
+
itemHeight: number;
|
|
5
|
+
maskContainerStyle?: StyleProp<ViewStyle>;
|
|
6
|
+
};
|
|
7
|
+
declare const _PickerViewMask: {
|
|
8
|
+
({ itemHeight, maskContainerStyle }: MaskProps): React.JSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
11
|
+
export default _PickerViewMask;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { PopupBaseProps } from './popupBase';
|
|
3
|
+
export declare const enum PopupType {
|
|
4
|
+
PICKER = "picker"
|
|
5
|
+
}
|
|
6
|
+
export interface IUsePopupOptions {
|
|
7
|
+
modal?: React.ComponentType<PopupBaseProps>;
|
|
8
|
+
type?: PopupType;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 基于 Portal 封装的 Popup 弹窗组件管理 Hooks
|
|
12
|
+
*/
|
|
13
|
+
declare const createPopupManager: (options?: IUsePopupOptions) => {
|
|
14
|
+
open: (childComponent: React.ReactNode, pageId: number | undefined, options?: {
|
|
15
|
+
contentHeight?: number;
|
|
16
|
+
}) => void;
|
|
17
|
+
show: () => void;
|
|
18
|
+
hide: () => void;
|
|
19
|
+
update: (updatedChild: ReactElement | null) => void;
|
|
20
|
+
remove: () => void;
|
|
21
|
+
};
|
|
22
|
+
export { createPopupManager };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface PopupBaseProps {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
hide?: () => void;
|
|
5
|
+
contentHeight?: number;
|
|
6
|
+
visible?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 类似微信 picker 弹窗的动画效果都可以复用此类容器
|
|
10
|
+
* 其他特定类型的弹窗容器组件可以在此基础上封装,或者扩展实现
|
|
11
|
+
*/
|
|
12
|
+
declare const PopupBase: {
|
|
13
|
+
(props?: PopupBaseProps): import("react").JSX.Element;
|
|
14
|
+
displayName: string;
|
|
15
|
+
};
|
|
16
|
+
export default PopupBase;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type PortalProps = {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
};
|
|
5
|
+
declare const Portal: {
|
|
6
|
+
({ children }: PortalProps): null;
|
|
7
|
+
Host: ({ children }: {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
pageId: number;
|
|
10
|
+
}) => JSX.Element;
|
|
11
|
+
add: (e: ReactNode, id: number | null) => number;
|
|
12
|
+
remove: (key: number) => void;
|
|
13
|
+
update: (key: number, e: ReactNode) => void;
|
|
14
|
+
};
|
|
15
|
+
export default Portal;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type PortalHostProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
pageId: number;
|
|
5
|
+
};
|
|
6
|
+
export type Operation = {
|
|
7
|
+
type: 'mount';
|
|
8
|
+
key: number;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
} | {
|
|
11
|
+
type: 'update';
|
|
12
|
+
key: number;
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
} | {
|
|
15
|
+
type: 'unmount';
|
|
16
|
+
key: number;
|
|
17
|
+
};
|
|
18
|
+
declare class PortalGuard {
|
|
19
|
+
private nextKey;
|
|
20
|
+
add: (e: ReactNode, id: number | null) => number;
|
|
21
|
+
remove: (key: number) => void;
|
|
22
|
+
update: (key: number, e: ReactNode) => void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* portal
|
|
26
|
+
*/
|
|
27
|
+
export declare const portal: PortalGuard;
|
|
28
|
+
declare const PortalHost: ({ children }: PortalHostProps) => JSX.Element;
|
|
29
|
+
export default PortalHost;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type State = {
|
|
3
|
+
portals: Array<{
|
|
4
|
+
key: number;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}>;
|
|
7
|
+
};
|
|
8
|
+
declare const _PortalManager: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
|
|
9
|
+
export default _PortalManager;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ✔ bindchange
|
|
3
|
+
*/
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
import { View, NativeSyntheticEvent, ViewStyle } from 'react-native';
|
|
6
|
+
import { HandlerRef } from './useNodesRef';
|
|
7
|
+
export interface RadioGroupProps {
|
|
8
|
+
name: string;
|
|
9
|
+
style?: ViewStyle & Record<string, any>;
|
|
10
|
+
'enable-offset'?: boolean;
|
|
11
|
+
'enable-var'?: boolean;
|
|
12
|
+
'external-var-context'?: Record<string, any>;
|
|
13
|
+
'parent-font-size'?: number;
|
|
14
|
+
'parent-width'?: number;
|
|
15
|
+
'parent-height'?: number;
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
bindchange?: (evt: NativeSyntheticEvent<TouchEvent> | unknown) => void;
|
|
18
|
+
}
|
|
19
|
+
declare const radioGroup: import("react").ForwardRefExoticComponent<RadioGroupProps & import("react").RefAttributes<HandlerRef<View, RadioGroupProps>>>;
|
|
20
|
+
export default radioGroup;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ✔ value
|
|
3
|
+
* ✔ disabled
|
|
4
|
+
* ✔ checked
|
|
5
|
+
* ✔ color
|
|
6
|
+
*/
|
|
7
|
+
import { ReactNode } from 'react';
|
|
8
|
+
import { View, ViewStyle, NativeSyntheticEvent } from 'react-native';
|
|
9
|
+
import { HandlerRef } from './useNodesRef';
|
|
10
|
+
export interface RadioProps {
|
|
11
|
+
value?: string;
|
|
12
|
+
checked?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
color?: string;
|
|
15
|
+
style?: ViewStyle & Record<string, any>;
|
|
16
|
+
'enable-offset'?: boolean;
|
|
17
|
+
'enable-var'?: boolean;
|
|
18
|
+
'external-var-context'?: Record<string, any>;
|
|
19
|
+
'parent-font-size'?: number;
|
|
20
|
+
'parent-width'?: number;
|
|
21
|
+
'parent-height'?: number;
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
bindtap?: (evt: NativeSyntheticEvent<TouchEvent> | unknown) => void;
|
|
24
|
+
}
|
|
25
|
+
declare const Radio: import("react").ForwardRefExoticComponent<RadioProps & import("react").RefAttributes<HandlerRef<View, RadioProps>>>;
|
|
26
|
+
export default Radio;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const generateHTML: (html: string) => string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* ✔ nodes
|
|
4
|
+
*/
|
|
5
|
+
import { View, ViewProps, ViewStyle } from 'react-native';
|
|
6
|
+
import { HandlerRef } from '../useNodesRef';
|
|
7
|
+
type Node = {
|
|
8
|
+
type: 'node' | 'text';
|
|
9
|
+
name?: string;
|
|
10
|
+
attrs?: any;
|
|
11
|
+
children?: Array<Node>;
|
|
12
|
+
text: string;
|
|
13
|
+
};
|
|
14
|
+
interface _RichTextProps extends ViewProps {
|
|
15
|
+
style?: ViewStyle;
|
|
16
|
+
nodes: string | Array<Node>;
|
|
17
|
+
'enable-var'?: boolean;
|
|
18
|
+
'external-var-context'?: Record<string, any>;
|
|
19
|
+
'parent-font-size'?: number;
|
|
20
|
+
'parent-width'?: number;
|
|
21
|
+
'parent-height'?: number;
|
|
22
|
+
}
|
|
23
|
+
declare const _RichText: import("react").ForwardRefExoticComponent<_RichTextProps & import("react").RefAttributes<HandlerRef<View, _RichTextProps>>>;
|
|
24
|
+
export default _RichText;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ✔ enable
|
|
3
|
+
*/
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
interface RootPortalProps {
|
|
6
|
+
enable?: boolean;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
[x: string]: any;
|
|
9
|
+
}
|
|
10
|
+
declare const _RootPortal: {
|
|
11
|
+
(props: RootPortalProps): import("react").FunctionComponentElement<import("./mpx-portal/index").PortalProps>;
|
|
12
|
+
displayName: string;
|
|
13
|
+
};
|
|
14
|
+
export default _RootPortal;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { View, NativeSyntheticEvent, NativeScrollEvent, ViewStyle } from 'react-native';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { HandlerRef } from './useNodesRef';
|
|
4
|
+
import { GestureHandler } from './utils';
|
|
5
|
+
interface ScrollViewProps {
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
enhanced?: boolean;
|
|
8
|
+
bounces?: boolean;
|
|
9
|
+
style?: ViewStyle;
|
|
10
|
+
'scroll-x'?: boolean;
|
|
11
|
+
'scroll-y'?: boolean;
|
|
12
|
+
'enable-back-to-top'?: boolean;
|
|
13
|
+
'show-scrollbar'?: boolean;
|
|
14
|
+
'paging-enabled'?: boolean;
|
|
15
|
+
'upper-threshold'?: number;
|
|
16
|
+
'lower-threshold'?: number;
|
|
17
|
+
'scroll-with-animation'?: boolean;
|
|
18
|
+
'refresher-triggered'?: boolean;
|
|
19
|
+
'refresher-enabled'?: boolean;
|
|
20
|
+
'refresher-default-style'?: 'black' | 'white' | 'none';
|
|
21
|
+
'refresher-background'?: string;
|
|
22
|
+
'refresher-threshold'?: number;
|
|
23
|
+
'scroll-top'?: number;
|
|
24
|
+
'scroll-left'?: number;
|
|
25
|
+
'enable-offset'?: boolean;
|
|
26
|
+
'scroll-into-view'?: string;
|
|
27
|
+
'enable-trigger-intersection-observer'?: boolean;
|
|
28
|
+
'enable-var'?: boolean;
|
|
29
|
+
'external-var-context'?: Record<string, any>;
|
|
30
|
+
'parent-font-size'?: number;
|
|
31
|
+
'parent-width'?: number;
|
|
32
|
+
'parent-height'?: number;
|
|
33
|
+
'enable-sticky'?: boolean;
|
|
34
|
+
'wait-for'?: Array<GestureHandler>;
|
|
35
|
+
'simultaneous-handlers'?: Array<GestureHandler>;
|
|
36
|
+
'scroll-event-throttle'?: number;
|
|
37
|
+
'scroll-into-view-offset'?: number;
|
|
38
|
+
bindscrolltoupper?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
39
|
+
bindscrolltolower?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
40
|
+
bindscroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
41
|
+
bindrefresherrefresh?: (event: NativeSyntheticEvent<unknown>) => void;
|
|
42
|
+
binddragstart?: (event: NativeSyntheticEvent<DragEvent>) => void;
|
|
43
|
+
binddragging?: (event: NativeSyntheticEvent<DragEvent>) => void;
|
|
44
|
+
binddragend?: (event: NativeSyntheticEvent<DragEvent>) => void;
|
|
45
|
+
bindtouchstart?: (event: NativeSyntheticEvent<TouchEvent>) => void;
|
|
46
|
+
bindtouchmove?: (event: NativeSyntheticEvent<TouchEvent>) => void;
|
|
47
|
+
bindtouchend?: (event: NativeSyntheticEvent<TouchEvent>) => void;
|
|
48
|
+
bindscrollend?: (event: NativeSyntheticEvent<TouchEvent>) => void;
|
|
49
|
+
__selectRef?: (selector: string, nodeType: 'node' | 'component', all?: boolean) => HandlerRef<any, any>;
|
|
50
|
+
}
|
|
51
|
+
declare const _ScrollView: import("react").ForwardRefExoticComponent<ScrollViewProps & import("react").RefAttributes<HandlerRef<import("react").ForwardRefExoticComponent<import("react-native").ScrollViewProps & {
|
|
52
|
+
children?: ReactNode;
|
|
53
|
+
} & import("react-native-gesture-handler").NativeViewGestureHandlerProps & import("react").RefAttributes<import("react").ComponentType<any>>> & import("react-native").ScrollView & View, ScrollViewProps>>>;
|
|
54
|
+
export default _ScrollView;
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
* ✔ bindscroll
|
|
33
33
|
*/
|
|
34
34
|
import { ScrollView, RefreshControl, Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
35
|
+
import { Animated as RNAnimated } from 'react-native';
|
|
35
36
|
import { isValidElement, Children, useRef, useState, useEffect, forwardRef, useContext, useMemo, createElement } from 'react';
|
|
36
37
|
import Animated, { useAnimatedRef, useSharedValue, withTiming, useAnimatedStyle, runOnJS } from 'react-native-reanimated';
|
|
37
38
|
import { warn, hasOwn } from '@mpxjs/utils';
|
|
@@ -40,9 +41,11 @@ import useNodesRef from './useNodesRef';
|
|
|
40
41
|
import { splitProps, splitStyle, useTransformStyle, useLayout, wrapChildren, extendObject, flatGesture, HIDDEN_STYLE } from './utils';
|
|
41
42
|
import { IntersectionObserverContext, ScrollViewContext } from './context';
|
|
42
43
|
import Portal from './mpx-portal';
|
|
44
|
+
const AnimatedScrollView = RNAnimated.createAnimatedComponent(ScrollView);
|
|
43
45
|
const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
44
46
|
const { textProps, innerProps: props = {} } = splitProps(scrollViewProps);
|
|
45
|
-
const { enhanced = false, bounces = true, style = {}, binddragstart, binddragging, binddragend, bindtouchstart, bindtouchmove, bindtouchend, 'scroll-x': scrollX = false, 'scroll-y': scrollY = false, 'enable-back-to-top': enableBackToTop = false, 'enable-trigger-intersection-observer': enableTriggerIntersectionObserver = false, 'paging-enabled': pagingEnabled = false, 'upper-threshold': upperThreshold = 50, 'lower-threshold': lowerThreshold = 50, 'scroll-with-animation': scrollWithAnimation = false, 'refresher-enabled': refresherEnabled, 'refresher-default-style': refresherDefaultStyle, 'refresher-background': refresherBackground, 'refresher-threshold': refresherThreshold = 45, 'show-scrollbar': showScrollbar = true, 'scroll-into-view': scrollIntoView = '', 'scroll-top': scrollTop = 0, 'scroll-left': scrollLeft = 0, 'refresher-triggered': refresherTriggered, 'enable-var': enableVar, 'external-var-context': externalVarContext, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight, 'simultaneous-handlers': originSimultaneousHandlers, 'wait-for': waitFor, 'scroll-event-throttle': scrollEventThrottle = 0, __selectRef } = props;
|
|
47
|
+
const { enhanced = false, bounces = true, style = {}, binddragstart, binddragging, binddragend, bindtouchstart, bindtouchmove, bindtouchend, 'scroll-x': scrollX = false, 'scroll-y': scrollY = false, 'enable-back-to-top': enableBackToTop = false, 'enable-trigger-intersection-observer': enableTriggerIntersectionObserver = false, 'paging-enabled': pagingEnabled = false, 'upper-threshold': upperThreshold = 50, 'lower-threshold': lowerThreshold = 50, 'scroll-with-animation': scrollWithAnimation = false, 'refresher-enabled': refresherEnabled, 'refresher-default-style': refresherDefaultStyle, 'refresher-background': refresherBackground, 'refresher-threshold': refresherThreshold = 45, 'show-scrollbar': showScrollbar = true, 'scroll-into-view': scrollIntoView = '', 'scroll-top': scrollTop = 0, 'scroll-left': scrollLeft = 0, 'refresher-triggered': refresherTriggered, 'enable-var': enableVar, 'external-var-context': externalVarContext, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight, 'simultaneous-handlers': originSimultaneousHandlers, 'wait-for': waitFor, 'enable-sticky': enableSticky, 'scroll-event-throttle': scrollEventThrottle = 0, 'scroll-into-view-offset': scrollIntoViewOffset = 0, __selectRef } = props;
|
|
48
|
+
const scrollOffset = useRef(new RNAnimated.Value(0)).current;
|
|
46
49
|
const simultaneousHandlers = flatGesture(originSimultaneousHandlers);
|
|
47
50
|
const waitForHandlers = flatGesture(waitFor);
|
|
48
51
|
const snapScrollTop = useRef(0);
|
|
@@ -66,7 +69,7 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
66
69
|
const hasCallScrollToLower = useRef(false);
|
|
67
70
|
const initialTimeout = useRef(null);
|
|
68
71
|
const intersectionObservers = useContext(IntersectionObserverContext);
|
|
69
|
-
const firstScrollIntoViewChange = useRef(
|
|
72
|
+
const firstScrollIntoViewChange = useRef(true);
|
|
70
73
|
const refreshColor = {
|
|
71
74
|
black: ['#000'],
|
|
72
75
|
white: ['#fff']
|
|
@@ -86,16 +89,18 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
86
89
|
pagingEnabled,
|
|
87
90
|
fastDeceleration: false,
|
|
88
91
|
decelerationDisabled: false,
|
|
89
|
-
scrollTo
|
|
92
|
+
scrollTo,
|
|
93
|
+
scrollIntoView: handleScrollIntoView
|
|
90
94
|
},
|
|
91
95
|
gestureRef: scrollViewRef
|
|
92
96
|
});
|
|
97
|
+
const { layoutRef, layoutStyle, layoutProps } = useLayout({ props, hasSelfPercent, setWidth, setHeight, nodeRef: scrollViewRef, onLayout });
|
|
93
98
|
const contextValue = useMemo(() => {
|
|
94
99
|
return {
|
|
95
|
-
gestureRef: scrollViewRef
|
|
100
|
+
gestureRef: scrollViewRef,
|
|
101
|
+
scrollOffset
|
|
96
102
|
};
|
|
97
103
|
}, []);
|
|
98
|
-
const { layoutRef, layoutStyle, layoutProps } = useLayout({ props, hasSelfPercent, setWidth, setHeight, nodeRef: scrollViewRef, onLayout });
|
|
99
104
|
const hasRefresherLayoutRef = useRef(false);
|
|
100
105
|
// layout 完成前先隐藏,避免安卓闪烁问题
|
|
101
106
|
const refresherLayoutStyle = useMemo(() => { return !hasRefresherLayoutRef.current ? HIDDEN_STYLE : {}; }, [hasRefresherLayoutRef.current]);
|
|
@@ -115,14 +120,16 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
115
120
|
}, [scrollTop, scrollLeft]);
|
|
116
121
|
useEffect(() => {
|
|
117
122
|
if (scrollIntoView && __selectRef) {
|
|
118
|
-
if (
|
|
119
|
-
setTimeout(
|
|
123
|
+
if (firstScrollIntoViewChange.current) {
|
|
124
|
+
setTimeout(() => {
|
|
125
|
+
handleScrollIntoView(scrollIntoView, { offset: scrollIntoViewOffset, animated: scrollWithAnimation });
|
|
126
|
+
});
|
|
120
127
|
}
|
|
121
128
|
else {
|
|
122
|
-
handleScrollIntoView();
|
|
129
|
+
handleScrollIntoView(scrollIntoView, { offset: scrollIntoViewOffset, animated: scrollWithAnimation });
|
|
123
130
|
}
|
|
124
131
|
}
|
|
125
|
-
firstScrollIntoViewChange.current =
|
|
132
|
+
firstScrollIntoViewChange.current = false;
|
|
126
133
|
}, [scrollIntoView]);
|
|
127
134
|
useEffect(() => {
|
|
128
135
|
if (refresherEnabled) {
|
|
@@ -142,13 +149,15 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
142
149
|
function scrollTo({ top = 0, left = 0, animated = false }) {
|
|
143
150
|
scrollToOffset(left, top, animated);
|
|
144
151
|
}
|
|
145
|
-
function handleScrollIntoView() {
|
|
146
|
-
const refs = __selectRef(`#${
|
|
152
|
+
function handleScrollIntoView(selector = '', { offset = 0, animated = true } = {}) {
|
|
153
|
+
const refs = __selectRef(`#${selector}`, 'node');
|
|
147
154
|
if (!refs)
|
|
148
155
|
return;
|
|
149
156
|
const { nodeRef } = refs.getNodeInstance();
|
|
150
157
|
nodeRef.current?.measureLayout(scrollViewRef.current, (left, top) => {
|
|
151
|
-
|
|
158
|
+
const adjustedLeft = scrollX ? left + offset : left;
|
|
159
|
+
const adjustedTop = scrollY ? top + offset : top;
|
|
160
|
+
scrollToOffset(adjustedLeft, adjustedTop, animated);
|
|
152
161
|
});
|
|
153
162
|
}
|
|
154
163
|
function selectLength(size) {
|
|
@@ -321,6 +330,12 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
321
330
|
updateScrollOptions(e, { scrollLeft, scrollTop });
|
|
322
331
|
updateIntersection();
|
|
323
332
|
}
|
|
333
|
+
const scrollHandler = RNAnimated.event([{ nativeEvent: { contentOffset: { y: scrollOffset } } }], {
|
|
334
|
+
useNativeDriver: true,
|
|
335
|
+
listener: (event) => {
|
|
336
|
+
onScroll(event);
|
|
337
|
+
}
|
|
338
|
+
});
|
|
324
339
|
function onScrollDragStart(e) {
|
|
325
340
|
hasCallScrollToLower.current = false;
|
|
326
341
|
hasCallScrollToUpper.current = false;
|
|
@@ -481,7 +496,7 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
481
496
|
scrollEnabled: !enableScroll ? false : !!(scrollX || scrollY),
|
|
482
497
|
bounces: false,
|
|
483
498
|
ref: scrollViewRef,
|
|
484
|
-
onScroll: onScroll,
|
|
499
|
+
onScroll: enableSticky ? scrollHandler : onScroll,
|
|
485
500
|
onContentSizeChange: onContentSizeChange,
|
|
486
501
|
bindtouchstart: ((enhanced && binddragstart) || bindtouchstart) && onScrollTouchStart,
|
|
487
502
|
bindtouchmove: ((enhanced && binddragging) || bindtouchmove) && onScrollTouchMove,
|
|
@@ -523,13 +538,14 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
523
538
|
'bindscrolltolower',
|
|
524
539
|
'bindrefresherrefresh'
|
|
525
540
|
], { layoutRef });
|
|
526
|
-
const
|
|
541
|
+
const ScrollViewComponent = enableSticky ? AnimatedScrollView : ScrollView;
|
|
542
|
+
const withRefresherScrollView = createElement(GestureDetector, { gesture: panGesture }, createElement(ScrollViewComponent, innerProps, createElement(Animated.View, { style: [refresherAnimatedStyle, refresherLayoutStyle], onLayout: onRefresherLayout }, refresherContent), createElement(Animated.View, { style: contentAnimatedStyle }, createElement(ScrollViewContext.Provider, { value: contextValue }, wrapChildren(extendObject({}, props, { children: otherContent }), {
|
|
527
543
|
hasVarDec,
|
|
528
544
|
varContext: varContextRef.current,
|
|
529
545
|
textStyle,
|
|
530
546
|
textProps
|
|
531
547
|
})))));
|
|
532
|
-
const commonScrollView = createElement(
|
|
548
|
+
const commonScrollView = createElement(ScrollViewComponent, extendObject({}, innerProps, {
|
|
533
549
|
refreshControl: refresherEnabled
|
|
534
550
|
? createElement(RefreshControl, extendObject({
|
|
535
551
|
progressBackgroundColor: refresherBackground,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { View, NativeSyntheticEvent, ViewStyle } from 'react-native';
|
|
3
|
+
import { HandlerRef } from './useNodesRef';
|
|
4
|
+
interface StickyHeaderProps {
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
style?: ViewStyle;
|
|
7
|
+
padding?: [number, number, number, number];
|
|
8
|
+
'offset-top'?: number;
|
|
9
|
+
'enable-var'?: boolean;
|
|
10
|
+
'external-var-context'?: Record<string, any>;
|
|
11
|
+
'parent-font-size'?: number;
|
|
12
|
+
'parent-width'?: number;
|
|
13
|
+
'parent-height'?: number;
|
|
14
|
+
bindstickontopchange?: (e: NativeSyntheticEvent<unknown>) => void;
|
|
15
|
+
}
|
|
16
|
+
declare const _StickyHeader: import("react").ForwardRefExoticComponent<StickyHeaderProps & import("react").RefAttributes<HandlerRef<View, StickyHeaderProps>>>;
|
|
17
|
+
export default _StickyHeader;
|