react-native-molecules 0.5.0-beta.30 → 0.5.0-beta.31
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/components/Slot/Slot.tsx
CHANGED
|
@@ -211,28 +211,8 @@ function mergeProps(slotProps: AnyProps, childProps: AnyProps) {
|
|
|
211
211
|
return { ...slotProps, ...overrideProps };
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
// Before React 19 accessing `element.props.ref` will throw a warning and suggest using `element.ref`
|
|
215
|
-
// After React 19 accessing `element.ref` does the opposite.
|
|
216
|
-
// https://github.com/facebook/react/pull/28348
|
|
217
|
-
//
|
|
218
|
-
// Access the ref using the method that doesn't yield a warning.
|
|
219
214
|
function getElementRef(element: React.ReactElement) {
|
|
220
|
-
|
|
221
|
-
let getter = Object.getOwnPropertyDescriptor(element.props, 'ref')?.get;
|
|
222
|
-
let mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning;
|
|
223
|
-
if (mayWarn) {
|
|
224
|
-
return (element as any).ref;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// React 19 in DEV
|
|
228
|
-
getter = Object.getOwnPropertyDescriptor(element, 'ref')?.get;
|
|
229
|
-
mayWarn = getter && 'isReactWarning' in getter && getter.isReactWarning;
|
|
230
|
-
if (mayWarn) {
|
|
231
|
-
return (element.props as { ref?: React.Ref<unknown> }).ref;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
// Not DEV
|
|
235
|
-
return (element.props as { ref?: React.Ref<unknown> }).ref || (element as any).ref;
|
|
215
|
+
return (element.props as { ref?: React.Ref<unknown> }).ref;
|
|
236
216
|
}
|
|
237
217
|
|
|
238
218
|
export {
|
|
@@ -22,13 +22,10 @@ const TooltipTrigger = memo(({ children }: { children: ReactElement }) => {
|
|
|
22
22
|
const isWeb = Platform.OS === 'web';
|
|
23
23
|
const { onOpen, onClose, triggerRef } = useContext(TooltipContext);
|
|
24
24
|
const { hovered, actionsRef } = useActionState({ ref: triggerRef, actionsToListen: ['hover'] });
|
|
25
|
+
const childRef = (children.props as { ref?: RefAttributes<any>['ref'] }).ref;
|
|
25
26
|
|
|
26
27
|
// this will make sure children's ref is not overwritten by the triggerRef
|
|
27
|
-
useImperativeHandle(
|
|
28
|
-
// @ts-ignore
|
|
29
|
-
(children as ReactElement & RefAttributes<any>)?.ref,
|
|
30
|
-
() => triggerRef?.current,
|
|
31
|
-
);
|
|
28
|
+
useImperativeHandle(childRef, () => triggerRef?.current);
|
|
32
29
|
|
|
33
30
|
const onLongPress = useCallback(
|
|
34
31
|
(e: unknown) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-molecules",
|
|
3
|
-
"version": "0.5.0-beta.
|
|
3
|
+
"version": "0.5.0-beta.31",
|
|
4
4
|
"author": "Thet Aung <thetaung.dev@gmail.com>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.ts",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@react-native-documents/picker": "^10.1.2",
|
|
45
|
-
"react": "19
|
|
45
|
+
"react": ">=19",
|
|
46
46
|
"react-native": "0.81.4",
|
|
47
47
|
"react-native-svg": ">=12.1.0",
|
|
48
48
|
"react-native-unistyles": "^3.0.22",
|