1

I have a Bottom Tab with a Play Button in the middle, I would like to fire a function instead of load a registered screen.

Right now I have:

children: [
    {
      component: {
        id: 'player' 
        name: 'navigation.PlayerScreen',
        passProps: {
          text: 'Player',
        }
      }
    }
  ],

I´m searching if there´s something like that without the need of a screen:

children: [
    {
      component: {
        id: 'player'
        onPress: () => playMusic()
      }
    }
  ],

Versions:

  • "react-native": "0.59.3",
  • "react-native-navigation": "2.16.0"

Thanks in advance.

NEOline
  • 486
  • 7
  • 19
  • 1
    try this page... react native provide lots of event/hooks... https://wix.github.io/react-native-navigation/#/docs/events – sathish kumar Apr 15 '19 at 15:09
  • @sathishkumar I was able to trigger a function with the event `registerBottomTabSelectedListener` but I´m still attached to a screen navigation when I press the button. I just want the function, nothing more. – NEOline Apr 16 '19 at 09:21

1 Answers1

1

This is not possible.

You can do it like this;

  1. Create a component called PlayMusic
  2. Connect onPress to PlayMusic component
  3. Define the PlayMusic component to wix's and then define component.name.

If you want to send parameters to the function, you can use passProps. (Remember to update the PlayMusic component)

Fatih Mert Doğancan
  • 1,016
  • 14
  • 21
  • That´s right, is not possible. Thank you for the alternative, I like the Wix Navigation but we moved to React Navigation and now works like a charm. – NEOline Jun 18 '19 at 13:57
  • 1
    Can you share what's exactly you do in faced same things with react-navigation @NEOline – Oliver D Mar 18 '20 at 23:02