- objective-c - iOS 5 : Can you override UIAppearance customisations in specific classes?
- iphone - 如何将 CGFontRef 转换为 UIFont?
- ios - 以编程方式关闭标记的信息窗口 google maps iOS
- ios - Xcode 5 - 尝试验证存档时出现 "No application records were found"
在我升级到 React Native 0.48 后,我遇到了以下错误,它在渲染时显示在 expo 应用程序(仅在 IOS 中)
scrollview has no proptype for native prop RCTScrollView.onScrollAnimationEnd of native type BOOL .if you havent changed this prop yourself this usually means that your versions of the native code and javascript code are out of sync. Updating oth should make this error go away.
不知道为什么,但我尽可能地缩小了我的代码库。当我尝试使用 ListView 时会生成此错误。这是代码库:
import React from 'react';
import {AppRegistry,View,Text,StyleSheet,ListView} from 'react-native';
const styles = StyleSheet.create({
fullView:{
flex:1
},
statusBar: {
backgroundColor:"#de3c3c",
padding:5
},
});
class MyComponent extends React.Component {
constructor() {
super();
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
this.state = {
dataSource: ds.cloneWithRows(['row 1', 'row 2']),
};
}
render() {
return (
<ListView
dataSource={this.state.dataSource}
renderRow={(rowData) => <Text>{rowData}</Text>}
/>
);
}
}
export default MyComponent;
这是我的依赖项:
"dependencies": {
"expo": "^20.0.0",
"react": "^16.0.0-alpha.12",
"react-native": "^0.48.1",
"react-navigation": "^1.0.0-beta.11"
}
我查看了 ListView 的文档,它似乎已被弃用,但它应该仍然有效?当我尝试 FlatList 时,它也会产生同样的错误。
注意:我确定没有其他打包程序在运行。
最佳答案
找到了可能的解决方案!
- Bump expo version in package.json to 21.0.2
- Bump react-native version in package.json to 0.48.4
- Remove node_modules
- npm install or yarn install
- Change sdk version in app.json to 21.0.0
...ScrollView 错误应该会消失。
关于javascript - React Native 0.48 - `scrollview 没有原生的 proptype,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46119806/
考虑一下: import PropTypes from 'prop-types'; [...] Component.propTypes = { someProp: PropTypes.array,
请不要在完全阅读之前关闭此问题。这听起来像是一个可以主要由一个人的意见来回答的问题。但是为什么会有两种 PropTypes 的实现呢?哪一个是首选? 一种方法是使用 static 关键字并定义我们的
有什么区别 PropTypes.exact({ name: PropTypes.string, age: PropTypes.number }) 对比 PropTypes.shape({
我正在尝试创建一个自定义 PropType 来检查数组是否具有数值且长度为 2(并且对数字的排序有一些限制)。 显然,我可以为前两个约束执行 Array.PropType.arrayOf(Array.
我正在尝试使用单个 PropTypes 定义来在多个组件中重用它,但遇到了问题。我在单独的类中定义静态 propTypes,然后将其作为模块导入。比如说,我有一个 View 的 React 组件: i
// Anything that can be rendered: numbers, strings, elements or an array // (or fragment) containing
我在单独的文件中创建了两个模型 State 和 City。该州的进口城市。 State 中可以包含一系列城市。 下面的代码工作正常。 State.js let State = PropTypes.sh
删除并重新安装我的 node_modules 文件夹后,我在 LayoutPropTypes.js 文件中遇到了一个我不明白的问题。 在node_modules/react-native/Librar
我有一个组件,它接收其大小的 Prop 。 prop 可以是字符串或数字,例如:"LARGE" 或 17。 我可以让 React.PropTypes 知道这可以是 propTypes 验证中的其中之一
我想集中可能包含不同属性并且需要或不需要的属性类型。举个例子: 组件 A 具有: roomData: PropTypes.shape({ roomId: PropTypes.number, r
更新节点模块后,我在运行的 React 16 应用程序中使用 prop-types 库时遇到了错误。 我创建了一个新的React 16 create-react-app项目来检查这个问题,并且错误以同
我可以在容器组件中使用 PropTypes 吗? 通常,在容器组件中,我连接到 redux 存储并获取自己的数据,但有时我想从父组件传递额外的 props。在这种情况下,我想确保使用 PropType
我正在尝试一些 react native 代码。 根据此blog中给出的说明为我的组件添加了 Prop . 最终出现错误,找不到变量:PropTypes在 github 中发现同样的问题但没有任何答复
我正在使用 eslint 的 Airbnb 配置,它给了我这个警告: [eslint] Prop 验证中缺少“isLoading”(react/prop-types) 有没有办法为isLoading设
我正在设置一个新的 React 在: Create React App 的帮助下 但是,我遇到了 linting 问题。我收到以下 linting 错误 'PropTypes' 未定义。 (无unde
React 有很多使用 PropTypes 来检查 prop 值的方法。我常用的一种是 React.PropTypes.shape({...})。然而,我最近遇到了一种情况,我有一个对象,里面有动态键
我正在尝试 react 样板。它配备了一些发电机。 当我生成一个新容器并将所有选项都勾选为"is"时... ? Select the base component type: React.Compon
我正在 React 中编写一个小型 Toolbar 组件。下面是它的使用方法: 或 或 我希望能够指定 Toolbar 接受的唯一子级是 Toolb
我有这个简单的 React 组件: import {PropTypes} from 'react'; import Column from './Column'; export default fun
我应该向父组件及其子组件添加 propTypes 吗? 例如我有一个 传递 3 个 Prop 的组件,我这样验证: const Header = function(props) { if (pro
我是一名优秀的程序员,十分优秀!