Skip to content

Cannot get auto-linking to work #6024

Closed
@bzoz

Description

@bzoz

Cannot get autlonking to work. Tried both react-native-webview and react-native-config while porting it to Windows.

Environment

Run the following in your terminal and copy the results here.

  1. npx react-native --version: 4.13.0
  2. npx react-native run-windows --info:
  System:
    OS: Windows 10 10.0.19041
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 21.51 GB / 31.85 GB
  Binaries:
    Node: 12.18.3 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.14.6 - C:\Program Files\nodejs\npm.CMD
  npmPackages:
    react: 16.13.1 => 16.13.1
    react-native: 0.63.2 => 0.63.2
    react-native-windows: ^0.63.0-0 => 0.63.2
  Installed UWP SDKs:
    10.0.17763.0
    10.0.18362.0
  1. reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock":
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock
    AllowDevelopmentWithoutDevLicense    REG_DWORD    0x1
    AllowAllTrustedApps    REG_DWORD    0x1

Steps To Reproduce

E.g. with the react-native-webview. Did the following to make a sample app:

npx react-native init RNWV --template react-native@^0.63.2
cd RNW
npx react-native-windows-init --overwrite
yarn add react-native-webview

Modified App.js with the sample self-contained code:

import React, { Component } from 'react';
import { WebView } from 'react-native-webview';

class MyInlineWeb extends Component {
  render() {
    return (
      <WebView
        originWhitelist={['*']}
        source={{ html: '<h1>Hello world</h1>' }}
      />
    );
  }
}

After running npx react-native run-windows it looks like the module is not autolinked. I get this error:
image

Breaking the code inside node-modules\react-native-webview also does not break the build process.

Running npx react-native autolink-windows --logging produces:

- Auto-linking...
Parsing project...
Found Windows app project, config:
{
  folder: 'C:\\Users\\ja\\RNWV',
  sourceDir: 'windows',
  solutionFile: 'RNWV.sln',
  project: {
    projectFile: 'RNWV/RNWV.vcxproj',
    projectName: 'RNWV',
    projectLang: 'cpp',
    projectGuid: '{09961e61-f4f7-47b0-a80d-c1be08ababfd}'
  }
}
Parsing dependencies...
react-native-webview has Windows implementation, config:
{
  folder: 'C:\\Users\\ja\\RNWV\\node_modules\\react-native-webview',
  projects: [],
  solutionFile: 'ReactNativeWebView.sln',
  nugetPackages: [],
  sourceDir: 'windows'
}
Adding react-native-webview.
Calculating AutolinkedNativeModules.g.cpp...
Reading AutolinkedNativeModules.g.cpp...
No changes to AutolinkedNativeModules.g.cpp.
Calculating AutolinkedNativeModules.g.targets...
Reading AutolinkedNativeModules.g.targets...
No changes to AutolinkedNativeModules.g.targets.
Calculating RNWV.sln changes...
 √ Auto-linking...
Success: No auto-linking changes necessary. (1498ms)

Similarly, when autolinking my react-native-config I see it being detected with empty projects and nugetPackages values, and similarly, it does not get included in the build.

Expected Results

It just works

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions