All Projects → lazaronixon → React Native Turbolinks

lazaronixon / React Native Turbolinks

Licence: mit
React Native adapter for building hybrid apps with Turbolinks 5

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to React Native Turbolinks

os-fileup
Helper app to understand how to upload files and do basic image/video processing in hybrid android apps.
Stars: ✭ 207 (+16.95%)
Mutual labels:  pwa, webview
Aachartcore
📈📊☕️☕️☕️An elegant modern declarative data visualization chart framework for Android. Extremely powerful, supports line, spline, area, areaspline, column, bar, pie, scatter, angular gauges, arearange, areasplinerange, columnrange, bubble, box plot, error bars, funnel, waterfall and polar chart types.极其精美而又强大的 Android 数据可视化图表框架,支持柱状图、条形图、折线图、曲线图、折线填充图、曲线填充图、气泡图、扇形图、环形图、散点图、雷达图、混合图等各种类型的多达几十种的信息图图表,完全满足工作所需.
Stars: ✭ 424 (+139.55%)
Mutual labels:  hybrid, webview
Nuxt7
📱 Full Featured iOS & Android PWA Apps with Nuxt.js and Framework7
Stars: ✭ 282 (+59.32%)
Mutual labels:  hybrid, pwa
React Native Webview Invoke
Invoke functions between React Native and WebView
Stars: ✭ 211 (+19.21%)
Mutual labels:  hybrid, webview
Pwa
Progressive Web Apps for Rails
Stars: ✭ 133 (-24.86%)
Mutual labels:  rails, pwa
RobustWebView
Android WebView H5 秒开方案总结
Stars: ✭ 38 (-78.53%)
Mutual labels:  webview, hybrid
Android Smartwebview
A webview integrated w/ native features to help create most advanced hybrid applications.
Stars: ✭ 357 (+101.69%)
Mutual labels:  webview, pwa
Hybrid-Web-Platform
Full-fledged WebView as Xamarin.Forms plugin with cross-platform C# to JavaScript and JavaScript to C# calls support. Eventually invented for painless hybrid apps creation.
Stars: ✭ 19 (-89.27%)
Mutual labels:  webview, hybrid
Agentweb
AgentWeb is a powerful library based on Android WebView.
Stars: ✭ 8,375 (+4631.64%)
Mutual labels:  hybrid, webview
Andorid Litehybrid Webview
A android hybrid framework, works for H5 and native interactions via webview.
Stars: ✭ 39 (-77.97%)
Mutual labels:  hybrid, webview
Os Fileup
Helper app to understand how to upload files and do basic image/video processing in hybrid android apps.
Stars: ✭ 190 (+7.34%)
Mutual labels:  webview, pwa
Easybridge
A design of easy js-bridge which provide the ability to communicate between java and javascript.It is based on the android webview's feature [addJavaScriptInterface]
Stars: ✭ 158 (-10.73%)
Mutual labels:  hybrid, webview
Aachartcore Kotlin
📈📊⛰⛰⛰An elegant modern declarative data visualization chart framework for Android . Extremely powerful, supports line, spline, area, areaspline, column, bar, pie, scatter, angular gauges, arearange, areasplinerange, columnrange, bubble, box plot, error bars, funnel, waterfall and polar chart types.极其精美而又强大的 Android 数据可视化图表框架,支持柱状图、条形图、折线图、曲线图、折线填充图、曲线填充图、气泡图、扇形图、环形图、散点图、雷达图、混合图等各种类型的多达几十种的信息图图表,完全满足工作所需.
Stars: ✭ 332 (+87.57%)
Mutual labels:  hybrid, webview
Aachartkit
📈📊🚀🚀🚀An elegant modern declarative data visualization chart framework for iOS, iPadOS and macOS. Extremely powerful, supports line, spline, area, areaspline, column, bar, pie, scatter, angular gauges, arearange, areasplinerange, columnrange, bubble, box plot, error bars, funnel, waterfall and polar chart types. 极其精美而又强大的跨平台数据可视化图表框架,支持柱状图、条形图、折…
Stars: ✭ 4,358 (+2362.15%)
Mutual labels:  hybrid, webview
Vassonic
VasSonic is a lightweight and high-performance Hybrid framework developed by tencent VAS team, which is intended to speed up the first screen of websites working on Android and iOS platform.
Stars: ✭ 11,466 (+6377.97%)
Mutual labels:  hybrid, webview
Hybridfoundation
混合应用基础架构 跨平台热更新方案 Js双向通信 基础WebView
Stars: ✭ 164 (-7.34%)
Mutual labels:  hybrid, webview
Foreman
an application that automates the lifecycle of servers
Stars: ✭ 2,102 (+1087.57%)
Mutual labels:  rails
Web Push Php Example
An example for sending Web Push notifications, using web-push-php
Stars: ✭ 173 (-2.26%)
Mutual labels:  pwa
Turbolinks render
Support for `render` with Turbolinks in Rails controllers
Stars: ✭ 168 (-5.08%)
Mutual labels:  rails
Pwatter
Angular Progressive Web App using Workbox
Stars: ✭ 167 (-5.65%)
Mutual labels:  pwa

React Native Turbolinks

A implementation of Turbolinks for iOS and Turbolinks Android for React Native.

React Native Turbolinks

Getting started

yarn add react-native-webview react-native-turbolinks
cd ios && pod install && cd .. # CocoaPods on iOS needs this extra step

Warning

  • This component only applies to projects made with react-native init or to those made with expo-cli which have since ejected. For more information about ejecting, please see the guide on Expo docs.

  • On android you should use Volume UP to show Developer Menu instead ⌘ M.

  • React Native Turbolinks doesn't support Fast Refresh, please disable it on React Native developer menu ⌘ D.

  • Start rails with rails s -b 0.0.0.0.

Basic Usage

import React, { Component } from 'react'
import Turbolinks from 'react-native-turbolinks'

export default class App extends Component {

  componentDidMount() {
    Turbolinks.addEventListener('turbolinksVisit', this.handleVisit)
    Turbolinks.addEventListener('turbolinksError', this.handleError)
    Turbolinks.startSingleScreenApp({url: 'http://MYIP:9292'})
  }

  handleVisit = (data) => {
    Turbolinks.visit({url: data.url, action: data.action})
  }

  handleError = (data) => {
    alert(data.description)
  }

  render() { return null }
}

Running the Demo

This repository includes a demo application to show off features of the framework. The demo bundles a simple HTTP server that serves a Turbolinks 5 web app on localhost at port 9292.

To run the demo, clone this repository to your computer and change into its directory. Then, Open file Example/app.json and change baseUrl with your IP and start the demo server by running Example/demo-server from the command line.

Once you’ve started the demo server, explore the demo application in the Simulator by running react-native run-ios or react-native run-android on Example folder.

React Native Turbolinks Demo Application

Methods

startSingleScreenApp(route, appOption = {})

Start a Single Screen App. Use it instead visit for first visit.

startSplitScreenApp(primaryComponent, secondaryRoute, appOption = {})

Start a Splitted Screen App. Use it instead visit for first visit. It is a good choice for iPad. (iOS Only)

visit(route)

Visit a URL or Component.

replaceWith(route)

Replace current visitable with a component. With the same route param like to visit a component.

reloadVisitable()

Reload current visitable. For example when a connection error view is launched and you want to retry.

reloadSession()

Reload current session.

removeAllCookies()

Remove all cookies. Return a promise.

dismiss(animated = true)

Dismiss a overlaped view presented by visiting a component with modal option. Return a promise.

popToRoot(animated = true)

Back until to root view. Return a promise.

back(animated = true)

Trigger a native back event. For example if you using a custom navbar and need to provide a back button. Return a promise.

renderTitle(title, subtitle = null)

Change title of current view. For example if you want to get title from page source.

renderActions(actions)

Change actions of current view. For example if you want to mount a menu looking for data-attributes on page source.

renderNavBarStyle(navBarStyle)

Change navbarStyle on run time. For example if you want to provide a way for the user to choose a theme.

injectJavaScript(script)

Function that accepts a string that will be passed to the WebView and executed immediately as JavaScript. Return a promise.

addEventListener(eventName, handler)

Adds an event handler. Supported events:

  • turbolinksVisit: Fires when you tap a Turbolinks-enabled link. The argument to the event handler is an object with keys: url, path, action.
  • turbolinksError: Fires when your visit’s network request fails.The argument to the event handler is an object with keys: code, statusCode, description.
  • turbolinksMessage: Fires when you send messages from JavaScript to your native application. The argument to the event handler is a string with the message.
  • turbolinksTitlePress: Fire when title is tapped. The arguments to the event handler is an object with keys: url, path, component.
  • turbolinksActionPress: Fire when a action is tapped. The arguments to the event handler is an object with keys: url, path, component, actionId.
  • turbolinksLeftButtonPress: Fire when left button item is tapped. The arguments to the event handler is an object with keys: url, path, component. (iOS Only)
  • turbolinksRightButtonPress: Fire when right button item is tapped. The arguments to the event handler is an object with keys: url, path, component. (iOS Only)
  • turbolinksVisitCompleted: Fire when the request has been fulfilled successfully and the page fully rendered, Here you can parse html and create a dynamic menu for example. The arguments to the event handler is url, path.

removeEventListener(eventName, handler)

Removes the listener for given event.

Objects

Route

  • Url properties
    • url: Url to visit. (Required)
  • Component properties
    • component: Component to visit. (Required)
    • modal: A boolean to show a view without navbar and backbutton. (Default false)
    • dismissable: When true is possible dismiss modal. (Default false)
    • passProps: Passes this in as props to the rendered component.
  • Common properties
    • title: The default value is the title of the Web page.
    • subtitle: A subtitle for visitable view.
    • visibleDropDown: Show a small arrow next to title.
    • hidesNavBar: Hide navigation bar. (Default false)
    • hidesShadow: Indicates whether to hide the navigation 1px hairline shadow. (Default false) (iOS Only)
    • leftButtonText/leftButtonIcon: A left button text/icon. (iOS Only)
    • rightButtonText/rightButtonIcon: A right button text/icon. (iOS Only)
    • actions: A Array of action objects to mount a menu.
    • action: If action is 'advance', so it will perform a animated push, if "replace" will perform a pop without animation. (Default 'advance')

AppOption

  • userAgent: You can check for this string on the server and use it to send specialized markup or assets to your application.
  • messageHandler: You can register a Message Handler to send messages from JavaScript to your application.
  • loadingView: Set a custom loadingView using a react component.
  • navBarStyle: {titleTextColor, subtitleTextColor, barTintColor, tintColor, menuIcon}.
  • injectedJavaScript: Set this to provide JavaScript that will be injected into the web page when the view loads.

Action

  • id: A integer identifier for the action. (Required)
  • title: A title for the action.
  • icon: A icon for the action.
  • button: A boolean to show action inside menu or in toolbar. (Default false) (Android Only)

Constants

Turbolinks.Constants.ErrorCode.httpFailure: 0

Turbolinks.Constants.ErrorCode.networkFailure: 1

Turbolinks.Constants.Action.advance: 'advance'

Turbolinks.Constants.Action.replace: 'replace'

Turbolinks.Constants.Action.restore: 'restore'

Android Style

For android set your style on android/app/src/main/res/values/styles.xml.

TODO

Resources

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].