React-native: RCTNetworking could not be found within the project

Created on 25 Oct 2019  路  1Comment  路  Source: facebook/react-native

After upgrading from 0.60.5 to 0.61.2, RCTNetwork does not seem to be recognized anymore. It is currently used in a util file, and imported with
const RCTNetworking = require('RCTNetworking');

In 0.60.5, the import seems to be fine and used correctly.

React Native version: 0.61.2
System:
OS: macOS 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
Memory: 27.82 MB / 8.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.16.2 - ~/.nvm/versions/node/v10.16.2/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v10.16.2/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.1, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
Android SDK:
API Levels: 25, 27, 28
Build Tools: 26.0.2, 27.0.3, 28.0.3
IDEs:
Android Studio: 3.4 AI-183.5429.30.34.5452501
Xcode: 11.1/11A1027 - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.2 => 0.61.2

Steps To Reproduce

  1. Create a new react-native project with
    react-native init test (Should be initialized w RN v0.61.2)
  2. In App.js, import RCTNetworking with
    const RCTNetworking = require('RCTNetworking');
  3. View the error by attempting to run the app: Unable to resolve module 'RCTNetworking' from 'App.js'

Describe what you expected to happen:
RCTNetworking imported and used

Snack, code example, screenshot, or link to a repository:
image

Bug

Most helpful comment

Hey!
As far as I'm concerned, RCTNetwork is not available as a public surface API, however it's going to be that way and its PR is already merged in master: https://github.com/facebook/react-native/pull/25718.

for the time being, you can use:
const RCTNetworking = require('react-native/Libraries/Network/RCTNetworking');

>All comments

Hey!
As far as I'm concerned, RCTNetwork is not available as a public surface API, however it's going to be that way and its PR is already merged in master: https://github.com/facebook/react-native/pull/25718.

for the time being, you can use:
const RCTNetworking = require('react-native/Libraries/Network/RCTNetworking');

Was this page helpful?
0 / 5 - 0 ratings

Related issues

grabbou picture grabbou  路  3Comments

lazywei picture lazywei  路  3Comments

josev55 picture josev55  路  3Comments

axelg12 picture axelg12  路  3Comments

jlongster picture jlongster  路  3Comments