Skip to content
This repository was archived by the owner on Jan 14, 2026. It is now read-only.
This repository was archived by the owner on Jan 14, 2026. It is now read-only.

@react-navigation/stack库 TextInput组件可以穿透下个页面点击 #37

@xuxiaoqian1

Description

@xuxiaoqian1

描述 / Description

问题场景:A页面有输入框,跳转到B页面,B页面跳转到C页面,C页面返回到B页面,点击B页面按钮(B页面没有输入框)会弹出键盘。

根因:B跳转到C,A页面display:none,C跳转到B,A页面display:flex。在这个过程中A页面元素有个销毁到重新渲染的过程。这块逻辑在react-native-screens中实现的,此库尚未鸿蒙化。

当前规避方案:修改navigation/stack库,在node_modules/@react-navigation/stack/src/views/Screens.tsx 中用到了react-native-screens库,此库尚未鸿蒙化。找到Screens.tsx中找到MaybeScreen替换以下代码即可:
修改处如下:

 export const MaybeScreen = ({
  enabled,
  active,
  ...rest
}: ViewProps & {
  enabled: boolean;
  active: 0 | 1 | Animated.AnimatedInterpolation<0 | 1>;
  children: React.ReactNode;
  freezeOnBlur?: boolean;
}) => {
   if (Screens != null  && Platform.OS !==='harmony') {
    return (
      <Screens.Screen enabled={enabled} activityState={active} {...rest} />
    );
  }

  return <View {...rest} />;
};

复现步骤 / Steps to reproduce

No response

库版本 / Library version

6.4.0-0.0.4

React Native OpenHarmony version

0.72.29

构建类型 / Build type

Debug app & dev bundle

设备 / Device

Real device

设备版本 / Device model

Mate 60 pro(NEXT.0.0.66)

已悉知 / Acknowledgements

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions