@react-native-ohos/elements 2.3.9-rc.1 → 2.4.0-rc.1
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/README.OpenSource +1 -1
- package/lib/module/Header/Header.js +3 -2
- package/lib/module/Header/Header.js.map +1 -1
- package/lib/module/Header/HeaderButton.js +7 -3
- package/lib/module/Header/HeaderButton.js.map +1 -1
- package/lib/module/Header/HeaderSearchBar.js +2 -3
- package/lib/module/Header/HeaderSearchBar.js.map +1 -1
- package/lib/module/Header/HeaderTitle.js +1 -1
- package/lib/module/Header/HeaderTitle.js.map +1 -1
- package/lib/module/PlatformPressable.js +18 -11
- package/lib/module/PlatformPressable.js.map +1 -1
- package/lib/module/SafeAreaProviderCompat.js +19 -17
- package/lib/module/SafeAreaProviderCompat.js.map +1 -1
- package/lib/module/Screen.js +5 -5
- package/lib/module/Screen.js.map +1 -1
- package/lib/module/getNamedContext.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/useFrameSize.js +174 -0
- package/lib/module/useFrameSize.js.map +1 -0
- package/lib/typescript/src/Header/Header.d.ts.map +1 -1
- package/lib/typescript/src/Header/HeaderButton.d.ts +2 -1
- package/lib/typescript/src/Header/HeaderButton.d.ts.map +1 -1
- package/lib/typescript/src/Header/HeaderSearchBar.d.ts.map +1 -1
- package/lib/typescript/src/PlatformPressable.d.ts +13 -7
- package/lib/typescript/src/PlatformPressable.d.ts.map +1 -1
- package/lib/typescript/src/SafeAreaProviderCompat.d.ts.map +1 -1
- package/lib/typescript/src/Screen.d.ts.map +1 -1
- package/lib/typescript/src/getNamedContext.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/useFrameSize.d.ts +15 -0
- package/lib/typescript/src/useFrameSize.d.ts.map +1 -0
- package/package.json +85 -83
- package/src/Header/Header.tsx +3 -5
- package/src/Header/HeaderButton.tsx +21 -12
- package/src/Header/HeaderSearchBar.tsx +2 -3
- package/src/Header/HeaderTitle.tsx +1 -1
- package/src/PlatformPressable.tsx +52 -29
- package/src/SafeAreaProviderCompat.tsx +23 -19
- package/src/Screen.tsx +8 -10
- package/src/getNamedContext.tsx +0 -1
- package/src/index.tsx +1 -0
- package/src/useFrameSize.tsx +254 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Platform, StyleSheet } from 'react-native';
|
|
5
|
+
import {
|
|
6
|
+
// eslint-disable-next-line no-restricted-imports
|
|
7
|
+
useSafeAreaFrame } from 'react-native-safe-area-context';
|
|
8
|
+
import useLatestCallback from 'use-latest-callback';
|
|
9
|
+
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector';
|
|
10
|
+
|
|
11
|
+
// Load with require to avoid error from webpack due to missing export in older versions
|
|
12
|
+
// eslint-disable-next-line import-x/no-commonjs
|
|
13
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
const SafeAreaListener = require('react-native-safe-area-context').SafeAreaListener;
|
|
15
|
+
const FrameContext = /*#__PURE__*/React.createContext(undefined);
|
|
16
|
+
export function useFrameSize(selector, throttle) {
|
|
17
|
+
const context = React.useContext(FrameContext);
|
|
18
|
+
if (context == null) {
|
|
19
|
+
throw new Error('useFrameSize must be used within a FrameSizeProvider');
|
|
20
|
+
}
|
|
21
|
+
const value = useSyncExternalStoreWithSelector(throttle ? context.subscribeThrottled : context.subscribe, context.getCurrent, context.getCurrent, selector);
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
export function FrameSizeProvider({
|
|
25
|
+
initialFrame,
|
|
26
|
+
children
|
|
27
|
+
}) {
|
|
28
|
+
const context = React.useContext(FrameContext);
|
|
29
|
+
if (context != null) {
|
|
30
|
+
// If the context is already present, don't wrap again
|
|
31
|
+
return children;
|
|
32
|
+
}
|
|
33
|
+
return /*#__PURE__*/_jsx(FrameSizeProviderInner, {
|
|
34
|
+
initialFrame: initialFrame,
|
|
35
|
+
children: children
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function FrameSizeProviderInner({
|
|
39
|
+
initialFrame,
|
|
40
|
+
children
|
|
41
|
+
}) {
|
|
42
|
+
const frameRef = React.useRef({
|
|
43
|
+
width: initialFrame.width,
|
|
44
|
+
height: initialFrame.height
|
|
45
|
+
});
|
|
46
|
+
const listeners = React.useRef(new Set());
|
|
47
|
+
const getCurrent = useLatestCallback(() => frameRef.current);
|
|
48
|
+
const subscribe = useLatestCallback(listener => {
|
|
49
|
+
listeners.current.add(listener);
|
|
50
|
+
return () => {
|
|
51
|
+
listeners.current.delete(listener);
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
const subscribeThrottled = useLatestCallback(listener => {
|
|
55
|
+
const delay = 100; // Throttle delay in milliseconds
|
|
56
|
+
|
|
57
|
+
let timer;
|
|
58
|
+
let updated = false;
|
|
59
|
+
let waiting = false;
|
|
60
|
+
const throttledListener = () => {
|
|
61
|
+
clearTimeout(timer);
|
|
62
|
+
updated = true;
|
|
63
|
+
if (waiting) {
|
|
64
|
+
// Schedule a timer to call the listener at the end
|
|
65
|
+
timer = setTimeout(() => {
|
|
66
|
+
if (updated) {
|
|
67
|
+
updated = false;
|
|
68
|
+
listener();
|
|
69
|
+
}
|
|
70
|
+
}, delay);
|
|
71
|
+
} else {
|
|
72
|
+
waiting = true;
|
|
73
|
+
setTimeout(function () {
|
|
74
|
+
waiting = false;
|
|
75
|
+
}, delay);
|
|
76
|
+
|
|
77
|
+
// Call the listener immediately at start
|
|
78
|
+
updated = false;
|
|
79
|
+
listener();
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const unsubscribe = subscribe(throttledListener);
|
|
83
|
+
return () => {
|
|
84
|
+
unsubscribe();
|
|
85
|
+
clearTimeout(timer);
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
const context = React.useMemo(() => ({
|
|
89
|
+
getCurrent,
|
|
90
|
+
subscribe,
|
|
91
|
+
subscribeThrottled
|
|
92
|
+
}), [subscribe, subscribeThrottled, getCurrent]);
|
|
93
|
+
const onChange = useLatestCallback(frame => {
|
|
94
|
+
if (frameRef.current.height === frame.height && frameRef.current.width === frame.width) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
frameRef.current = {
|
|
98
|
+
width: frame.width,
|
|
99
|
+
height: frame.height
|
|
100
|
+
};
|
|
101
|
+
listeners.current.forEach(listener => listener());
|
|
102
|
+
});
|
|
103
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
104
|
+
children: [Platform.OS === 'web' ? /*#__PURE__*/_jsx(FrameSizeListenerWeb, {
|
|
105
|
+
onChange: onChange
|
|
106
|
+
}) : typeof SafeAreaListener === 'undefined' ? /*#__PURE__*/_jsx(FrameSizeListenerNativeFallback, {
|
|
107
|
+
onChange: onChange
|
|
108
|
+
}) : /*#__PURE__*/_jsx(SafeAreaListener, {
|
|
109
|
+
onChange: ({
|
|
110
|
+
frame
|
|
111
|
+
}) => onChange(frame),
|
|
112
|
+
style: StyleSheet.absoluteFill
|
|
113
|
+
}), /*#__PURE__*/_jsx(FrameContext.Provider, {
|
|
114
|
+
value: context,
|
|
115
|
+
children: children
|
|
116
|
+
})]
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// SafeAreaListener is available only on newer versions
|
|
121
|
+
// Fallback to an effect-based shim for older versions
|
|
122
|
+
function FrameSizeListenerNativeFallback({
|
|
123
|
+
onChange
|
|
124
|
+
}) {
|
|
125
|
+
const frame = useSafeAreaFrame();
|
|
126
|
+
React.useLayoutEffect(() => {
|
|
127
|
+
onChange(frame);
|
|
128
|
+
}, [frame, onChange]);
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// FIXME: On the Web, the safe area frame value doesn't update on resize
|
|
133
|
+
// So we workaround this by measuring the frame on resize
|
|
134
|
+
function FrameSizeListenerWeb({
|
|
135
|
+
onChange
|
|
136
|
+
}) {
|
|
137
|
+
const elementRef = React.useRef(null);
|
|
138
|
+
React.useEffect(() => {
|
|
139
|
+
if (elementRef.current == null) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const rect = elementRef.current.getBoundingClientRect();
|
|
143
|
+
onChange({
|
|
144
|
+
width: rect.width,
|
|
145
|
+
height: rect.height
|
|
146
|
+
});
|
|
147
|
+
const observer = new ResizeObserver(entries => {
|
|
148
|
+
const entry = entries[0];
|
|
149
|
+
if (entry) {
|
|
150
|
+
const {
|
|
151
|
+
width,
|
|
152
|
+
height
|
|
153
|
+
} = entry.contentRect;
|
|
154
|
+
onChange({
|
|
155
|
+
width,
|
|
156
|
+
height
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
observer.observe(elementRef.current);
|
|
161
|
+
return () => {
|
|
162
|
+
observer.disconnect();
|
|
163
|
+
};
|
|
164
|
+
}, [onChange]);
|
|
165
|
+
return /*#__PURE__*/_jsx("div", {
|
|
166
|
+
ref: elementRef,
|
|
167
|
+
style: {
|
|
168
|
+
...StyleSheet.absoluteFillObject,
|
|
169
|
+
pointerEvents: 'none',
|
|
170
|
+
visibility: 'hidden'
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=useFrameSize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Platform","StyleSheet","useSafeAreaFrame","useLatestCallback","useSyncExternalStoreWithSelector","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","SafeAreaListener","require","FrameContext","createContext","undefined","useFrameSize","selector","throttle","context","useContext","Error","value","subscribeThrottled","subscribe","getCurrent","FrameSizeProvider","initialFrame","children","FrameSizeProviderInner","frameRef","useRef","width","height","listeners","Set","current","listener","add","delete","delay","timer","updated","waiting","throttledListener","clearTimeout","setTimeout","unsubscribe","useMemo","onChange","frame","forEach","OS","FrameSizeListenerWeb","FrameSizeListenerNativeFallback","style","absoluteFill","Provider","useLayoutEffect","elementRef","useEffect","rect","getBoundingClientRect","observer","ResizeObserver","entries","entry","contentRect","observe","disconnect","ref","absoluteFillObject","pointerEvents","visibility"],"sourceRoot":"..\\..\\src","sources":["useFrameSize.tsx"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SACEC,QAAQ,EAERC,UAAU,QAEL,cAAc;AACrB;AACE;AACAC,gBAAgB,QACX,gCAAgC;AACvC,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,SAASC,gCAAgC,QAAQ,uCAAuC;;AAExF;AACA;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAMA,MAAMC,gBAAgB,GAAIC,OAAO,CAAC,gCAAgC,CAAC,CAEhED,gBAAgB;AAiBnB,MAAME,YAAY,gBAAGd,KAAK,CAACe,aAAa,CACtCC,SACF,CAAC;AAED,OAAO,SAASC,YAAYA,CAC1BC,QAA6B,EAC7BC,QAAkB,EACf;EACH,MAAMC,OAAO,GAAGpB,KAAK,CAACqB,UAAU,CAACP,YAAY,CAAC;EAE9C,IAAIM,OAAO,IAAI,IAAI,EAAE;IACnB,MAAM,IAAIE,KAAK,CAAC,sDAAsD,CAAC;EACzE;EAEA,MAAMC,KAAK,GAAGlB,gCAAgC,CAC5Cc,QAAQ,GAAGC,OAAO,CAACI,kBAAkB,GAAGJ,OAAO,CAACK,SAAS,EACzDL,OAAO,CAACM,UAAU,EAClBN,OAAO,CAACM,UAAU,EAClBR,QACF,CAAC;EAED,OAAOK,KAAK;AACd;AAQA,OAAO,SAASI,iBAAiBA,CAAC;EAChCC,YAAY;EACZC;AACsB,CAAC,EAAE;EACzB,MAAMT,OAAO,GAAGpB,KAAK,CAACqB,UAAU,CAACP,YAAY,CAAC;EAE9C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O,CAAC,CAAC;MAC7B;IACF,CAAC,CAAC;IAEF8B,QAAQ,CAACK,OAAO,CAACT,UAAU,CAACvB,OAAO,CAAC;IAEpC,OAAO,MAAM;MACX2B,QAAQ,CAACM,UAAU,CAAC,CAAC;IACvB,CAAC;EACH,CAAC,EAAE,CAACpB,QAAQ,CAAC,CAAC;EAEd,oBACE3C,IAAA;IACEgE,GAAG,EAAEX,UAAW;IAChBJ,KAAK,EAAE;MACL,GAAGtD,UAAU,CAACsE,kBAAkB;MAChCC,aAAa,EAAE,MAAM;MACrBC,UAAU,EAAE;IACd;EAAE,CACH,CAAC;AAEN","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../../src/Header/Header.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../../src/Header/Header.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AActD,KAAK,KAAK,GAAG,aAAa,GAAG;IAC3B;;OAEG;IACH,IAAI,CAAC,EAAE;QACL;;WAEG;QACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;QAC1B;;WAEG;QACH,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;KAC1B,CAAC;IACF;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAkBF,wBAAgB,MAAM,CAAC,KAAK,EAAE,KAAK,2CA2VlC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import type { HeaderButtonProps } from '../types';
|
|
2
|
-
export declare
|
|
3
|
+
export declare const HeaderButton: React.ForwardRefExoticComponent<HeaderButtonProps & React.RefAttributes<import("react-native").View | import("react-native").Animated.LegacyRef<import("react-native").View>>>;
|
|
3
4
|
//# sourceMappingURL=HeaderButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderButton.d.ts","sourceRoot":"","sources":["../../../../src/Header/HeaderButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HeaderButton.d.ts","sourceRoot":"","sources":["../../../../src/Header/HeaderButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAsClD,eAAO,MAAM,YAAY,gLAAyC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderSearchBar.d.ts","sourceRoot":"","sources":["../../../../src/Header/HeaderSearchBar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,QAAQ,EAGR,KAAK,SAAS,EAId,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAOtB,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"HeaderSearchBar.d.ts","sourceRoot":"","sources":["../../../../src/Header/HeaderSearchBar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,QAAQ,EAGR,KAAK,SAAS,EAId,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAOtB,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AA8S3E,eAAO,MAAM,eAAe;aAzSjB,OAAO;aACP,MAAM,IAAI;gBACP,MAAM;YACV,QAAQ,CAAC,iBAAiB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;4CAsSc,CAAC"}
|
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Animated, type PressableProps, type StyleProp, type ViewStyle } from 'react-native';
|
|
2
|
+
import { Animated, type GestureResponderEvent, type PressableProps, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
3
|
type HoverEffectProps = {
|
|
4
4
|
color?: string;
|
|
5
5
|
hoverOpacity?: number;
|
|
6
6
|
activeOpacity?: number;
|
|
7
7
|
};
|
|
8
|
-
export type Props = Omit<PressableProps, 'style'> & {
|
|
8
|
+
export type Props = Omit<PressableProps, 'style' | 'onPress'> & {
|
|
9
|
+
href?: string;
|
|
9
10
|
pressColor?: string;
|
|
10
11
|
pressOpacity?: number;
|
|
11
12
|
hoverEffect?: HoverEffectProps;
|
|
12
13
|
style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
|
13
|
-
|
|
14
|
+
onPress?: (e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent) => void;
|
|
14
15
|
children: React.ReactNode;
|
|
15
16
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
export declare const PlatformPressable: React.ForwardRefExoticComponent<Omit<PressableProps, "style" | "onPress"> & {
|
|
18
|
+
href?: string;
|
|
19
|
+
pressColor?: string;
|
|
20
|
+
pressOpacity?: number;
|
|
21
|
+
hoverEffect?: HoverEffectProps;
|
|
22
|
+
style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
|
23
|
+
onPress?: (e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent) => void;
|
|
24
|
+
children: React.ReactNode;
|
|
25
|
+
} & React.RefAttributes<import("react-native").View | Animated.LegacyRef<import("react-native").View>>>;
|
|
20
26
|
export {};
|
|
21
27
|
//# sourceMappingURL=PlatformPressable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformPressable.d.ts","sourceRoot":"","sources":["../../../src/PlatformPressable.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,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C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SafeAreaProviderCompat.d.ts","sourceRoot":"","sources":["../../../src/SafeAreaProviderCompat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGL,KAAK,SAAS,EAGd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"SafeAreaProviderCompat.d.ts","sourceRoot":"","sources":["../../../src/SafeAreaProviderCompat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGL,KAAK,SAAS,EAGd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAStB,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAeF,wBAAgB,sBAAsB,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,KAAK,2CAqBhE;yBArBe,sBAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Screen.d.ts","sourceRoot":"","sources":["../../../src/Screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EAEnB,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,QAAQ,EACR,KAAK,SAAS,EAGd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Screen.d.ts","sourceRoot":"","sources":["../../../src/Screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EAEnB,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,QAAQ,EACR,KAAK,SAAS,EAGd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAStB,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;IAC1C,KAAK,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;IAChC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,KAAK,CAAC,EAAE,QAAQ,CAAC,iBAAiB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;IACzD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,wBAAgB,MAAM,CAAC,KAAK,EAAE,KAAK,2CAkElC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNamedContext.d.ts","sourceRoot":"","sources":["../../../src/getNamedContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,CAAC,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"getNamedContext.d.ts","sourceRoot":"","sources":["../../../src/getNamedContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,qCAAqC,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;CAC5E;AAMD,wBAAgB,eAAe,CAAC,CAAC,EAC/B,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,CAAC,GACd,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAalB"}
|
|
@@ -20,6 +20,7 @@ export { ResourceSavingView } from './ResourceSavingView';
|
|
|
20
20
|
export { SafeAreaProviderCompat } from './SafeAreaProviderCompat';
|
|
21
21
|
export { Screen } from './Screen';
|
|
22
22
|
export { Text } from './Text';
|
|
23
|
+
export { useFrameSize } from './useFrameSize';
|
|
23
24
|
export declare const Assets: any[];
|
|
24
25
|
export * from './types';
|
|
25
26
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OA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E,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,eAAO,MAAM,MAAM,OAMlB,CAAC;AAEF,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
type Frame = {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function useFrameSize<T>(selector: (frame: Frame) => T, throttle?: boolean): T;
|
|
8
|
+
type FrameSizeProviderProps = {
|
|
9
|
+
initialFrame: Frame;
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
style?: StyleProp<ViewStyle>;
|
|
12
|
+
};
|
|
13
|
+
export declare function FrameSizeProvider({ initialFrame, children, }: FrameSizeProviderProps): string | number | boolean | Iterable<React.ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=useFrameSize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFrameSize.d.ts","sourceRoot":"","sources":["../../../src/useFrameSize.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAEL,KAAK,SAAS,EAEd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAmBtB,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAgBF,wBAAgB,YAAY,CAAC,CAAC,EAC5B,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,EAC7B,QAAQ,CAAC,EAAE,OAAO,GACjB,CAAC,CAeH;AAED,KAAK,sBAAsB,GAAG;IAC5B,YAAY,EAAE,KAAK,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAChC,YAAY,EACZ,QAAQ,GACT,EAAE,sBAAsB,sHAaxB"}
|
package/package.json
CHANGED
|
@@ -1,83 +1,85 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@react-native-ohos/elements",
|
|
3
|
-
"description": "UI Components for React Navigation",
|
|
4
|
-
"version": "2.
|
|
5
|
-
"harmony": {
|
|
6
|
-
"alias": "@react-navigation/elements"
|
|
7
|
-
},
|
|
8
|
-
"keywords": [
|
|
9
|
-
"react-native",
|
|
10
|
-
"react-navigation",
|
|
11
|
-
"ios",
|
|
12
|
-
"android"
|
|
13
|
-
],
|
|
14
|
-
"license": "MIT",
|
|
15
|
-
"repository": {
|
|
16
|
-
"type": "git",
|
|
17
|
-
"url": "git+https://gitcode.com/openharmony-sig/rntpc_react-navigation.git",
|
|
18
|
-
"directory": "packages/elements"
|
|
19
|
-
},
|
|
20
|
-
"source": "./src/index.tsx",
|
|
21
|
-
"main": "./lib/module/index.js",
|
|
22
|
-
"types": "./lib/typescript/src/index.d.ts",
|
|
23
|
-
"exports": {
|
|
24
|
-
".": {
|
|
25
|
-
"types": "./lib/typescript/src/index.d.ts",
|
|
26
|
-
"default": "./lib/module/index.js"
|
|
27
|
-
},
|
|
28
|
-
"./package.json": "./package.json"
|
|
29
|
-
},
|
|
30
|
-
"files": [
|
|
31
|
-
"src",
|
|
32
|
-
"lib",
|
|
33
|
-
"harmony"
|
|
34
|
-
],
|
|
35
|
-
"sideEffects": false,
|
|
36
|
-
"publishConfig": {
|
|
37
|
-
"access": "public"
|
|
38
|
-
},
|
|
39
|
-
"scripts": {
|
|
40
|
-
"prepack": "bob build",
|
|
41
|
-
"clean": "del lib"
|
|
42
|
-
},
|
|
43
|
-
"dependencies": {
|
|
44
|
-
"color": "^4.2.3"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"@
|
|
49
|
-
"@react-native-oh-tpl/react-native-
|
|
50
|
-
"@react-
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"react
|
|
57
|
-
"react-
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"react-native": "
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@react-native-ohos/elements",
|
|
3
|
+
"description": "UI Components for React Navigation",
|
|
4
|
+
"version": "2.4.0-rc.1",
|
|
5
|
+
"harmony": {
|
|
6
|
+
"alias": "@react-navigation/elements"
|
|
7
|
+
},
|
|
8
|
+
"keywords": [
|
|
9
|
+
"react-native",
|
|
10
|
+
"react-navigation",
|
|
11
|
+
"ios",
|
|
12
|
+
"android"
|
|
13
|
+
],
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://gitcode.com/openharmony-sig/rntpc_react-navigation.git",
|
|
18
|
+
"directory": "packages/elements"
|
|
19
|
+
},
|
|
20
|
+
"source": "./src/index.tsx",
|
|
21
|
+
"main": "./lib/module/index.js",
|
|
22
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
26
|
+
"default": "./lib/module/index.js"
|
|
27
|
+
},
|
|
28
|
+
"./package.json": "./package.json"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"src",
|
|
32
|
+
"lib",
|
|
33
|
+
"harmony"
|
|
34
|
+
],
|
|
35
|
+
"sideEffects": false,
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"prepack": "bob build",
|
|
41
|
+
"clean": "del lib"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"color": "^4.2.3",
|
|
45
|
+
"use-sync-external-store": "^1.5.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@jest/globals": "^29.7.0",
|
|
49
|
+
"@react-native-oh-tpl/masked-view": "file:./react-native-oh-tpl-masked-view-v0.3.2.tgz",
|
|
50
|
+
"@react-native-oh-tpl/react-native-safe-area-context": "^4.7.4-0.0.6",
|
|
51
|
+
"@react-navigation/native": "^7.1.6",
|
|
52
|
+
"@testing-library/react-native": "^12.8.1",
|
|
53
|
+
"@types/react": "~18.3.12",
|
|
54
|
+
"@types/use-sync-external-store": "^1.5.0",
|
|
55
|
+
"del-cli": "^5.1.0",
|
|
56
|
+
"react": "18.3.1",
|
|
57
|
+
"react-native": "0.76.2",
|
|
58
|
+
"react-native-builder-bob": "^0.40.0",
|
|
59
|
+
"react-test-renderer": "18.2.0",
|
|
60
|
+
"typescript": "^5.5.2"
|
|
61
|
+
},
|
|
62
|
+
"peerDependencies": {
|
|
63
|
+
"@react-navigation/native": "^7.1.6",
|
|
64
|
+
"react": ">= 18.2.0",
|
|
65
|
+
"react-native": "*"
|
|
66
|
+
},
|
|
67
|
+
"react-native-builder-bob": {
|
|
68
|
+
"source": "src",
|
|
69
|
+
"output": "lib",
|
|
70
|
+
"targets": [
|
|
71
|
+
[
|
|
72
|
+
"module",
|
|
73
|
+
{
|
|
74
|
+
"esm": true
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
[
|
|
78
|
+
"typescript",
|
|
79
|
+
{
|
|
80
|
+
"project": "tsconfig.build.json"
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
}
|
package/src/Header/Header.tsx
CHANGED
|
@@ -9,13 +9,11 @@ import {
|
|
|
9
9
|
View,
|
|
10
10
|
type ViewStyle,
|
|
11
11
|
} from 'react-native';
|
|
12
|
-
import {
|
|
13
|
-
useSafeAreaFrame,
|
|
14
|
-
useSafeAreaInsets,
|
|
15
|
-
} from 'react-native-safe-area-context';
|
|
12
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
16
13
|
|
|
17
14
|
import searchIcon from '../assets/search-icon.png';
|
|
18
15
|
import type { HeaderOptions, Layout } from '../types';
|
|
16
|
+
import { useFrameSize } from '../useFrameSize';
|
|
19
17
|
import { getDefaultHeaderHeight } from './getDefaultHeaderHeight';
|
|
20
18
|
import { HeaderBackButton } from './HeaderBackButton';
|
|
21
19
|
import { HeaderBackground } from './HeaderBackground';
|
|
@@ -74,7 +72,7 @@ const warnIfHeaderStylesDefined = (styles: Record<string, any>) => {
|
|
|
74
72
|
|
|
75
73
|
export function Header(props: Props) {
|
|
76
74
|
const insets = useSafeAreaInsets();
|
|
77
|
-
const frame =
|
|
75
|
+
const frame = useFrameSize((size) => size, true);
|
|
78
76
|
const { colors } = useTheme();
|
|
79
77
|
|
|
80
78
|
const navigation = useNavigation();
|
|
@@ -1,24 +1,29 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import { Platform, StyleSheet } from 'react-native';
|
|
2
3
|
|
|
3
4
|
import { PlatformPressable } from '../PlatformPressable';
|
|
4
5
|
import type { HeaderButtonProps } from '../types';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
function HeaderButtonInternal(
|
|
8
|
+
{
|
|
9
|
+
disabled,
|
|
10
|
+
onPress,
|
|
11
|
+
pressColor,
|
|
12
|
+
pressOpacity,
|
|
13
|
+
accessibilityLabel,
|
|
14
|
+
testID,
|
|
15
|
+
style,
|
|
16
|
+
href,
|
|
17
|
+
children,
|
|
18
|
+
}: HeaderButtonProps,
|
|
19
|
+
ref: React.Ref<React.ComponentRef<typeof PlatformPressable>>
|
|
20
|
+
) {
|
|
17
21
|
return (
|
|
18
22
|
<PlatformPressable
|
|
23
|
+
ref={ref}
|
|
19
24
|
disabled={disabled}
|
|
20
25
|
href={href}
|
|
21
|
-
|
|
26
|
+
aria-label={accessibilityLabel}
|
|
22
27
|
testID={testID}
|
|
23
28
|
onPress={onPress}
|
|
24
29
|
pressColor={pressColor}
|
|
@@ -35,6 +40,10 @@ export function HeaderButton({
|
|
|
35
40
|
);
|
|
36
41
|
}
|
|
37
42
|
|
|
43
|
+
export const HeaderButton = React.forwardRef(HeaderButtonInternal);
|
|
44
|
+
|
|
45
|
+
HeaderButton.displayName = 'HeaderButton';
|
|
46
|
+
|
|
38
47
|
const androidRipple = {
|
|
39
48
|
borderless: true,
|
|
40
49
|
foreground: Platform.OS === 'android' && Platform.Version >= 23,
|
|
@@ -157,9 +157,8 @@ function HeaderSearchBarInternal(
|
|
|
157
157
|
return (
|
|
158
158
|
<Animated.View
|
|
159
159
|
pointerEvents={visible ? 'auto' : 'none'}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
importantForAccessibility={visible ? 'auto' : 'no-hide-descendants'}
|
|
160
|
+
aria-live="polite"
|
|
161
|
+
aria-hidden={!visible}
|
|
163
162
|
style={[styles.container, { opacity: visibleAnim }, style]}
|
|
164
163
|
>
|
|
165
164
|
<View style={styles.searchbarContainer}>
|