

Me too
If you look in the bottom right of the VS Code window, what language service does it show?
Also have you referenced import { AppRegistry } from 'react-native'; ?
我也遇到了这个问题,用typescript可以结局,但是需要手动安装@types/react-native
@MSLaguana JavaScript, no JavaScript React. I am sure referenced import { AppRegistry } from 'react-native';
just copy srcRootDir/.vscode/typings to srcRootDir/typings , and it works.
don't know why, but work.
Do you have a jsconfig.json or a tsconfig.json file in your root folder, which specifies either a files element or an excludes element? If you do, that may be excluding the .vscode/typings folder which would mean intellisense does not consider them.
@MSLaguana My tsconfig.json:
{
"compilerOptions": {
"allowJs": true
},
"exclude": [
"node_modules"
]
}
Do not have jsconfig.json.
That shouldn't cause issues then. Could you please check that .vscode/react/typings exists and has react-native.d.ts in it?
exist……
I've created a new project with
react-native init foobar
cd foobar
code .
and the extension is not working. It's not even recognizing that the language is Javascript React.
My tsconfig.json is
{"compilerOptions":{"allowJs":true},"exclude":["node_modules"]}
I've tried the following from the project root:
cp -R .vscode/typings .vscode/react;cp -R .vscode/typings .cp -R .vscode/typings .vscode/.react (no dice, vscode will delete it);I don't have a .vscode/react/typings but I have .vscode/typings/react-native/react-native.d.ts
Oh, by the way, the README still mentions VSCode 0.11, which seems just a little outdated since we are at 1.6.
By the way, I've managed to have auto completion by installing the "Typings" extension as described in this blog post: https://medium.com/react-weekly/react-native-and-typescript-ad57b7413ead#.lqkkadkkt
I'm just starting with this technology, so bear with me if I'm doing a bit of cargo-culting... :)
Most helpful comment
I've created a new project with
and the extension is not working. It's not even recognizing that the language is Javascript React.
My tsconfig.json is
{"compilerOptions":{"allowJs":true},"exclude":["node_modules"]}I've tried the following from the project root:
cp -R .vscode/typings .vscode/react;cp -R .vscode/typings .cp -R .vscode/typings .vscode/.react(no dice, vscode will delete it);I don't have a
.vscode/react/typingsbut I have.vscode/typings/react-native/react-native.d.tsOh, by the way, the README still mentions VSCode 0.11, which seems just a little outdated since we are at 1.6.