Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add React Native Support #45

Open
Open
Labels
@jho406

Description

@jho406

Today, Rails hasStrada, acordova-ish solution that brings the web to mobile by using web views and a JS bridge to native functionality. Superglue can offer a better alternative. Imagine being able to use standard Rails helpers (the flash, form helpers) and your boring Rails workflow to build React Native applications, all while having 100% Native UI controls and access to react-native libraries.

In other words, while Strada tries to bring the Web to native, Superglue tries to bring just Rails to native.

Thoughts

The movement towards "pages"

expo and other JS frameworks are making their way towards page based development. Since Superglue is about page state over the wire. Is there some compatibility here that is worth investigating?

Known quirks of React Native

ReactNative is not the web. Specifically

  1. ReactNative fetch is NOT the web fetch, and there are known issues withredirects losing cookies
  2. Cookies havemore known issues. There is areact-native-cookies package that might help this issue.

Possible solutions:

  1. Polyfill to the webview’s fetch. Its possible to create an instance of the Webview, and usinginjected javascript, create a polyfill fetch (fork something likehttps://github.com/developit/unfetch ) that proxys to the Webview.
  2. Embrace the known Quirks. React native isn’t quite the web, so create helpers insuperglue_rails that give Rails more superpowers. For example, we can embrace that React has an issue with redirect by never redirecting, instead we can render a payload for the app to navigate to somewhere else.
class PostsController < ApplicationController  def create    ... do stuff    navigate_to_screen :home_screen  endend

There might be new helpers to think about, for example:navigate_back. linkhelpersURL helpers.

Embracing React Native also means that some features of superglue would need to be disabled while on native. For example, UJShelpers. We may also need to reshape theredux state shape to accommodate the new navigation helpers.

Next Steps

Of the solutions, I am leaning towards embracing React Native’s quirks. While I don’t have a thought out comparison, I think that because React Native isn’t quite web, its simpler to embrace to quirkiness then to add a layered solution. I believe that Rails itself can be a “Be productive anywhere” solution, even without the web.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Needs planning

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp