首页 > 解决方案 > FabricViewStateManager:在没有 StateWrapper 的情况下调用 setState

问题描述

我是一名 iOS 开发人员,第一次使用 React-native 进入 Android d。

我正在使用 polidieas react-native-ble-plx 库创建一个使用 bluetooth-le 的 react-native 应用程序。iOS 应用程序运行良好,蓝牙扫描和检测设备。当我在 Android 上运行时,它开始扫描并且我收到错误“FabricViewStateManager: setState called without a StateWrapper”并且找不到任何文档或此错误语句的帮助。

两个问题:

  1. 有人在 Anmdroid 上运行 React-Native 应用程序时看到此错误:FabricViewStateManager: setState 在没有 StateWrapper 的情况下调用。

  2. 有人对如何隔离错误发生的位置有任何想法吗?

这是错误之前的控制台:

I/BluetoothAdapter: STATE_ON
I/BluetoothAdapter: STATE_ON
I/BluetoothAdapter: STATE_ON
I/BluetoothAdapter: STATE_ON
D/BluetoothLeScanner: Start Scan with callback
D/BluetoothLeScanner: onScannerRegistered() - status=0 scannerId=13 mScannerId=0
I/ReactNative: [GESTURE HANDLER] Initialize gesture handler for root view com.facebook.react.ReactRootView{67ef486 V.E...... ......ID 0,0-1080,2019 #1}
**E/unknown:FabricViewStateManager: setState called without a StateWrapper**
I/ReactNativeJS: ┐ %c action %cCHANGE_STATUS %c@ 20:36:54.384
I/ReactNativeJS: │ '%c prev state', 'color: #9E9E9E; font-weight: bold', { BLEs: 
       { BLEList: [],
         color: '#800080',
         oldColor: '#000000',
         intensity: 127,
         connectedDevice: {},
         status: 'disconnected' } }
    │ '%c action    ', 'color: #03A9F4; font-weight: bold', { type: 'CHANGE_STATUS', status: 'Scanning' }
I/ReactNativeJS: │ '%c next state', 'color: #4CAF50; font-weight: bold', { BLEs: 
       { BLEList: [],
         color: '#800080',
         oldColor: '#000000',
         intensity: 127,
         connectedDevice: {},
         status: 'Scanning' } }
    ┘ 
    ┐ %c action %cADD_BLE %c@ 20:36:54.391
I/ReactNativeJS: │ '%c prev state', 'color: #9E9E9E; font-weight: bold', { BLEs: 
       { BLEList: [],
         color: '#800080',
         oldColor: '#000000',
         intensity: 127,
         connectedDevice: {},
         status: 'Scanning' } }
I/ReactNativeJS: │ '%c action    ', 'color: #03A9F4; font-weight: bold', { type: 'ADD_BLE',
      device: 

标签: androidreactjsreact-nativereact-native-ble-plx

解决方案


据我所知,目前还没有答案。facebook/react-native请参阅GitHub中针对该项目发布的此问题: https ://github.com/facebook/react-native/issues/32070 。

如果您正在使用它,它可能react-native-reanimated与 RN 有关,这是导致最新版本的 RN 出现一些神秘崩溃的原因(例如,请参见此处此处)。他们显然已经解决了最近2.2.2发布的问题(21 年 9 月 14 日)和他们的2.3.0-alpha.


推荐阅读