Call a JavaScript in other aspects using React Native

I want to call a module from one javascript to another module. Currently I downloaded the demo version of GiftedMessanger

I created my own react native (ios) Code, I added all the dependencies of GiftedMessanger in the code, and successfully downloaded all the node modules.
Now included in the GiftedMessanger demo code index.ios.js,

p>

'use strict';

var React = require('react-native');
var {
AppRegistry
} = React;< br />

AppRegistry.registerComponent('GiftedMessengerExample', () => require('./Navigation'));

And all the code runs normally.
I do the same thing in my code. I want to use GiftedMessanger as a separate page, click the button and click the code written like this,

var MessageBox = require('./ Navigation');

var MyCode = React.createClass({

_openGiftedMessanger(){
return ();
},

render: function() {

style={styles.imButton}
onPress ={this._openGiftedMessanger}>
Open Chat Room


}
});

The above is now open Gifted messanger view. And no error is thrown on the console. Where is my error, call the javascript code .

The problem lies in this code:

_openGiftedMessanger()(
return ();
},

To replace the current view with a new view, please use the Navigator or NavigatorIOS component. New The code should look like this:

this.props.navigator.push({
title:'Gifted messenger',
component: MessageBox
));

I want to call a module from one javascript to another module. Currently I have downloaded the demo version of GiftedMessanger

I created my own react native (ios) code, I added all the dependencies of GiftedMessanger in the code, and successfully downloaded all the node modules.
Now included in the GiftedMessanger demo code index.ios.js,< /p>

'use strict';

var React = require('react-native');
var {
AppRegistry< br />) = React;


AppRegistry.registerComponent('GiftedMessengerExample', () => require('./Navigation'));

and all The code runs normally.
I do the same thing in my code. I want to use GiftedMessanger as a separate page, click the button and click the code written like this,

 var MessageBox = req uire('./Navigation');

var MyCode = React.createClass({

_openGiftedMessanger(){
return ();< br /> },

render: function() {

style={styles.imButton}
onPress={this._openGiftedMessanger}>
Open Chat Room


}
));

The above now opens the Gifted messanger view. And no error is thrown on the console. Where is my error, call the javascript code.

The problem lies in this code:

_openGiftedMessanger(){
return ();
},

To replace the current view with a new view, please use the Navigator or NavigatorIOS component. The new code should look like this:

this.props. navigator.push({
title:'Gifted messenger',
component: MessageBox
});

Leave a Comment

Your email address will not be published.