-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React Native v0.76 not supported #181
Comments
This is likely related to the new architecture which is enabled by default in React Native 0.76 (but can be disabled if needed - https://reactnative.dev/blog/2024/10/23/the-new-architecture-is-here#opt-out). |
Yes, but I need the new architecture, so I created a PR to use Sorry, forgot to mention this above but there's a workaround for now by calculating This is not ideal as this has a bit of delay in popover opening because of how react state works. import React, { useLayoutEffect, useRef, useState } from "react"
import { StyleSheet, View, Pressable, Text, TouchableOpacity } from "react-native"
import Popover, {Rect} from "react-native-popover-view"
export const PopoverMenu = ({ items }: PopoverMenuProps) => {
const [isPopoverOpen, setIsPopoverOpen] = useState(false)
const [position, setPosition] = useState<Rect>(new Rect(0, 0, 0, 0))
const fromElRef = useRef<React.ElementRef<typeof TouchableOpacity>>(null)
useLayoutEffect(() => {
fromElRef.current?.measureInWindow((x, y, width, height) => {
setPosition(new Rect(x, y, width, height))
})
}, [])
return (
<>
<TouchableOpacity ref={fromElRef} onPress={() => setIsPopoverOpen(true)}>
<Text>Open</Text>
</TouchableOpacity>
<Popover
from={position}
isVisible={isPopoverOpen}
offset={10}
onRequestClose={() => setIsPopoverOpen(false)}
>
{items.map((item, index) => (
<View key={item.title}>
<Pressable
onPress={() => {
setIsPopoverOpen(false)
}}
>
<View>
<Text>{item.title}</Text>
</View>
</Pressable>
</View>
))}
</Popover>
</>
)
} |
Man, you are my savior, I made this component and replaced with it my popovers in app and it worked:
|
I'm trying to do my first project in react native When i enter What went wrong:
|
Describe the bug
Use of
NativeModules.UIManager.measure
in Utility.ts is not working in the new architecture.Device/Setup Info:
react-native
version: 0.76.1react-native-popover-view
version: 5.1.9Screenshots
Popover doesn't open
Debug Output
It never moves from the initial Rect of 0,0,0,0
The text was updated successfully, but these errors were encountered: