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

Pass parameters to IOS or Android View #34

Open
ibrahimawadhamid opened this issue Apr 13, 2020 · 8 comments
Open

Pass parameters to IOS or Android View #34

ibrahimawadhamid opened this issue Apr 13, 2020 · 8 comments

Comments

@ibrahimawadhamid
Copy link

How can I pass parameters from cordova JS when initializing a view to the device native view ?

@mfdeveloper
Copy link
Owner

mfdeveloper commented Apr 13, 2020

Hello @ibrahimawadhamid

You can pass params property to the show() method, like this:

cordova.plugins.NativeView.show({
   // Others properties documented in README
   ... 
  params: {
      "toNative": "a custom value",
      "aBooleanValue": true
      "aIntValue": 2
  }
});

By now, you can pass only basic js types, like: String, Boolean and Integer

I will update the README.md with this information in future :)

@ibrahimawadhamid
Copy link
Author

@mfdeveloper sorry to bother, I'm a new in all of this, but how can you access the passed parameters in IOS or Android. Can you provide an example please ?

@ibrahimawadhamid
Copy link
Author

@mfdeveloper I believe that you're not using the passed in params in IOS at all.

@mfdeveloper
Copy link
Owner

mfdeveloper commented Apr 17, 2020

Yeah @ibrahimawadhamid, you are completly right! I saw the code, and the params property passed from js, is catched just in Android implementation by now. I don't remember exatly why, but I think that need some extra steps to do a json convertion in IOS implementation with Objective-C, and when I've using this plugin, the project that I was working, don't need params in IOS

Is not complicated to do this, but I can't alloc time now to implementations in this repo, because I'm busy with others projects 😢

Can you implement this and send a pull request?

@ibrahimawadhamid
Copy link
Author

@mfdeveloper I have zero experience with iOS development. I come from a web development background, so this is all new to me. There's not much I can do in here :(

@mfdeveloper
Copy link
Owner

I understand you completly @ibrahimawadhamid. So, I will try to do this in the next weekend.

But, how can will you get the parameters in IOS, if you don't know nothing about Swift/Objective-C? Someone else will do that for you?

Remember: This plugin is to open a NATIVE screen (ViewController on IOS and Activity on Android).

@ibrahimawadhamid
Copy link
Author

@mfdeveloper , I'm currently working with a colleague of mine on a project where we'll use your plugin on both Android and iOS, we haven't had a problem on Android, unfortunately on iOS it didn't go through since the code is incomplete and we don't have much knowledge with iOS. I'm trying to figure things out, but the progress is terribly slow.

@mfdeveloper
Copy link
Owner

Ok, don't worry @ibrahimawadhamid !!
I will add this feature soon :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants