{"id":4639,"url":"https://github.com/lazaronixon/react-native-turbolinks","last_synced_at":"2025-08-04T01:32:55.268Z","repository":{"id":28003154,"uuid":"115726051","full_name":"lazaronixon/react-native-turbolinks","owner":"lazaronixon","description":"React Native adapter for building hybrid apps with Turbolinks 5","archived":true,"fork":false,"pushed_at":"2022-06-02T00:49:09.000Z","size":26842,"stargazers_count":192,"open_issues_count":23,"forks_count":18,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-25T06:22:41.369Z","etag":null,"topics":["android","hybrid","ios","pwa","rails","react","react-native","turbolinks","webview"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lazaronixon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"custom":["https://www.paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=8F3EJLDJVVPDL\u0026currency_code=BRL\u0026source=url","twitter.com/lazaronixon"],"ko_fi":"lazaronixon"}},"created_at":"2017-12-29T13:50:33.000Z","updated_at":"2025-01-08T20:44:02.000Z","dependencies_parsed_at":"2022-09-08T01:50:32.709Z","dependency_job_id":null,"html_url":"https://github.com/lazaronixon/react-native-turbolinks","commit_stats":null,"previous_names":[],"tags_count":102,"template":false,"template_full_name":null,"purl":"pkg:github/lazaronixon/react-native-turbolinks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lazaronixon%2Freact-native-turbolinks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lazaronixon%2Freact-native-turbolinks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lazaronixon%2Freact-native-turbolinks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lazaronixon%2Freact-native-turbolinks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lazaronixon","download_url":"https://codeload.github.com/lazaronixon/react-native-turbolinks/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lazaronixon%2Freact-native-turbolinks/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268636523,"owners_count":24282108,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-03T02:00:12.545Z","response_time":2577,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","hybrid","ios","pwa","rails","react","react-native","turbolinks","webview"],"created_at":"2024-01-05T20:17:18.711Z","updated_at":"2025-08-04T01:32:54.733Z","avatar_url":"https://github.com/lazaronixon.png","language":"Java","funding_links":["https://www.paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=8F3EJLDJVVPDL\u0026currency_code=BRL\u0026source=url","twitter.com/lazaronixon","https://ko-fi.com/lazaronixon"],"categories":["Components","Java"],"sub_categories":["Web"],"readme":"# React Native Turbolinks\nA implementation of [Turbolinks for iOS](https://github.com/turbolinks/turbolinks-ios) and [Turbolinks Android](https://github.com/turbolinks/turbolinks-android) for React Native.\n\n[![React Native Turbolinks](https://nixo-etc.s3-sa-east-1.amazonaws.com/intro-turbolinks.gif)](https://youtu.be/2biqMoHn3jk \"Quick Start Video\")\n\n## [Getting started](https://youtu.be/2biqMoHn3jk \"Quick Start Video\")\n```sh\nyarn add react-native-webview react-native-turbolinks\ncd ios \u0026\u0026 pod install \u0026\u0026 cd .. # CocoaPods on iOS needs this extra step\n```\n\n### Warning\n- 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](https://docs.expo.io/versions/latest/expokit/eject/#instructions) on Expo docs.\n\n- On android you should use `Volume UP` to show Developer Menu instead `⌘ M`.\n\n- React Native Turbolinks doesn't support [Fast Refresh](https://facebook.github.io/react-native/docs/fast-refresh), please disable it on React Native developer menu `⌘ D`.\n\n- Start rails with `rails s -b 0.0.0.0`.\n\n## Basic Usage\n```javascript\nimport React, { Component } from 'react'\nimport Turbolinks from 'react-native-turbolinks'\n\nexport default class App extends Component {\n\n  componentDidMount() {\n    Turbolinks.addEventListener('turbolinksVisit', this.handleVisit)\n    Turbolinks.addEventListener('turbolinksError', this.handleError)\n    Turbolinks.startSingleScreenApp({url: 'http://MYIP:9292'})\n  }\n\n  handleVisit = (data) =\u003e {\n    Turbolinks.visit({url: data.url, action: data.action})\n  }\n\n  handleError = (data) =\u003e {\n    alert(data.description)\n  }\n\n  render() { return null }\n}\n```\n\n## Running the Demo\nThis 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.\n\nTo 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.\n\nOnce 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.\n\n![React Native Turbolinks Demo Application](https://nixo-etc.s3-sa-east-1.amazonaws.com/application-demo.png)\n\n## Methods\n\n#### `startSingleScreenApp(route, appOption = {})`\nStart a Single Screen App. Use it instead visit for first visit.\n\n#### `startSplitScreenApp(primaryComponent, secondaryRoute, appOption = {})`\nStart a Splitted Screen App. Use it instead visit for first visit. It is a good choice for iPad. (iOS Only)\n\n#### `visit(route)`\nVisit a URL or Component.\n\n#### `replaceWith(route)`\nReplace current visitable with a component. With the same route param like to visit a component.\n\n#### `reloadVisitable()`\nReload current visitable. For example when a connection error view is launched and you want to retry.\n\n#### `reloadSession()`\nReload current session.\n\n#### `removeAllCookies()`\nRemove all cookies. Return a promise.\n\n#### `dismiss(animated = true)`\nDismiss a overlaped view presented by visiting a component with modal option. Return a promise.\n\n#### `popToRoot(animated = true)`\nBack until to root view. Return a promise.\n\n#### `back(animated = true)`\nTrigger a native back event. For example if you using a custom navbar and need to provide a back button. Return a promise.\n\n#### `renderTitle(title, subtitle = null)`\nChange title of current view. For example if you want to get title from page source.\n\n#### `renderActions(actions)`\nChange actions of current view. For example if you want to mount a menu looking for data-attributes on page source.\n\n#### `renderNavBarStyle(navBarStyle)`\nChange navbarStyle on run time. For example if you want to provide a way for the user to choose a theme.\n\n#### `injectJavaScript(script)`\nFunction that accepts a string that will be passed to the WebView and executed immediately as JavaScript. Return a promise.\n\n#### `addEventListener(eventName, handler)`\nAdds an event handler. Supported events:\n- `turbolinksVisit`: Fires when you tap a Turbolinks-enabled link. The argument to the event handler is an object with keys: `url, path, action`.\n- `turbolinksError`: Fires when your visit’s network request fails.The argument to the event handler is an object with keys: `code, statusCode, description`.\n- `turbolinksMessage`: Fires when you send messages from JavaScript to your native application. The argument to the event handler is a string with the message.\n- `turbolinksTitlePress`: Fire when title is tapped. The arguments to the event handler is an object with keys: `url, path, component`.\n- `turbolinksActionPress`: Fire when a action is tapped. The arguments to the event handler is an object with keys: `url, path, component, actionId`.\n- `turbolinksLeftButtonPress`: Fire when left button item is tapped. The arguments to the event handler is an object with keys: `url, path, component`. (iOS Only)\n- `turbolinksRightButtonPress`: Fire when right button item is tapped. The arguments to the event handler is an object with keys: `url, path, component`. (iOS Only)\n- `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`.\n\n#### `removeEventListener(eventName, handler)`\nRemoves the listener for given event.\n\n## Objects\n#### `Route`\n- Url properties\n  - `url`: Url to visit. (Required)\n- Component properties\n  - `component`: Component to visit. (Required)\n  - `modal`: A boolean to show a view without navbar and backbutton. (Default false)\n  - `dismissable`: When true is possible dismiss modal. (Default false)  \n  - `passProps`: Passes this in as props to the rendered component.\n- Common properties\n  - `title`: The default value is the title of the Web page.\n  - `subtitle`: A subtitle for visitable view.\n  - `visibleDropDown`: Show a small arrow next to title.\n  - `hidesNavBar`: Hide navigation bar. (Default false)  \n  - `hidesShadow`: Indicates whether to hide the navigation 1px hairline shadow. (Default false) (iOS Only)  \n  - `leftButtonText/leftButtonIcon`: A left button text/icon. (iOS Only)\n  - `rightButtonText/rightButtonIcon`: A right button text/icon. (iOS Only)\n  - `actions`: A Array of `action` objects to mount a menu.\n  - `action`: If action is 'advance', so it will perform a animated push, if \"replace\" will perform a pop without animation. (Default 'advance')\n\n#### `AppOption`\n  - `userAgent`: You can check for this string on the server and use it to send specialized markup or assets to your application.\n  - `messageHandler`: You can register a Message Handler to send messages from JavaScript to your application.\n  - `loadingView`: Set a custom loadingView using a react component.\n  - `navBarStyle`: {titleTextColor, subtitleTextColor, barTintColor, tintColor, menuIcon}.\n  - `injectedJavaScript`: Set this to provide JavaScript that will be injected into the web page when the view loads.\n\n#### `Action`\n  - `id`: A integer identifier for the action. (Required)\n  - `title`: A title for the action.\n  - `icon`: A icon for the action.\n  - `button`: A boolean to show action inside menu or in toolbar. (Default false) (Android Only)\n\n## Constants\n\n`Turbolinks.Constants.ErrorCode.httpFailure`: 0\n\n`Turbolinks.Constants.ErrorCode.networkFailure`: 1\n\n`Turbolinks.Constants.Action.advance`: 'advance'\n\n`Turbolinks.Constants.Action.replace`: 'replace'\n\n`Turbolinks.Constants.Action.restore`: 'restore'\n\n## Android Style\nFor android set your style on [android/app/src/main/res/values/styles.xml](https://github.com/lazaronixon/react-native-turbolinks/blob/master/Example/android/app/src/main/res/values/styles.xml).\n\n## TODO\n\n- [x] [Third party library](https://github.com/lazaronixon/react-native-form-sheet) to provide native dialogs. Using [MZFormSheetPresentationController\n](https://github.com/m1entus/MZFormSheetPresentationController) and [Dialogs](https://developer.android.com/guide/topics/ui/dialogs.html).\n\n## Resources\n\n- [RailsConf 2016 - Turbolinks 5: I Can’t Believe It’s Not Native! by Sam Stephenson](https://www.youtube.com/watch?v=SWEts0rlezA)\n- [Basecamp 3 for iOS: Hybrid Architecture](https://m.signalvnoise.com/basecamp-3-for-ios-hybrid-architecture-afc071589c25)\n- [The Majestic Monolith](https://m.signalvnoise.com/the-majestic-monolith-29166d022228)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flazaronixon%2Freact-native-turbolinks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flazaronixon%2Freact-native-turbolinks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flazaronixon%2Freact-native-turbolinks/lists"}