vscode React Native StyleSheet 没有代码提示解决

  1. run npm i --save-dev @types/react-native in your project's root
  2. open /node_modules/@types/react-native/index.d.ts
  3. add the following snippet
interface Styles {
    [style: string]: Style
}

export function create(styles: Styles): any;

right after the line with export namespace StyleSheet { (it's line 4469 in my case).

You might also need to restart VSCode after applying the changes, but in my case they were applied immediately.

参考链接: https://github.com/Microsoft/vscode-react-native/issues/379

你可能感兴趣的:(vscode React Native StyleSheet 没有代码提示解决)