【问题标题】:Why my design gets disappear when I use <TouchableWithoutFeedback>?为什么当我使用 <TouchableWithoutFeedback> 时我的设计会消失?
【发布时间】:2020-05-24 05:27:02
【问题描述】:
      <View style={{flex:1}} >
      <ImageBackground
          source={require('../images/back02.png')}
          style={styles.bgscreen}
          onPress={Keyboard.dismiss}
          >
          <KeyboardAvoidingView behavior='position'>
          <Image
          style={styles.headImage}
          source={require('../images/login_img.png')} />
        <ImgBack navigation={this.props.navigation} />
        </KeyboardAvoidingView>
        </ImageBackground>
        </View>
        </TouchableWithoutFeedback>

如果我删除&lt;TouchableWithoutFeedback&gt;,那么一切都很好。帮我。不要询问子组件代码。没必要知道那件事。那里一切都很好。

我只是遇到了&lt;TouchableWithoutFeedback&gt; 的问题

我已经导入import { TouchableWithoutFeedback } from 'react-native-gesture-handler';

适用于 ios 和 android 平台。

【问题讨论】:

  • 尝试将 flex:1 添加到 TouchableWithoutFeedback
  • 哪个平台,安卓还是ios?
  • 两者。安卓和ios也一样!
  • @LeventeGabos 您的解决方案不起作用。没区别!

标签: android ios reactjs react-native react-redux


【解决方案1】:

之前遇到过这个问题,从 react native 导入而不是 react native 手势处理程序,或者使用具有透明属性的按钮而不是可触摸的

【讨论】:

    【解决方案2】:

    导入语句存在问题。 使用

    import { TouchableWithoutFeedback } from 'react-native';
    

    改为

    import { TouchableWithoutFeedback } from 'react-native-gesture-handler';
    

    【讨论】:

      【解决方案3】:

      style={{height: '100%'}} 添加到您的TouchableWithoutFeedback 组件

      【讨论】:

        猜你喜欢
        • 2013-12-21
        • 2019-09-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-03-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多