react-navigation v2 how to send component by params

0

I'm trying to send a component to a new route via params, but the way I'm doing it does not work. Does anyone know to tell me my error?

Component A

this.props.navigation.navigate('ModalInput', {
          input: {
            component: <Input />,
          }
        });

Component ModalInput

    ...
render() {
    const params = this.props.navigation.state.params;

return (
<View>
params.input.component.children()
...
    
asked by anonymous 15.10.2018 / 22:37

1 answer

1

I think what you need is:

Component A

this.props.navigation.navigate('ModalInput', {
    itemId: <Input />,
});

ModalInput

const params = this.props;
const item = params.getParam('itemId', 'NO-ID'); /* itemId sendo o nome do parametro e NO-ID o valor padrão */

source: link

    
15.10.2018 / 23:10