react-native-root-toast icon indicating copy to clipboard operation
react-native-root-toast copied to clipboard

can't set root with react native navigation (rn - v 62.2)

Open rishav-ss opened this issue 5 years ago • 14 comments

with react native navigation, android toast is showing inside sidemenu component. May be default sidemenu is at the top level (as root) so it is showing inside sidemenu from any other component.. Any Help?

rishav-ss avatar Jun 01 '20 10:06 rishav-ss

https://github.com/magicismight/react-native-root-siblings/issues/52#issuecomment-563252331

sunnylqm avatar Jun 01 '20 11:06 sunnylqm

@sunnylqm not working, toast still inside sidemenu not on homescreen

rishav-ss avatar Jun 02 '20 05:06 rishav-ss

Can post your code?

sunnylqm avatar Jun 02 '20 05:06 sunnylqm

let sibling = new RootSiblings(<Container {...props}/>); container -

<Animated.View style={[Styles.toastView,
        {backgroundColor:background}, isBottom ? Styles.bottom : Styles.top, {borderRadius},
        { transform: [{ translateX: animatedXValue }] }]}>
          { position === "top" && 
        <View style={[Styles.spaceTop]}/>}
         <View style={Styles.innerView}>
           <Text numberOfLines={1} style={[Styles.toastText, textStyle]}>
              {message}
            </Text>
           {Object.keys(button).length > 0 && <Button {...button} />}
         </View>
         { position === "bottom" && <View style={[Styles.spaceBottom]}/>}
      </Animated.View>

rishav-ss avatar Jun 02 '20 05:06 rishav-ss

this is working on login/signup screen, but after login inside home screen. There is sidemenu/drawer component which is already on Top layer of Home screen.

Whenever I am calling toast in Home screen and sliding a little drawer, toast is showing inside drawer menu not on home

rishav-ss avatar Jun 02 '20 05:06 rishav-ss

Did you see my link above and use RootSiblingParent?

sunnylqm avatar Jun 02 '20 05:06 sunnylqm

Yes I have applied that, still toast is showing inside drawer . I wanted it in Home screen not inside drawer screen

rishav-ss avatar Jun 02 '20 05:06 rishav-ss

For reproducing - clone wix/react-ntive-navigation example

  1. call react native root toast on app.js or default screen (It seems to work fine)
  2. call root toast on home (any screen with drawer enabled)(It does not work will be shown inside sidemenu)

rishav-ss avatar Jun 02 '20 06:06 rishav-ss

@sunnylqm similar issue https://github.com/magicismight/react-native-root-toast/pull/93

rishav-ss avatar Jun 02 '20 06:06 rishav-ss

Maybe you need to inject RootSiblingParent into each page component. And maybe build a HOC or base component to reuse the logic.

sunnylqm avatar Jun 02 '20 06:06 sunnylqm

Maybe you need to inject RootSiblingParent into each page component. And maybe build a HOC or base component to reuse the logic.

Finally I inject RootSiblingParent into each page component to fix this issue in react-native-navigation

skychx avatar Aug 14 '20 08:08 skychx

Maybe you need to inject RootSiblingParent into each page component. And maybe build a HOC or base component to reuse the logic.

Finally I inject RootSiblingParent into each page component to fix this issue in react-native-navigation

man that's hardcore for my 100 screens application.

JesseWeb avatar Nov 03 '20 02:11 JesseWeb

Maybe you need to inject RootSiblingParent into each page component. And maybe build a HOC or base component to reuse the logic.

Finally I inject RootSiblingParent into each page component to fix this issue in react-native-navigation

man that's hardcore for my 100 screens application.

Hi, the method I just described is effective, but not elegant. After our team evaluated it, we simulated toast using Navigation.showOverlay, we've been live for two months now and it works fine (PS: we have over 200 screens)

skychx avatar Nov 03 '20 02:11 skychx

just use 'react-native-toast-hybrid' to replace the module

shadow-boy avatar May 06 '21 03:05 shadow-boy