小编ben*_*nel的帖子

在特定屏幕上使用react-navigation修改后退按钮

我正在使用react-navigation我的导航库,我想知道如何更改react-navigation特定屏幕的"后退"按钮(由自动添加)功能?

我的意思是不是在屏幕堆栈中走一步,而是希望它在堆栈中向后走2步.或者通过给它一个屏幕名称手动完成(再次只在一个组件上).

谢谢.

reactjs react-native react-navigation

6
推荐指数
5
解决办法
2万
查看次数

create-react-app eintegrity 错误窗口

当我开始在我的 Windows 10 pc 中创建 React 应用程序时,我遇到了这些错误。请帮我解决这个问题。

PS F:\> npm install -g create-react-app
C:\Users\Harshit Singh\AppData\Roaming\npm\create-react-app -> C:\Users\Harshit Singh\AppData\Roaming\npm\node_modules\create-react-app\ind
ex.js
+ create-react-app@1.4.0
updated 1 package in 24.169s
PS F:\> create-react-app my-app

Creating a new React app in F:\my-app.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
npm ERR! code EINTEGRITY
npm ERR! sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ= integrity checksum failed when using sha1: wanted sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ= but got sha1
-reRBygSiSrbV6gYVeXXD3kFgUvo=. (5518 bytes)

npm ERR! A complete log of this run …
Run Code Online (Sandbox Code Playgroud)

npm reactjs

5
推荐指数
1
解决办法
2575
查看次数

react-native -cli安装错误

我正在尝试react-native-cli使用以下命令进行安装:

C:\WINDOWS\System32>npm install -g react-native -cli
Run Code Online (Sandbox Code Playgroud)

我收到以下错误,有人可以帮忙解决这个问题吗?

npm WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
D:\Programming\React.js\ProgrammingReact.jsnode_modules\node_modules\react-native -> D:\Programming\React.js\ProgrammingReact.jsnode_modules\node_modules\node_modules\react-native\local-cli\wrong-react-native.js
npm WARN react-native@0.54.0 requires a peer of react@^16.3.0-alpha.1 but none is installed. You must install peer dependencies yourself.
npm WARN @babel/plugin-check-constants@7.0.0-beta.38 requires a peer of @babel/core@7.0.0-beta.38 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\react-native\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for …
Run Code Online (Sandbox Code Playgroud)

command-line-interface react-native react-native-cli

5
推荐指数
0
解决办法
1152
查看次数

React-native-video 在我的应用程序中显示空白屏幕,没有任何错误日志

我正在使用react-native-cli,在我的应用程序中,react-native-video 在我的页面中不起作用。它显示空白区域。我已经运行react-native link命令来链接库,并且在运行react-native run-android命令后但显示空白,没有任何错误。我正在使用react-native v 0.48.4 任何帮助表示赞赏!

import React, { Component } from 'react';
import { StyleSheet, Text, View, ScrollView,Image, Dimensions,Alert } from 'react-native';
import Video from 'react-native-video';


export default class HomeScreen extends Component {
  constructor(props) {
    super(props);

    this.loadStart = this.loadStart.bind(this);
    this.onLoad = this.onLoad.bind(this);
    this.onProgress = this.onProgress.bind(this);
    this.onEnd = this.onEnd.bind(this);
    this.onError = this.onError.bind(this);
    this.onBuffer = this.onBuffer.bind(this);
    this.onTimedMetadata = this.onTimedMetadata.bind(this);
  };

  loadStart(){
    console.log('loadStart');
  }
  onLoad(){
    console.log('onLoad');
  }

  onProgress(){
    console.log('onProgress');
  }

  onEnd(){
    console.log('onEnd');
  }

