我已安装react-native-prompt
。
我可以看到它已添加到package.json
,但我无法在node_modules
找到它 - react-native-prompt
中没有node_modules
目录。当我尝试导入react-native-prompt
时,它表示undefined不是对象。这是我的代码:
import React from 'react';
import Prompt from 'react-native-prompt';
const AddTaskPrompt = ({isVisible,onCancelCallBack,onSubmitCallBack}) => (
<Prompt
title="ajouter une tache"
placeholder="ex: ramenre du lait"
defaultValue=""
visible={isVisible}
onCancel={() => onCancelCallBack()}
onSubmit={value => onSubmitCallBack(value)} />
);
export default AddTaskPrompt;
我package.json
的内容与
{
"name": "fekri4",
"version": "0.1.0",
"private": true,
"devDependencies": {
"jest-expo": "23.0.0",
"react-native-scripts": "1.8.1",
"react-test-renderer": "16.0.0"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "node node_modules/jest/bin/jest.js --watch"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"expo": "^23.0.4",
"lodash": "^4.17.4",
"react": "16.0.0",
"react-native": "0.50.3",
"react-native-action-button": "^2.8.3",
"react-native-elements": "^0.18.5",
"react-native-modal": "^4.1.1",
"react-native-prompt": "^1.0.0"
}
}