react-native: [Android v0.65.1] Fresh install gives NativeUIManager.getConstantsForViewManager('Text') error while debugging

Description

Trying to create a new project with the the latest stable version of both RN and RN CLI throws this error when Debug mode is enabled:

NativeUIManager.getConstantsForViewManager('Text') threw an exception. Invariant Violation: Calling synchronous methods on native modules is not supported in Chrome.

 Consider providing alternative methods to expose this method in debug mode, e.g. by exposing constants ahead-of-time. 
App@http://10.0.2.2:8081/App.bundle?platform=android&app=com.testa&modulesOnly=true&dev=true&minify=false&runModule=true&shallow=true:18:54
RCTView
View
RCTView
View
AppContainer@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.testa&modulesOnly=false&runModule=true:75604:36
RootComponentWithMeaningfulName@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.testa&modulesOnly=false&runModule=true:82460:24

Even if you just render a single View component with a Text inside WITH styling, it will throw the error. IF you remove the style prop from the Text component then the error is gone.

React Native version:

16:08:49 ~/code/testa $ react-native info
info Fetching system and libraries information...
System:
    OS: Linux 5.10 Arch Linux
    CPU: (16) x64 Intel(R) Core(TM) i9-9900 CPU @ 3.10GHz
    Memory: 341.81 MB / 15.55 GB
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 16.7.0 - /usr/bin/node
    Yarn: 1.22.11 - /usr/bin/yarn
    npm: 7.20.6 - /usr/bin/npm
    Watchman: 4.9.0 - /home/linuxbrew/.linuxbrew/bin/watchman
  SDKs:
    Android SDK:
      API Levels: 16, 28, 29, 30
      Build Tools: 28.0.3, 29.0.2, 30.0.2, 30.0.3, 31.0.0
      System Images: android-28 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.7199119
  Languages:
    Java: 1.8.0_292 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2
    react-native: 0.65.1 => 0.65.1
  npmGlobalPackages:
    *react-native*: Not Found
16:08:57 ~/code/testa $

Steps To Reproduce

  1. run react-native init testa
  2. start the app(run yarn start and yarn android
  3. Enable debug mode

Expected Results

Not throw any error

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

image

import React from 'react';
import {Text, View} from 'react-native';

const App = () => {
  return (
    <View>
      <Text style={{backgroundColor: 'red'}}>Hello</Text>
    </View>
  );
};

export default App;

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 13
  • Comments: 29 (8 by maintainers)

Most upvoted comments

Is there any solution other than downgrade?

@shinken008 +1 comments are useless in practice and just add notifications noise to people trying to solve root causes. Please do not post them. Use a reaction (thumbs-up) in the future, thank you

It is definitely an issue, however it seems to be related to react native reanimated v2 (https://docs.swmansion.com/react-native-reanimated/docs/#known-problems-and-limitations) So I understand this might not be the right place for it; although it might help some other people passing by.

Can confirm, with react-native@0.66.0 this isn’t an issue anymore.

We believe https://github.com/facebook/react-native/pull/31164 fixed this, and will be in the v0.66 release (it is already in v0.66.0-rc.4)

@sezginriggs I believe it was fixed for react-native 0.66 (will likely release any day now, rc4 from last week appears to be final)

https://github.com/facebook/react-native/commit/49b3b31d8e706338dac4ced1b372424d7d1d133f

That’s the commit that fixed it, it was in 0.66.0-rc.1 and should be released shortly.

The same here with v0.65.1

That’s a very surprising result @nahidmbstu - triple-check everything’s clean (npx react-native-clean-project) and the update was successful. I definitely reproduced before 0.66.0-rc.1, I definitely do not reproduce after 0.66.0-rc.1

same issue with rn v0.65.1