我正在开发一个React本机项目,在我的项目中我正在为这个错误而苦苦挣扎 TypeError:未定义不是对象(正在评估'_reactNative.Animated.Text.propTypes.style') 所以有人请帮助我如何解决我的React本机项目中的此错误。
这是App.js
import React from 'react';
import {View, TextInput, Text, StyleSheet} from 'react-native';
import {TextField} from 'react-native-material-textfield';
const App = () => {
return (
<View style={styles.container}>
<Text style={styles.heading}>Billing Information</Text>
<Text style={styles.paragraph}>Name</Text>
<TextInput style={styles.input} placeholder="Mark" />
<TextField label="Email" />
</View>
);
};
const styles = StyleSheet.create({
container: {
marginTop: 50,
padding: 20,
color: '#ff0000',
},
heading: {
fontSize: 18,
fontWeight: 'bold',
textAlign: 'left',
color: '#ff0000',
},
paragraph: {
fontSize: 18,
fontWeight: 'bold',
textAlign: 'left',
color: '#0000ff',
backgroundColor: '#32CD32',
},
input: {
fontSize: 18,
fontWeight: 'bold',
textAlign: 'left',
color: '#0000ff',
},
});
export default App;
`````````
This is package.json
```````
{
"name": "form",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"react": "16.11.0",
"react-native": "0.62.2",
"react-native-elements": "^2.0.0",
"react-native-form-builder": "^1.0.16",
"react-native-material-textfield": "^0.16.1"
},
"devDependencies": {
"@babel/core": "7.9.6",
"@babel/runtime": "7.9.6",
"@react-native-community/eslint-config": "0.0.5",
"babel-jest": "24.9.0",
"eslint": "6.8.0",
"jest": "24.9.0",
"metro-react-native-babel-preset": "0.58.0",
"react-test-renderer": "16.11.0"
},
"jest": {
"preset": "react-native"
}
}
如果您不确定我是否不清楚,请发表评论。
you need to import
Animated
inreact-native
like belowyour problem is similiar to this one : enter link description here
希望对你有帮助