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

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

Open
xuxiaoqian1 opened this issue Sep 24, 2024 · 0 comments

Comments

@xuxiaoqian1
Copy link

xuxiaoqian1 commented Sep 24, 2024

描述 / 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant