React native :Unable to resolve module Indeed, none of these files exist:(React native :Unable to resolve module 事实上,这些文件都不存在:)
问题描述
I'm following this medium article to use FloatingTitleTextInputField
in my react-native project
below is my project structure
Here is my code for HomeScreen.js
import React, {Component} from 'react';
import {Text, View, TextInput, StyleSheet} from 'react-native';
import FloatingTitleTextInputField from './customComponents/floating_title_text_input_field';
export default class HomeScreen extends Component {
render() {
return (
// <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
// <Text>My First React App</Text>
// <TextInput style={{height: 40, borderColor: 'gray', borderWidth: 1}} />
// </View>
<View style={styles.container}>
<View style={styles.container}>
<Text style={styles.headerText}>Its Amazing</Text>
<FloatingTitleTextInputField
attrName="firstName"
title="First Name"
value={this.state.firstName}
updateMasterState={this._updateMasterState}
/>
<FloatingTitleTextInputField
attrName="lastName"
title="Last Name"
value={this.state.lastName}
updateMasterState={this._updateMasterState}
/>
</View>
</View>
);
}
}
var styles = StyleSheet.create({
container: {
flex: 1,
paddingTop: 65,
backgroundColor: 'white',
},
labelInput: {
color: '#673AB7',
},
formInput: {
borderBottomWidth: 1.5,
marginLeft: 20,
borderColor: '#333',
},
input: {
borderWidth: 0,
},
});
When i try to use FloatingTitleTextInputField
inside HomeScreen.js
I'm getting below error
error Unable to resolve module `./floating_title_text_input_field` from `React Native/AwesomeProject/screens/
HomeScreen.js`: The module `./floating_title_text_input_field` could not be found from `/React Native/AwesomeProject/screens/HomeScreen.js`. Indeed, none of these files exist:
* `/React Native/AwesomeProject/screens/floating_title_text_input_field(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)`
* `/React Native/AwesomeProject/screens/floating_title_text_input_field/index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)`. Run CLI with --verbose flag for more details.
Error: Unable to resolve module `./floating_title_text_input_field` from `React Native/AwesomeProject/screens/HomeScreen.js`: The module `./floating_title_text_input_field` could not be found from `/React Native/AwesomeProject/screens/HomeScreen.js`. Indeed, none of these files exist:
Can anybody help me to solve this issue
If need more information please do let me know. Thanks in advance. Your efforts will be appreciated.
You're referencing it from the HomeScreen
component which is in the screens
directory. Because you're using the local ./ path, it's trying to find it in screens/customComponents
. Using ../customComponents/floating_title_text_input_field
should fix it.
这篇关于React native :Unable to resolve module 事实上,这些文件都不存在:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:React native :Unable to resolve module 事实上,这些文件都不存在:
基础教程推荐
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01