百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

react-native-custom-tabs

> 前端框架
开源

适用于 React Native 的 Chrome 自定义选项卡。

190 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

适用于 React Native 的 Chrome 自定义选项卡。

React Native Custom Tabs

Chrome Custom Tabs for React Native.
Custom Tabs is supported only for Android, so the behavior on each platform is bellow.

  • Android
    If Chrome is installed, open the URL in Chrome that you have customized some of the look & feel. If it is not installed, open in other browser.

  • iOS
    If Chrome is installed, open the URL in it. If it is not installed, open in Safari.

Customization and detailed behavior refer to the Usage.

Installation

bash
npm install react-native-custom-tabs --save

To link the native module automatically, it is recommended that you use the rnpm.

rnpm link

Android

In Android, Add it in your root build.gradle(e.g. example) at the end of repositories:

groovy
allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}

And, provide CustomTabsPackage in your Application class.

java
import com.github.droibit.android.reactnative.customtabs.CustomTabsPackage;

@Override
protected List getPackages() {
    return Arrays.asList(
            ...,
            new CustomTabsPackage()
    );
}

If you use version 0.1.5 or higher, change the app build.gradle.

groovy
android {
    ...
    compileSdkVersion 25
    buildToolsVersion "25.0.1"
}

dependencies {
    ...
    compile "com.android.support:appcompat-v7:25.0.1"
}

Usage

Open the URL as Linking of React Native.

javascript
CustomTabs.openURL('https://www.google.com').then((launched: {boolean}) => {
  console.log(`Launched custom tabs: ${launched}`);
}).catch(err => {
  console.error(err)
});

Customize for Android

You can customize the look & feel in Android. The following option is ignored in iOS.

…

The option to support:

property type default description
toolbarColor string undefined the Toolbar color. Supported formats are: #RRGGBB, #AARRGGBB, etc.
enableUrlBarHiding boolean undefined Enables the url bar to hide as the user scrolls down on the page.
showPageTitle boolean undefined Sets whether the title should be shown in the custom tab.
enableDefaultShare boolean undefined Whether to add a default shared items of the menu.
animations Object undefined Sets the exit and start animations. ANIMATIONS_FADE, ANIMATIONS_SLIDE or custom object with string properties startEnter, startExit, endEnter and endExit each defining an Android animation resource ID to use for the animations, such as slide_in_right.
headers Object undefined Sets any custom headers that should be used.
forceCloseOnRedirection boolean undefined Workaround that Custom Tabs doesn't close on redirecting back to app scheme.(#11)

undefined property is default behavior of the Custom Tabs.

Customize and default look & feel.

License

Copyright (C) 2015 The Android Open Source Project
Copyright (C) 2016 Shinya Kumagai

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Javaandroidchrome-custom-tabschrome-customtabsios

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类前端框架
定价开源

> 相关工具

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架