Реагировать на собственную вложенную горизонтальную прокрутку без прокрутки на Android - PullRequest
0 голосов
/ 09 апреля 2020

Я работаю над дизайном экрана, который имеет как провал. Но я не могу использовать горизонтальную прокрутку внутри этого перфоратора. Он работает на устройствах iOS, только на стороне android.

nestedScrollEnabled prop не решил эту проблему.

import * as React from 'react';
import { Text, ScrollView, FlatList } from 'react-native';
import Constants from 'expo-constants';


export default function App() {
  return (
    <ScrollView nestedScrollEnabled={true} horizontal={true} style={{flex:1, alignItems: 'center' }}>
      <ScrollView nestedScrollEnabled={true} horizontal={true} style={{width: 200,}}>
        <Text style={{margin: 10}}>test1</Text>
        <Text style={{margin: 10}}>test2</Text>
        <Text style={{margin: 10}}>test3</Text>
        <Text style={{margin: 10}}>test4</Text>
        <Text style={{margin: 10}}>test5</Text>
        <Text style={{margin: 10}}>test6</Text>
        <Text style={{margin: 10}}>test7</Text>
      </ScrollView>
      <Text>
        Change code in the editor and watch it change on your phone! Save to get a shareable url.
      </Text>
    </ScrollView>
  );
}

Также вы можете проверить это в snack.expo. 10000 *https://snack.expo.io/tYAezkclc

1 Ответ

0 голосов
/ 09 апреля 2020
import * as React from 'react';
import { Text, View, StyleSheet, ScrollView, FlatList } from 'react-native';
import Constants from 'expo-constants';


export default function App() {
  return (
    <ScrollView style={{flex:1, alignItems: 'center', justifyContent: 'center' }}>
      <ScrollView nestedScrollEnabled={true} horizontal={true} style={{width: 200,}}>
        <Text style={{margin: 10}}>test1</Text>
        <Text style={{margin: 10}}>test2</Text>
        <Text style={{margin: 10}}>test3</Text>
        <Text style={{margin: 10}}>test4</Text>
        <Text style={{margin: 10}}>test5</Text>
        <Text style={{margin: 10}}>test6</Text>
        <Text style={{margin: 10}}>test7</Text>
      </ScrollView>
      <Text>
        Change code in the editor and watch it change on your phone! Save to get a shareable url.
      </Text>
    </ScrollView>
  );
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...