Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] Navbar使用placeholder之后,在更新state的时候placeholder会闪消失一下 #878

Open
xxxifan opened this issue Jan 7, 2025 · 1 comment

Comments

@xxxifan
Copy link
Contributor

xxxifan commented Jan 7, 2025

问题出在哪个包

@taroify/core

问题出在哪个平台/设备/浏览器

微信小程序

平台/设备/浏览器

No response

你正在使用的 Taroify 版本是多少

0.6.1

描述一下您遇到的问题以及重现步骤

在使用Navbar的时候用fixed + placeholder能比较好的避开顶部区域并让内容显示在navbar之下,但是后来发现,目前只有在页面是纯input+button(类似于登录页面这种)输入的时候不会触发,其他页面在更新state的时候placeholder区域会消失一下然后恢复,相当于整个页面往上缩了一下。附可重现的js代码

import {PureComponent} from "react";
import {View} from "@tarojs/components";
import {Cell, Navbar} from "@taroify/core";
import Taro from "@tarojs/taro";
import './index.scss';

export default class SurveyMenu extends PureComponent {

  constructor() {
    super();

    const info = Taro.getWindowInfo();
    const top = info.statusBarHeight;
    this.state = {
      top: top,
      nrsState: false,
      dlqiState: false,
      adctState: false,
      poemState: false,
    }
  }
  
  onClickNrs = () => {
    this.setState({nrsState: !this.state.nrsState});
  }

  render() {
    return (
      <View>
        <Navbar title='自主评分表' bordered fixed placeholder>
          <Navbar.NavLeft onClick={this.onBack}>返回</Navbar.NavLeft>
        </Navbar>
        <View className='container'>
          <Cell title='数字评定量表' isLink
            onClick={this.onClickNrs}
          >{this.state.nrsState ? '已完成' : '未完成'}</Cell>
          <Cell title='生活质量问卷' isLink onClick={this.onClickNrs}>{this.state.dlqiState}</Cell>
          <Cell title='自行监测报告' isLink onClick={this.onClickNrs}>{this.state.adctState}</Cell>
          <Cell title='自我检查评分量表' bordered isLink
            onClick={this.onClickNrs}
          >{this.state.poemState}</Cell>
        </View>
      </View>
    );
  }
}

如果可能的话,请包含一个代码框的链接与复制的问题

No response

你知道如何解决这个问题吗

None

您是否愿意参与修复这个问题,并创建一个 PR

Yes

修复这个问题的解决方案

目前我只能不用placeholder,直接对Navbar加paddingTop的style,但确实想弄清楚发生这种问题的原因是什么。

@Pilotager
Copy link
Collaborator

我查下问题

@hbztd hbztd mentioned this issue Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants