npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@liquidcore/react-native

v0.56.3

Published

React Native 0.56.0 plugin for caraml

Downloads

1

Readme

React Native Surface

A LiquidCore surface that exposes the React Native (v. 0.56) API. This is a work in progress.

Carthage compatible

Create a React Native project for use with LiquidCore

Refer to the React Native documentation for how to get started with React Native. This assumes you are already familiar with it.

Step 1: Create a React Native project

Important: you must use only version 0.56.0 of React Native. Create a new project from the command line:

$ react-native init --version=0.56.0 HelloWorld

Step 2: Add the LiquidCore shim

First, install the command-line utilties:

$ npm install -g liquidcore-cli

Then, initialize your project for use with LiquidCore:

$ liquidcore init --surface=.reactnative.ReactNative HelloWorld 
$ cd HelloWorld && npm install

Step 3: Complete

You should now have the basic React Native starter project that is available for use with LiquidCore. To run the development server, simply:

$ npm run server

Your project will remain entirely compatible with React Native. The LiquidCore dev server does not conflict with the Metro server. It uses port 8082 instead of 8081 by default. You can still debug and develop your React Native project according to the documentation without conflict. LiquidCore simply installs a little shim (namely, liquid.js) and enables a LiquidCore-specific server and bundler.

Using ReactNativeSurface in your app

Step 1: Create an app project

Create a new app in either Android Studio or XCode as normal. Or if you already have an existing app, you can use that. Refer to the documentation for your IDE on how to set up an app. For the sake of this section, we will assume you have an app named HelloWorld.

Step 2: Add the dependencies

Android

Go to your root-level build.grade file and add the jitpack dependency:

...

allprojects {
    repositories {
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}
...

Then, add the dependencies to your app's build.gradle:

dependencies {
    ...
    implementation 'com.github.LiquidPlayer:LiquidCore:0.5.1'
    implementation 'com.github.LiquidPlayer:ReactNativeSurface:0.56.0006'
    
    /*
     * Note: You must also include these React Native dependencies.  In future
     * releases, hopefully this won't be necessary.
     */
    implementation 'javax.inject:javax.inject:1'
    implementation 'com.facebook.fbui.textlayoutbuilder:textlayoutbuilder:1.0.0'
    implementation 'com.facebook.fresco:fresco:1.9.0'
    implementation 'com.facebook.fresco:imagepipeline-okhttp3:1.9.0'
    implementation 'com.facebook.soloader:soloader:0.3.0'
    implementation 'com.google.code.findbugs:jsr305:3.0.0'
    implementation 'com.squareup.okhttp3:okhttp:3.10.0'
    implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0'
    implementation 'com.squareup.okio:okio:1.14.0'
}

iOS

  1. Install Carthage as described here.

  2. Create a Cartfile that includes the following frameworks:

    git "[email protected]:LiquidPlayer/LiquidCore.git" ~> 0.5.1
    git "[email protected]:LiquidPlayer/ReactNativeSurface.git" ~> 0.56.0006
  3. Run carthage update --cache-builds. This will fetch dependencies into a Carthage/Checkouts folder, then build each one or download a pre-compiled framework. NOTE:: You may have to do this twice -- it seems to fail the first time and succeed the second.

  4. On your application targets’ General settings tab, in the “Linked Frameworks and Libraries” section, drag and drop LiquidCore.framework and ReactNativeSurface.framework from the Carthage/Build folder on disk.

  5. On your application targets’ Build Phases settings tab, click the + icon and choose New Run Script Phase. Create a Run Script in which you specify your shell (ex: /bin/sh), add the following contents to the script area below the shell:

    /usr/local/bin/carthage copy-frameworks

    Then, add the paths to the frameworks under “Input Files":

    $(SRCROOT)/Carthage/Build/iOS/LiquidCore.framework
    $(SRCROOT)/Carthage/Build/iOS/ReactNativeSurface.framework

    And finally, add the paths to the copied frameworks to the “Output Files”:

    $(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/LiquidCore.framework
    $(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/ReactNativeSurface.framework

Step 3: Add the Liquid View to your app

You can either add the view in the interface builder or programmatically. To add the view:

Android layout file

You can insert the view into any layout like so:

    <org.liquidplayer.service.LiquidView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/liquidview"
    />

iOS Interface Builder

Drag a UIView onto your storyboard in a ViewController. Go to the identity inspector on the right and set its custom class to LCLiquidView.

Android programmatic

import org.liquidplayer.service.LiquidView;
...
    LiquidView liquidView = new LiquidView(androidContext);

iOS (Swift)

import LiquidCore
...
    let liquidView = LCLiquidView(frame: CGRect.zero)

Step 4: Finish

This is all that is required to get up and running. LiquidView defaults to using the dev server at port 8082. See the documentation for LiquidView (Android) and LCLiquidView (iOS) in the LiquidCore project for options.

Random Musings

This is very hastily thrown together documentation as this project is under active development. So I am adding some disorganized thoughts here.

  • ReactNativeSurface is not yet suitable as a general-purpose surface. No (or very little) consideration has been made regarding security. Only use whitelisted domains or better yet, use local resource bundles until there has been more work in the area of security.
  • On Android, the back button doesn't always work like you want it to. This is a known issue.
  • Developer mode doesn't work on either Android or iOS. It doesn't work at all on Android and only somewhat works on iOS. For the moment, use old fashioned React Native to do your debugging until this is resolved.