我正在尝试学习原生的react。之前,我下载了一个样例项目,并提供了TextInput组件的以下代码 import React, { memo } from 'react';
import { View, StyleSheet, Text } from 'react-native';
import { TextInput as Input } from 'react-native-paper';
import { theme } from '../core/theme';
type Props = React.Componen
我在React Native中运行单元测试,这些单元测试需要模拟NativeEventEmitter和NativeModules,但将其他所有内容都保留为真正的代码。
这部分似乎正常工作,除非在运行时,我得到这个错误。
Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'DevSettings' could not be found. Verify that a module by this name is registered in the native binary.
at inva
我正在导入一个组件到我的react本地应用程序,即使在尝试了我已经在网上找到的解决方案之后,我仍然会得到相同的错误,所以我可能是个初学者,所以我错过了一些显而易见的东西
我试着用大括号包装我的导入名,但它似乎没有帮助
my main app.js
import React from 'react';
import { StyleSheet, View, Header, } from 'react-native';
import { NumberInput } from './src/components/NumberInput
由于我刚开始接触react-native,我只是尝试在react-native中构建一个可以导航的简单应用程序。
index.js
import React from 'react';
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
import 'react-native-gesture-handler';
import {Navigatio
我对js很陌生。
我试图将es5更改为es6类。
在我的es5中,选项卡内容工作得很好
在我的es6中,选项卡内容起作用
但是现在我计划把这些组件分成三个不同的部分
我把它导入了一个文件。
但是我得到了以下三个错误
你们能告诉我怎么修吗?
提供下面的代码。
在小提琴里,不知道如何把我的文件分开。
用es6显示的选项卡内容
warning.js:45 Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a
我想做的是创建一个TouchableOpacity,然后在我的程序中到处使用它。我在处理新闻事件时遇到了一个问题。我在其他类中导入了TouchableOpacity,并希望在那里处理onPress事件。但是我的代码不是working.There,导入也没有问题。下面是我导入TouchableOpacity组件的类
import React, {Component} from 'react';
import {Text,View,Alert} from 'react-native';
import MyButton from './MyButton'
我无法更改导入的RN块的状态。
我试着:
this.setState({myState: "This does not do anything"})
但它不起作用。我怀疑问题出在这一点上--只引用主要文档。但我不知道怎么改变它。
有趣的是,
state = {myState: 'Now it is changed'}
this.setState({})
这是可行的。但从我在这里读到的内容来看,它并不被推荐。
谢谢!
// MAIN FILE
import React, {Component} from 'react';
import {But
关于类似的问题,我看过很多类似的帖子,但没有一个答案能帮我解决。
这是一个完整的错误:
所以在我的src/navigation/feed/stack.js中,它被定义如下:
import React from 'react';
import {StackNavigator} from 'react-navigation';
import ActivityFeed from 'activity-feed/session-user/screens/Main';
import HamburgerButton from 'navigatio
当我运行跨平台的js时,我得到了上面的错误。这有没有引起任何人的注意?下面是跨平台的js。而最后的代码片段是index.android.js
var React = require('react-native');
//import React from 'react';
var {
//import {
AppRegistry,
Component,
StyleSheet,
Text,
View
} = React;
//} from 'react-native';
var AwesomeProject = Rea
我是新的反应-本机,我正面临上述错误在我的代码。
我面临的错误是:
TypeError:未定义不是对象(计算'name.length')
此错误位于:
in ProductCard (created by ProductList)
in RCTView (created by View)
in View (created by ProductList)
in RCTView (created by View)
in View (created by AnimatedComponent)
in AnimatedComponent
in AnimatedComponentWrapp
我有一个RN项目,它在安卓上运行得很好,但在iOS上却出了问题。我在其中使用了react-native-firebase。是firebase产生的问题吗?
不起作用的是: Xcode中的-Used遗留设置没有解决这个问题。从xcode -ran项目
如果我运行react-native run-ios,它会给出以下错误:
error Failed to build iOS project. We ran "xcodebuild" command but it exited
with error code 65. To debug build logs further, cons
当前行为
使用react-native-tab-view v1.0.0时,出现错误:
Invariant Violation: Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, o
希望有人能帮我,因为我在努力看问题出在哪里。
当使用react本机导航创建堆栈导航器时,无论我使用何种方法导出和导入组件以传递到<Stacks.creen/>,它似乎都会抛出以下错误。
堆栈跟踪
Error: Couldn't find a 'component', 'getComponent' or 'children' prop for the screen 'Home'. This can happen if you passed 'undefined'. You likely forg
App.js
import React,{ Component } from 'react';
import { StyleSheet,TextInput, View, Button, Text } from 'react-native';
import Toast from 'react-native-simple-toast';
import TextItem from '.src/Components/Textviews/TextViewDisplay';
export default class App extends