Giter Site home page Giter Site logo

Comments (15)

miihauu avatar miihauu commented on May 26, 2024 11

I am facing the same problem. Any news with fix to this? @gorhom

from react-native-portal.

miihauu avatar miihauu commented on May 26, 2024 8

Ok, I have found a solution.

I wrapped my Portal provider with GestureHandlerRootView

<GestureHandlerRootView style={{ flex: 1 }}>
        <PortalProvider>
          <RootNavigator
                     initialState={initialNavigationState}
                     onStateChange={onNavigationStateChange}
              />
        </PortalProvider>
      </GestureHandlerRootView>

and my BottomSheet component looks like this:

<Portal>
   <BottomSheet {...props] >
      <Content />
   </BottomSheet>
</Portal>

From my side is closed. Thanks for help.

from react-native-portal.

rin2k avatar rin2k commented on May 26, 2024 4

react-native-reanimated and use portal => problem

from react-native-portal.

gorhom avatar gorhom commented on May 26, 2024 2

Any reproducible sample code to work on ?

from react-native-portal.

gorhom avatar gorhom commented on May 26, 2024 2

thanks @miihauu & @AlanSl for investigating this issue, i have added a section in the readme for the usage with gesture handler.

i'll close the ticket, if someone still faces the issue, please create a new issue

from react-native-portal.

AlanSl avatar AlanSl commented on May 26, 2024 1

Could the underlying cause be similar to this (solved) issue on react-native-modalfy - colorfy-software/react-native-modalfy#66?

They're doing a similar thing to this library (using context for pure-JS portal/modal-like behaviour without using React Native's Modal) and their issue was also specific to Android, and also seemed to happen when reanimated was in use and when the feature is used multiple times.

Looks like their issue turned out to be something to do with timing when elements inside the portal/pseudo-modal contained reanimated-powered enter/exit animations.


(off-topic - I don't know why there has been three comments on this issue in the last 20 minutes, mine is completely coincidental 😅)

from react-native-portal.

miihauu avatar miihauu commented on May 26, 2024 1

@AlanSl Thank you for your involvment. I've figured out that app is not exactly freezing, but the bottom sheet is not reacting for dragging it down when it is wrapped in <Portal></Portal>. When I placed button inside sheet to closing it - it works, but I would like to have ability to use gestures. On iOS it works fine so only android devices have problems with that.

Thanks and still looking for solution for that.

from react-native-portal.

lightrow avatar lightrow commented on May 26, 2024 1

i just encountered this issue again. I think it might be due to "exiting" animation of an Animated.View. The structure i have is something like this

<PortalHost name="menu" />
<AppNavigator>
   ...many levels deeper a component that gets mounted/unmounted when menu is activated/dismissed
   <Portal hostName="menu">
      <Animated.View exiting={exitingAnimation} ...>
          ...
      </Animated.View>
   </Portal>

so maybe Animated.View tries to play its exiting animation but Portal does something upon unmount that breaks it all? But again it works fine on iOS...

from react-native-portal.

gurbela avatar gurbela commented on May 26, 2024

any news?

from react-native-portal.

thanhnvpk01168 avatar thanhnvpk01168 commented on May 26, 2024

@hodangnamtien I have to the same problem

from react-native-portal.

iamvucms avatar iamvucms commented on May 26, 2024

Same problem. After two times make portal visible, android app become freeze

from react-native-portal.

bartlomiejwendt avatar bartlomiejwendt commented on May 26, 2024

The same issue on my end. Would be grateful for some updates about this issue from you. @gorhom

from react-native-portal.

miihauu avatar miihauu commented on May 26, 2024

I am using react-native-portal with react-native-bottom-sheet.

Applying provider in App.tsx

const App = () => {
return (
<PortalProvider>
            <RootNavigator
                     initialState={initialNavigationState}
                     onStateChange={onNavigationStateChange}
              />
</PortalProvider>
)}

Using Portal with BottomSheet. This Sheet component is showing with Map (Mapbox library) in background.

const Sheet = () => {
  const { bottomSheetRef } = myContextHook()

  return (
    <Portal>
      <BottomSheet
        index={-1}
        ref={bottomSheetRef}
        snapPoints={[10, 75]}
        enablePanDownToClose
        backdropComponent={(props) => (
          <BottomSheetBackdrop {...props} pressBehavior={'close'} appearsOnIndex={0} disappearsOnIndex={-1} />
        )}
        onChange={() => {}}
      >
        <BottomSheetScrollView contentContainerStyle={{ paddingBottom: '8%' }}>
          <Box>
            My content
          </Box>
        </BottomSheetScrollView>
      </BottomSheet>
    </Portal>
  )
}
"dependencies": {
    "@gorhom/bottom-sheet": "^4.1.5",
    "@gorhom/portal": "^1.0.13",
    "react-native-reanimated": "^2.3.1",
    "react-native-screens": "3.10.2",

Issue appears only on Android. iOS works fine.

from react-native-portal.

AlanSl avatar AlanSl commented on May 26, 2024

I tried a few combinations of reanimated animations, portals and navigators on a standalone app on an Android device, and couldn't replicate this. Even navigating during an exit animation in a portal worked fine.

So this is more subtle than "react-native-reanimated and use portal => problem". More example cases would help.

@miihauu There's a lot of possible causes in that example; dozens of animations within BottomSheet alone, plus the navigator. Does the issue still occur with that bottom-sheet / portal setup without the navigator? E.g. if you temporarily simplify it to this:

const App = () => {
return (
  <PortalProvider>
    <View>/* Some pressable that brings up the bottom sheet */</View>
    <Sheet /> 
  </PortalProvider>
)}

from react-native-portal.

kunuit avatar kunuit commented on May 26, 2024

@lightrow I commented this "exiting" code then fine but without animated. when re-comment and after first-time call exiting => I don't see any bottom sheets. How can we fix it? And Seem I see a run function with 'worklet' maybe this bottomsheet also die

from react-native-portal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.