Tag: react native

在popup / webview中打开第三方url的最佳方法是使用反应js来跟踪相同的url

伙计们,需要围绕Reactjs提出一些想法和想法。 议程是在popup窗口或iframe中启动URL,并在popup窗口中向前移动时跟踪URL。 我已经实现了React Poput,但无法跟踪窗口URL。 popup中的url应该是第三方应用程序。 码: <Popout url='/hiddenFormSubmit' ref={popoutRef => this.popoutRef = popoutRef} containerId='hiddenContainer' options={{height:'650px'}} title='Window title' onClosing={this.popoutClosed}> </Popout> function: constructor(props){ super(props); this.state = { isPoppedOut: false }; popout() { console.log(" Popout URL::"); this.setState({isPoppedOut: true }); } popoutClosed() { this.setState({isPoppedOut: false}); } 我的隐藏表单组件在popup窗口中打开 import React, { Component } from 'react'; import classnames from 'classnames'; export […]

捆绑失败:运行React-Native项目时出现错误和404错误

我有一个React-Native应用程序,我正在使用npm start — –reset-cache 。 然后运行react-native run-android 。 但是,我在npm服务器的控制台中遇到这个问题: Bundling `index.js` [development, non-minified] 0.0% (0/1), failed. error: bundling failed: Error at DependencyGraph._getAbsolutePath (/myProjectPath/node_modules/metro-bundler/src/node-haste/DependencyGraph.js:305:11) at DependencyGraph.getDependencies (/myProjectPath/node_modules/metro-bundler/src/node-haste/DependencyGraph.js:283:4236) at Resolver.getDependencies (/myProjectPath/node_modules/metro-bundler/src/Resolver/index.js:129:5) at /myProjectPath/node_modules/metro-bundler/src/Bundler/index.js:642:39 at Generator.next (<anonymous>) at step (/myProjectPath/node_modules/metro-bundler/src/Bundler/index.js:13:1336) at /myProjectPath/node_modules/metro-bundler/src/Bundler/index.js:13:1496 at <anonymous> at process._tickCallback (internal/process/next_tick.js:188:7) 然后,在Android模拟器中,我得到: The development server returned response error code: 404 URL: http//10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false […]

安装“create-react-native-app”npm时出错

我在安装create-react-native-app应用程序时遇到此问题 npm install -g create-react-native-app npm ERR! code ENOTFOUND npm ERR! errno ENOTFOUND npm ERR! network request to https://registry.npmjs.org/create-react-native-app failed, reason: getaddrinfo ENOTFOUND genproxy genproxy:8080 npm ERR! network This is a problem related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settings. npm ERR! network […]

我无法在“npm install -g react-native-cli”macbook上安装react-native

当我尝试执行“npm install -g react-native-cli”时,我得到这个错误信息; Gire-Mac-MacBook-Pro:/ Gire-mac$ npm install -g react-native-cli module.js:538 throw err; ^ Error: Cannot find module '/usr/local/Cellar/node/8.9.1/libexec/lib/node_modules/npm/bin/node_modules/npm/bin/npm-cli.js' at Function.Module._resolveFilename (module.js:536:15) at Function.Module._load (module.js:466:25) at Function.Module.runMain (module.js:676:10) at startup (bootstrap_node.js:187:16) at bootstrap_node.js:608:3 另外当我尝试学习npm版本时,我得到了同样的信息。 我的节点版本是8.9.1。 我用Homebrew 1.3.8进行安装。 我在这个反应本地项目是新的,我不能仍然开始一个项目。

NPM不识别以'* -rc'结尾的semvers(即释放候选); 导致依赖关系无法解决。 通常的解决方法是什么?

这是一个非常简单的例子来说明这个问题。 我正在尝试使用react-native@0.8-rc和react-native-linear-gradient 。 react-native-linear-gradient将react-native@>=0.4.4定义为对等关系。 很公平。 我运行npm install 。 我得到一个错误说 react-native@0.8-rc不满足react-native@>=0.4.4 。 这个问题使得npm无用,因为它妨碍了开发人员和软件包维护者。 看这里的例子 。 任何使用节点的人如何对候选版本做有用的工作?!? 什么是解决方法? 作为参考,来自NPM 3.1.2(编写本文时的最新版本)的错误如下所示: MyProject@0.0.1 /path/to/MyProject ├─┬ react-native@0.8.0-rc │ └── stacktrace-parser@0.1.1 (git://github.com/frantic/stacktrace-parser.git#493c5e5638a79b4d5886171867a06275cc703b00) └─┬ react-native-linear-gradient@0.3.2 └── UNMET PEER DEPENDENCY react-native@>= 0.4.4 npm WARN EPEERINVALID react-native-linear-gradient@0.3.2 requires a peer of react-native@>= 0.4.4 but none was installed.

react native上的gRPC

我已经在iOS上工作了一段时间了,我正在使用React Native进行实验。 我遇到的一个障碍是如何将我的gRPC端点合并到React Native中,或者从根本上是否可行。 我试图简单地添加从gRPC生成的node.js代码无济于事。 我得到的最后一个答案是去年在这里 。

使用AsyncStorage实例化持久性应用程序状态

我试图创build一个对象,将作为我的应用程序的持久状态。 这意味着应用程序启动后第一次引用状态,它需要从AsyncStorage加载状态对象。 这是迄今为止我所得到的: var instance = null; var State = { user: "bob", update(newState) { Object.assign(instance, newState); AsyncStorage.setItem('appState', JSON.stringify(instance)).then(() => { AsyncStorage.getItem('appState', (err, result) => { console.log(result) }) }) } } module.exports = (() => { if (!instance) { return AsyncStorage.getItem('appState').then((value) => { if (value) { instance = value console.log("assigning saved state") } else { […]

反应原生使用绝对path? 而不是从'../../something/X'进行导入X?

我想知道为我的项目使用完整path的最佳方式。 例如,如果我导入一个组件,我不想import Component from '../components/Component' import Component from 'app/components/Component'; ,而只是import Component from 'app/components/Component'; 有人可以帮我吗?

如何在React Native中要求节点事件模块

我如何要求我的React Native项目中的events节点模块? 我遇到了一些模块依赖问题与util和http我通过使用Browserify打包解决。 我尝试采取与events相同的方法: npm install events var EventEmitter = require('events').EventEmitter; 在使用Browserify打包之后,我仍然从React Native得到同样的错误:“需要未知模块的事件”。

哪些基于WebSocket的库与React Native协同工作?

基于我的研究和这个问题 ,似乎一些基于WebSocket的Nodejs库不能与React Native(例如Paho的用于MQTT的JS库)一起工作,但是其他工作(例如SocketIO和Firebase )也是如此。 有没有什么方法可以知道哪些可能会起作用? 概要: 听起来像大多数基于WebSocket的库应该工作,并且与React Native实现XMLHttpRequest的方式不一致是不成问题的。