来自 MobX 的布尔值条件渲染

问题描述

当 mobx 中的 boolean 为 true 时,我试图显示 InfoWindow。但是当我更改布尔组件时不会重新渲染。 正如我从控制台看到的,我的布尔值正在改变。

这是我的 JSX 代码

Log.d("broadcast","wifi  ConnectivityReceiver");

        Bundle extras = intent.getExtras();
        Intent intent = new Intent("broadCastName");
        // Data you need to pass to another activity
        intent .putExtra("message",extras.getString(Config.MESSAGE_KEY)); 
        context.sendbroadcast(intent );

这是我的mobx

      { GlobalStore.showInfoWindow &&
          <InfoWindow
            position={ {lat: props.Markers.searchResults.results[0].coordinate.lat,lng: props.Markers.searchResults.results[0].coordinate.lon} }
            onCloseClick={GlobalStore.setShowInfoWindow}
          >
            <div className='styles.rap'>
            <h1>Rap</h1>
            <p>Rap</p>
            </div>
          </InfoWindow>
        
      } }
    

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)