【问题标题】:Full page not getting scrolled react-native整页没有滚动反应本机
【发布时间】:2019-06-15 20:22:44
【问题描述】:

我正在使用 Wix react-native-navigation V2 我已将 android:windowSoftInputMode 更改为 "adjustPan" 因为选项卡位于键盘上方,但现在在我的其中一个表单中我有联系表单现在我想滚动整个从键盘上方不显示键盘上方的选项卡我该怎么办。

下面是我的 AndroidManifest.xml 文件

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.newnavigation">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />  

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustPan">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
    </application>

</manifest>

如果有人对此有任何想法,请提供帮助。提前致谢

【问题讨论】:

    标签: react-native keyboard scrollview react-native-navigation adjustpan


    【解决方案1】:

    其实我猜你的问题和Android或者iOS原生端没有关系。此外,它与您用于实现 UI 的库无关。您应该将react-native 样式设置为使用它的组件。请注意以下代码:

    import { SomeComponent } from 'anywhere';
    import { StyleSheet } from 'react-native';
    ...
    <SomeComponent style={styles.container}>
    ...
    const styles = StyleSheet.create({
      container: {
        minHeight: '100%'
      }
    });
    

    伙计,相信我,如果 SomeComponentScrollView 或其他任何具有任何属性的东西,它肯定会得到卷轴。

    老实说,我遇到了这个问题,我发现问题出在我的样式上,而不是其他问题。

    【讨论】:

    • 谢谢,但我检查了所有样式。由于adjustPan屏幕忽略键盘是个问题
    • 亲爱的@AhteshamShah,感谢您关注我的回答。谢谢。
    • @AhteshamShah,我现在在工作。这是我的工作时间。几个小时后我会处理你的问题。
    【解决方案2】:

    感谢@Mehrdad88sh 我已经通过使用 KeyboardAvoidingView 解决了这个问题

    import { KeyboardAvoidingView } from 'react-native';
    
    <KeyboardAvoidingView style={styles.container} behavior="padding" enabled>
      ... your UI ...
    </KeyboardAvoidingView>
    

    有关更多详细信息,请参阅给定的链接 https://facebook.github.io/react-native/docs/keyboardavoidingview

    【讨论】:

      猜你喜欢
      • 2018-08-21
      • 1970-01-01
      • 1970-01-01
      • 2019-10-25
      • 2023-01-26
      • 2020-04-02
      • 1970-01-01
      • 2022-09-30
      • 1970-01-01
      相关资源
      最近更新 更多