How does react-native-device-info Package work? - javascript

I have implemented react-native-device-info package in my React Native App & My University professor is now asking me to describe how does this package work in order to get the required info. what callbacks, etc are used or how does it communicate with the system to bring that info to us.
I have searched through the internet but can't seem to find the answer.
So, I want to know & learn how react-native packages work & more specifically the package react-native-device-info works?

I went on to look at the source code for the package, and you will see that there are ios and android files in the root, and if you take a closer look you will see platform native code that is passing messages via the RN Bridge module. I am no expert on the field, but this should be the general explanation.

Related

The 'correct' way to share code across TypeScript, nodejs and JavaScript

I want to have a mono repo that contains the following:
shared: a bunch of TypeScript classes that can be used ANYWHERE
WebClient: a react web app in JavaScript (that needs to use code in shared)
WebServer: a TypeScript server app for the react app (that also needs to use shared code)
The key issue is: how to I define, configure and access the shared code?
I'm totally lost, I've tried a hundred different approaches and nothing works. Any help would be appreciated.
NOTE: appreciate any comments, but please explain like I'm 5! A mini GitHub repo with 3 HelloWorld projects would be great!
Install Lerna and use it to manage the shared classes as packages. Read the documentation and don't be afraid to experiment with it.
If you want to see a Github repo that makes use of Lerna, there are quite a few, one of which is Facebook's Jest.
https://github.com/facebook/jest

Is there a way to use NPM packages in Android project with Kotlin

I was wondering if there is a way to use NPM packages in Android project with Kotlin. I know there is a Gradle plugin kotlin.js and it seems to work with a standalone project like a demo provided by JetBrains, but when I try to use it with Android I get this error:
Cannot add extension with name 'kotlin', as there is an extension already registered with that name.
There is even a little tutorial on how to setup kotlin/js, also provided by JetBrains, but there is nothing new.
I'm asking because I want to start a little multiplatform project, but the core part of it is a library, which I had written some time ago, but it is in Java, and it is heavily dependant on BouncyCastle and some other libraries that handles XML serialization, so there is no luck with that. But I found a similar library in JavaScript. And since I can not use any Java dependency with kotlin/multiplatform there are two options for me, either find a way to make Kotlin/JS work with Android project or move on to React-Native, which I like, but I would prefer Kotlin.

How do I begin to use rcy:nouislider in my Meteor Application?

Sorry if this is a dumb question, I've tried to google for the answer and can't find anything definitive.
I added the following package https://atmospherejs.com/rcy/nouislider
by entering the command meteor add rcy:nouislider
I am unsure if there any more steps from here. Do I need to import the package at the top of my JS file or can I go ahead and just start using it without any other steps?
Atmosphere packages should not need to be imported. The older packaging system did that for you, and the global variable 'noUiSlider' should be available to your code for you to use like in the documentation.
If you are interested, you can download the package code and see how it's put together. Just like a Meteor project there is client and server code. See here for more details: https://guide.meteor.com/writing-atmosphere-packages.html

Integrate a React Native app in to an existing iOS Obj-C/Swift App

https://facebook.github.io/react-native/docs/embedded-app-ios.html#content
This facebook guide and other resources online seem to have the same current implementation guidelines. Something that seems pretty insane, and not something I'm looking to do for my react-native app.
Basically, my goal is to create a simple react-native app in a separate repo and dev space, build/bundle the JS in to the main.jsbundle file and have my current iOS application pull that script and use it on deployments.
In this case, all that is required in my old codebase is a simple wrapper function that launches the react-native app when requested, otherwise functionality acts as it has always done.
It seems pretty weird to me that people would want to write both types of code inside a single codebase, and that is not my goal.
Has anyone got any insight in to how I would accomplish this task?
My project dirs should look something like this:
iOS/
Project.xcodeproj
Project/
AppDelegate.m
main.jsbundle
React-Native/
iOS/
AppDelegate.m
index.ios.js
The main.jsbundle in iOS/ is simply the generated bundle from the react-native project.
There's an "integration with existing app" in the official doc. Looks like the way to go : https://facebook.github.io/react-native/docs/integration-with-existing-apps.html
You should be able to build the bundle outside of your iOS main project and import it later in the process. Everything should be quite easily automated.
https://apphub.io could be also a great solution. They're a a commercial service but also have an opensource self-hostable server.
edit :
MS Codepush (part of appcenter) is a great tool as well.

How to create a custom framework package for WinJS (WinRT)

The project templates for Visual Studio 2012 contain a reference package with javascript, localization files and styles.
What I am wondering is how to build a custom reference package with my code, locales and styles. There is absolutely no information about this on the web, I tried referring to MSDN, but it did not give me any clue as to how I can do this. Please share any useful information that you may have about this.
It turns out Microsoft do have documentation on Extension SDKs.
Update:
I actually managed to get the reference/framework package. It all works really well except when opening Expression Blend with my package referenced. Notice the reference is there and I can actually see all components and their description but I'm still getting an error in the design surface. Here is what the error looks like (I know, it's very descriptive):
Update:
When trying to deploy an app referencing the framework package I have created I being given an error saying that it cannot find my framework but instead finds some framework with trailing symbols that I did not put there while packaging it. It appends the processor architecture as well as the package family name trailing symbols. Here's a screenshot:
The item you are looking at is a "Framework Package". While it is possible for you to generate a package that looks like a framework package (look at the appxmanifest.xml for the WinJS package in \Program Files\WindowsApps), you cannot get that package ingested into the store.
This is something that is not supported in Win8 -- you'll need to include the files you need in each package you build.

Categories