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.

2
  • 1
    try this page... react native provide lots of event/hooks... wix.github.io/react-native-navigation/#/docs/events Commented Apr 15, 2019 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. Commented Apr 16, 2019 at 9:21

1 Answer 1

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)

Sign up to request clarification or add additional context in comments.

2 Comments

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.
Can you share what's exactly you do in faced same things with react-navigation @NEOline

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.