Is it possible to use NativeScript's WebView as a WebMap in a hybrid app? - webview

For example, the WebView will load a local map.html
This map.html will have a map loaded on it via main-page.js, so this JS file will by both Native and WebView elements.
On top of this WebView map will be a floating native button that pans the map to your location.
Is this flow possible in NativeScript? A JS file that controls both native elements and a WebView
If possible, how is this integration achieved? Does it need some complex setup?
Is this flow recommended? Would it cause any major performance issues?

It's absolutely possible to have a WebView and place native button over it. But you can't control everything within single JS file, you have to use nativescript-webview-interface plugin to interact between WebView and native functions.
If you ask about performance, WebView is never great not just with NativeScript but in general. Imagine how you would feel when using your Google Maps within Chrome of your Android, that's going to be the user experience. Almost every map apis got native libraries for iOS & Android, at least {N} has plugins for Google Map and Mapbox, so I would recommend that.

Related

Is possible to use React Native *only for UI* and the logic in .NET?

I need to create a multi-platform app for web, ios, android and partially desktop.
I wish to use .NET/F#, but the UI is a complication. I have tried Xamarin.Forms and it is too limited to me. I could live to use React Native but I don't wanna to code the full app in javascript, instead, I wish to use F# for all the logic and web backend, and use react only for the UI in mobile.
But I wonder how?
How feed data to the UI and react to events there?
P.D: If nativescript make this possible I'm all ears. I'm still not rule out xamarin for it, but forms is too limited and the nature of the apps and so far think react native is the closer to my needs.
There's already a sample of this, because the entry file of the Fable React Native demo is a pure JS file that calls the JS generated by Fable. You just need to extend this pure JS layer and import the code generated by Fable when needed.

json2view like solution for iOS

For Android I see there is a very good solution Json2View:
https://github.com/Avocarrot/json2view
for creating Android app UI on the fly. Is there any similar solution available for iOS? Is there any constraint is having JSON based UI concept for iOS, the way json2view does for Android? Or best would be some common open source library that has flavor for both Android and iOS.
Using React Native you can accomplish the same.
Strictly speaking, its not Json to View but its JavaScript to View.
Whatever views you create in ReactJS, will be created using native UIKit Framework.
For example, if you use scrollview component in JS, it will use a scrollview subclassed of UIScrollView.
Please check this link for in-depth overview
https://facebook.github.io/react-native/
https://github.com/facebook/react-native/issues/823
You cannot do anything like this, you will get apple rejected because of using any kind of code injection.

How can I call native ios api from cocos2d html5 with javascript binding project?

Can cocos2d html5 with javacript binding project for ios call ios native api? I am looking for the way to access the ios device camera, photos, etc.
Nope. The whole point of the JS API is to have a common subset of the API that works across all platforms (on the web you can't access the camera or a photo library), with the exception of the most commonly needed features like input.
You can write the camera etc code in Objective-C. You can then expose your methods as JS bindings as needed.
You can wrap the Cocos2d-html5 project in Cordova, then use the Cordova methods to call all the native functionality you mention

Custom Cordova IOS keyboard

I am working on a Cordova app for which the client insists we have a custom keyboard for numeric input that looks native; the goal is similar to a keyboard that comes up with PayPal.
Here is the problem: we need to do this without touching the way things work for Android in our app. This probably means we need to create a cordova plugin, but I have read that creating custom keyboard is looked down on by the folks over at Apple (see this old post about it).
I've had a very difficult time finding any documentation on how to do this with Cordova on IOS, which makes me lean towards rolling a solution inside of Cordova using a jquery library. My question has two parts:
1: If possible, how does one create a custom keyboard for html5 inputs in Cordova as an IOS plugin?
2: If this is a lost cause, what existing jquery plugins would you recommend instead?

Phonegap and iPhone apps

I want to build an iPhone app, but I only know PHP, JavaScript, CSS and HTML. I heard that I can use Phonegap to build the app in javascript and it converts the JavaScript to Objective-C. Is that true? The phone gap documentation was hard to understand. What other solutions do I have?
Yes and no.
Phonegap (nowadays known as Apache Cordova) enables you to bundle web pages/applications as native phone apps. It also provides you with some JavaScript bindings to native phone APIs that you otherwise wouldn't be able to access (=with a plain webpage). These bindings include (just to name a few) Accelerometer, Camera and Compass. That's pretty much all it does - you still have to figure out how to write your application with JavaScript, HTML and CSS.
Try out how it works by checking out "Getting Started with iOS".
If you know all these languages you mentioned that is well enough for developing an iOS App(as well as you can develop the same apps in Android).
I would suggest you to go for PhoneGap(Cordova) framework to develop these apps. Using this framework you'll have to use HTML/HTML5, JavaScript, CSS, PHP and get the iOS App running on your device. Here to StartWith and then check out APIDocs. You will always get a lot of tutorials on google itself.
You can also refer This Question for gathering some knowledge about other frameworks available in market.
Hope it helps.
I would suggest Phonegap, but you can't use PHP with Phonegap apps directly... There are a few hacks around this though.
Although Phonegap is supposed to be "one codebase, distribute everywhere", if you want a really great looking app you'll have to spend a liitle time adjusting the UX for every platform or device. The thing I really like about Phonegap is that you can open up a HTML page locally on your browser and move thing around in firebug, making the process faster.

Resources