Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about Native Modules #15586

Closed
sm2017 opened this issue Aug 21, 2017 · 2 comments
Closed

Question about Native Modules #15586

sm2017 opened this issue Aug 21, 2017 · 2 comments
Labels
Ran Commands One of our bots successfully processed a command. Resolution: For Stack Overflow A question for Stack Overflow. Applying this label will cause issue to be closed. Resolution: Locked This issue was locked by the bot.

Comments

@sm2017
Copy link
Contributor

sm2017 commented Aug 21, 2017

According to https://facebook.github.io/react-native/docs/native-modules-android.html native android modules extends ReactContextBaseJavaModule , Is the module singleton?

If I have the following method

@ReactMethod 
public void testMethod(String message, Promise promise) { 
    this.promise = promise;
}

and

MyModule.testMethod('A').then(function(result){
    console.log(result);
});

MyModule.testMethod('B').then(function(result){
    console.log(result);
});

MyModule.testMethod('C').then(function(result){
    console.log(result);
});

What happens exactly? is MyModule.testMethod('C') overwrite this.promise (the module is singleton ) OR each time the new instance of module is created and promise is a property and isolated?

@chirag04
Copy link
Contributor

@facebook-github-bot stack-overflow

@facebook-github-bot
Copy link
Contributor

Hey @sm2017, thanks for posting this! @chirag04 tells me this issue looks like a question that would be best asked on Stack Overflow. Stack Overflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only. See "What to Expect from Maintainers".

@facebook-github-bot facebook-github-bot added the Resolution: For Stack Overflow A question for Stack Overflow. Applying this label will cause issue to be closed. label Aug 21, 2017
@facebook-github-bot facebook-github-bot added the Ran Commands One of our bots successfully processed a command. label Aug 21, 2017
@facebook facebook locked as resolved and limited conversation to collaborators Aug 21, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Aug 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Resolution: For Stack Overflow A question for Stack Overflow. Applying this label will cause issue to be closed. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants