{"id":4647,"url":"https://github.com/beefe/react-native-webview","last_synced_at":"2025-08-09T01:54:20.725Z","repository":{"id":145347713,"uuid":"47605877","full_name":"beefe/react-native-webview","owner":"beefe","description":"Deprecated","archived":false,"fork":false,"pushed_at":"2015-12-22T06:34:47.000Z","size":415,"stargazers_count":4,"open_issues_count":2,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-06-09T15:12:35.121Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beefe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-08T07:25:41.000Z","updated_at":"2021-03-04T16:35:10.000Z","dependencies_parsed_at":"2023-04-16T14:18:17.482Z","dependency_job_id":null,"html_url":"https://github.com/beefe/react-native-webview","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/beefe/react-native-webview","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beefe%2Freact-native-webview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beefe%2Freact-native-webview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beefe%2Freact-native-webview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beefe%2Freact-native-webview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beefe","download_url":"https://codeload.github.com/beefe/react-native-webview/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beefe%2Freact-native-webview/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268636503,"owners_count":24282102,"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":[],"created_at":"2024-01-05T20:17:18.953Z","updated_at":"2025-08-09T01:54:20.647Z","avatar_url":"https://github.com/beefe.png","language":"Java","readme":"# The [react-native version 0.17.1](https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/views/webview/ReactWebViewManager.java) has been achieved This component , this project is no longer being maintained.\n\n# react-native-webview\nandroid webview for react-native\n\n## 已经实现的属性和方法\n### Props\n* automaticallyAdjustContentInsets\n```javascript\nbool\n```\n* html\n```javascript\nstring\n```\n* injectedJavaScript\n```javascript\nstring\n```\n* onNavigationStateChange\n```javascript\nfunction\n```\n* url\n```javascript\nstring\n```\n* javaScriptEnabledAndroid\n```javascript\nbool\n```\n### method\n* goBack\n* goForward\n* reload\n\n## Installation and How to use\n\n#### Step 1 - NPM Install\n\n```shell\nnpm install --save react-native-webview\n```\n#### Step 2 - Update Gradle Settings\n\n```gradle\n// file: android/settings.gradle\n...\n\ninclude ':reactwebview', ':app' \nproject(':reactwebview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview')\n // if there are more library\n // include ':app' , ':libraryone' , ':librarytwo' , 'more...'\n // project(':libraryonename').projectDir = new File(rootProject.projectDir, '../node_modules/libraryonemodule')\n // project(':librarytwoname').projectDir = new File(rootProject.projectDir, '../node_modules/librarytwomodule')\n // more..\n```\n\n#### Step 3 - Update app Gradle Build\n\n```gradle\n// file: android/app/build.gradle\n...\n\ndependencies {\n    ...\n    compile project(':reactwebview')\n}\n```\n\n#### Step 4 - Register React Package\n\n```java\n...\nimport com.heng.wheel.WheelPackage;\n\npublic class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {\n\n    private ReactInstanceManager mReactInstanceManager;\n    private ReactRootView mReactRootView;\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        mReactRootView = new ReactRootView(this);\n        mReactInstanceManager = ReactInstanceManager.builder()\n                .setApplication(getApplication())\n                .setBundleAssetName(\"index.android.bundle\")\n                .setJSMainModuleName(\"index.android\")\n                .addPackage(new MainReactPackage())\n                .addPackage(new WebViewPackage()) // register webview package\n                .setUseDeveloperSupport(BuildConfig.DEBUG)\n                .setInitialLifecycleState(LifecycleState.RESUMED)\n                .build();\n        ...\n    }\n...\n\n```\n\n#### Step 5 - Require and use in Javascript\n\n```js\n// file: index.android.js\n\nvar React = require('react-native');\nvar {\n  AppRegistry,\n  StyleSheet,\n} = React;\n\nvar WebView = require('react-native-webview');\n\nvar WebViewTest = React.createClass({\n    goBack: function() {\n      this.refs.webview.goBack();\n    },\n    goForward: function() {\n      this.refs.webview.goForward();\n    },\n    reload: function() {\n      this.refs.webview.reload();\n    },\n    _onNavigationStateChange: function(event) {\n      //event.canGoBack\n      //event.canGoForward\n      //event.url\n      //event.title\n      //event.loading\n    },\n    render: function() {\n    var reqUrl = \"https://github.com/\";\n    return (\n        \u003cWebView\n          ref='webview'\n          automaticallyAdjustContentInsets={true}\n          url={reqUrl}\n          javaScriptEnabledAndroid={true}\n          onNavigationStateChange={this._onNavigationStateChange}\n          style={styles.webview}/\u003e\n    );\n  }\n});\n\nvar styles = StyleSheet.create({\n  webview: {\n    flex: 1,\n  },\n});\n\n...\n```\n\n## Notes\n\n- Only in the following versions tested , other versions do not guarantee success\n```gradle\n// file: react-native-wheel/build.gradle\n\nandroid {\n    compileSdkVersion 23  //@\n    buildToolsVersion \"23.0.1\"  //@\n\n    defaultConfig {\n        minSdkVersion 16 \n        targetSdkVersion 22  //@\n    }\n}\n\ndependencies {\n    compile 'com.facebook.react:react-native:0.16.1'  //@\n}\n```\n\n## Remark\n在模拟器运行会提示以下错误:\nWebpage not available\n\nThe webpage at \"xxx\" could not be loaded because:\n\nnet::ERR_NAME_NOT_RESOLVED\n\n暂未寻找解决方案,目前建议[打包导出](http://facebook.github.io/react-native/docs/signed-apk-android.html#content)后在真机运行\n\n## Run Renderings\n\u003ccenter\u003e\n    \u003cimg src=\"https://github.com/beefe/react-native-webview/blob/master/Screenshot/result_one.jpeg\"\n    width=\"300\" height=\"450\"/\u003e\n\u003c/center\u003e\n\n","funding_links":[],"categories":["Components"],"sub_categories":["Web"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeefe%2Freact-native-webview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeefe%2Freact-native-webview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeefe%2Freact-native-webview/lists"}