  onError(){
    console.log('onError'); …
Run Code Online (Sandbox Code Playgroud)

react-native react-native-cli

4
推荐指数
1
解决办法
8423
查看次数

如何转换SectionList的对象数组

我的 API 服务有以下数组结构

[
  {
    id: 1001,
    orderNo: 'abc',
    customer: 'John',
    date: 1524526218641
  },
  {
    id: 1002,
    orderNo: 'def',
    customer: 'Ringo',
    date: 1524555627191
  },
  {
    id: 1003,
    orderNo: 'ghi',
    customer: 'George',
    date: 1524555662611
  },
  {
    id: 1004,
    orderNo: 'jkl',
    customer: 'Paul',
    date: 1524717318641
  }
]
Run Code Online (Sandbox Code Playgroud)

根据react-native文档,我需要将原始数组结构从API服务转换为:

[
  {
    title: '23/4/2018',
    data: [
      {
        id: 1001,
        orderNo: 'abc',
        customer: 'John',
        date: 1524526218641
      }
    ]
  },
  {
    title: '24/4/2018',
    data: [
      {
        id: 1002,
        orderNo: 'def',
        customer: 'Ringo',
        date: 1524555627191 …
Run Code Online (Sandbox Code Playgroud)

javascript react-native

3
推荐指数
1
解决办法
1639
查看次数

在 React Native 中从另一个页面返回时会调用哪个生命周期方法?

我有一个页面 A,然后导航到页面 B,然后返回。我想知道在 A 上会调用哪个生命周期方法,或者会发出事件?

lifecycle react-native react-navigation

3
推荐指数
1
解决办法
1487
查看次数

服务器静态PDF-Vue CLI-Webpack-问题

多亏了VueCLI(+ Vuetify),我才有所建树。

我想渲染一个按钮,在其中onClick打开一个新标签,该标签位于项目的文件夹树中。

我有一个错误,几个小时后寻找原因,似乎是要修改的webpack conf。

我终于在S / O上阅读了这个答案;使用React Webpack文件加载器提供静态pdf

但是我说错了 include: paths -> paths is not defined

我不得不承认我不知道webpack如何在幕后工作,因此可以找到任何帮助。

pdf webpack vue.js

2
推荐指数
1
解决办法
1566
查看次数

创建水平分隔符

我想用 react native 创建一条水平线(分隔符)。分隔符应该有左右空格。我尝试使用在网站上找到的此代码

<View
  style={{
    borderBottomColor: 'black',
    borderBottomWidth: 1,
    left: 5,
    right:5
  }}
/>
Run Code Online (Sandbox Code Playgroud)

问题是正确的填充不起作用。这条线看起来也不好,有什么办法可以做出一个小阴影?或者是否有可以创建分隔符的组件?

reactjs react-native

2
推荐指数
1
解决办法
5676
查看次数

反应导航中的this.props.navigation与NavigationActions

NavigationActions支持下面的操作,但是当我们访问辅助函数时,我无法理解每个操作的用法this.props.navigation.

  • 导航
  • 重启
  • 背部
  • 在里面

那么我们为什么要进口NavigationActions呢?

提前致谢.

react-native react-navigation

0
推荐指数
1
解决办法
2042
查看次数

反应本机无法链接反应导航和本机基础 - (Expo - CRNA Project)

在Expo React Native应用程序中,执行react-native link后执行时发生以下错误yarn add react-navigation native-base.

添加React Navigation和Native-Base时显示警告


warning “expo > react-native-maps@0.21.0” has incorrect peer dependency “react-native@^0.51 || ^0.52 || ^0.53 || ^0.54”.
warning “expo > react-native-reanimated@1.0.0-alpha.3” has incorrect peer dependency “react@16.0.0-alpha.6”.
warning “expo > react-native-reanimated@1.0.0-alpha.3” has incorrect peer dependency “react-native@^0.44.1”.
warning " > react-native@0.55.4" has incorrect peer dependency “react@16.3.1”.
warning “react-native > eslint-plugin-react-native@3.2.1” has unmet peer dependency “eslint@^3.17.0 || ^4.0.0”.
warning “react-navigation > create-react-context@0.2.2” has unmet peer dependency “prop-types@^15.0.0”.
Run Code Online (Sandbox Code Playgroud)

执行react-native链接时遇到错误


PS C:\Projects\proj> react-native link …
Run Code Online (Sandbox Code Playgroud)

react-native native-base react-navigation expo

0
推荐指数
1
解决办法
2741
查看次数

无法读取 ReactJS 中未定义的属性“状态”(Gatsby)

我有以下代码:

export default class Contact extends React.Component {
    constructor(props) {
      super(props);
      this.state = {
        password: '',
        redirect: false,
        username: ''
      };

  this.onUsernameChange = this.onUsernameChange.bind(this);
  this.onPasswordChange = this.onPasswordChange.bind(this);
}

onUsernameChange(event) {
  this.setState({ username: event.target.value });
}

onPasswordChange(event) {
  this.setState({ password: event.target.value });
}

handleSubmit(event) { 
  event.preventDefault();
  alert('A name was submitted: ' + this.state.username);

  //sessionStorage.setItem('username', this.state.username);

}

render() {

  return (
      <div>
        <form className="form-signin" onSubmit={this.handleSubmit}>
          <input type="text" value={this.username} onChange={this.onUsernameChange} />
          <input type="password" value={this.password} onChange={this.onPasswordChange} />
          <input type="submit" value="Submit" />
        </form>
      </div>
  ); …
Run Code Online (Sandbox Code Playgroud)

javascript event-handling reactjs gatsby

0
推荐指数
2
解决办法
2万
查看次数