Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android:ScrollView,其中包含文本输入而不是滚动_Android_React Native_Scrollview_Textinput - Fatal编程技术网

Android:ScrollView,其中包含文本输入而不是滚动

Android:ScrollView,其中包含文本输入而不是滚动,android,react-native,scrollview,textinput,Android,React Native,Scrollview,Textinput,我有一个包含太多文本输入的滚动视图。在我将textAlign:'right'添加到TextInput样式之前,一切都正常。之后,ScrollView不会响应scroll。这个问题刚刚出现在android上,在iOS上,它的工作正如预期的那样。我向 render(){ 让TextInput2=( ); 返回( {TextInput2} {TextInput2} {TextInput2} {TextInput2} {TextInput2} {TextInput2} {TextInput2} {Tex

我有一个包含太多文本输入的滚动视图。在我将
textAlign:'right'
添加到TextInput样式之前,一切都正常。之后,ScrollView不会响应scroll。这个问题刚刚出现在android上,在iOS上,它的工作正如预期的那样。我向

render(){
让TextInput2=(
);
返回(
{TextInput2}
{TextInput2}
{TextInput2}
{TextInput2}
{TextInput2}
{TextInput2}
{TextInput2}
{TextInput2}
{TextInput2}
{TextInput2}
{TextInput2}
{TextInput2}
{TextInput2}
{TextInput2}
);
}

<代码> > p>如果在<代码> ScReVIEW 中有太多的项目,那么也许您应该考虑使用。我也有过类似的问题。在安卓系统中,当有太多项目无法滚动时,
ScrollView
首先会失败。我认为I-devices在呈现react本机组件方面有更好的优化,这可以防止它们过早出现故障。

我不确定为什么textAlign:“right”会导致这种情况,但我注意到ios和android TextInput之间有很大的差异。在Android上,如果文本输入框小于字体大小,它会在其内部创建一个可滚动的文本输入,从而阻止scrollview成为响应者。尝试增加每个文本输入的高度和宽度,以确保情况并非如此。

谢谢您的回答。问题是textAlign:对。我添加此代码只是为了显示问题。
  render() {
    let TextInput2 = (
      <TextInput
        style={{
          flex: 1,
          textAlign: 'right',
          height: 50
        }}
        placeholder="placeholder"
      />
    );
    return (
      <ScrollView>
        {TextInput2}
        {TextInput2}
        {TextInput2}
        {TextInput2}
        {TextInput2}
        {TextInput2}
        {TextInput2}
        {TextInput2}
        {TextInput2}
        {TextInput2}
        {TextInput2}
        {TextInput2}
        {TextInput2}
        {TextInput2}
      </ScrollView>
    );
  }