Use react-native's ScrollView rather than GH ScrollView on iOS - Due to: https://github.com/kmagiera/react-native-gesture-handler/issues/560

This commit is contained in:
Brent Vatne
2019-04-12 15:20:14 -07:00
parent 18b8a81672
commit 13706003c0
2 changed files with 18 additions and 6 deletions

View File

@@ -48,7 +48,9 @@ class LoremScreen extends React.Component {
onRefresh={this._onRefresh}
refreshing={this.state.refreshing}
renderItem={({ item }) => (
<Text style={{ marginVertical: 7 }}>{item.value}</Text>
<Text style={{ marginVertical: 7, marginHorizontal: 10 }}>
{item.value}
</Text>
)}
data={DATA}
ref={view => {
@@ -66,14 +68,16 @@ class LoremScreen extends React.Component {
onRefresh={this._onRefresh}
refreshing={this.state.refreshing}
renderItem={({ item }) => (
<Text style={{ marginVertical: 7 }}>{item.value}</Text>
<Text style={{ marginVertical: 7, marginHorizontal: 10 }}>
{item.value}
</Text>
)}
renderSectionHeader={({ section: { title } }) => (
<View
style={{
backgroundColor: '#fff',
paddingVertical: 8,
paddingHorizontal: 5,
paddingHorizontal: 10,
borderBottomWidth: 1,
borderBottomColor: '#eee',
}}

View File

@@ -1,10 +1,18 @@
import React from 'react';
import { FlatList, SectionList, RefreshControl } from 'react-native';
import { ScrollView } from 'react-native-gesture-handler';
import { ScrollView, Platform, FlatList, SectionList, RefreshControl } from 'react-native';
import { ScrollView as GHScrollView } from 'react-native-gesture-handler';
import createNavigationAwareScrollable from './createNavigationAwareScrollable';
import invariant from './utils/invariant';
const WrappedScrollView = createNavigationAwareScrollable(ScrollView);
let WrappedScrollView;
if (Platform.OS === 'android') {
// @todo: use GHScrollView again when
// https://github.com/kmagiera/react-native-gesture-handler/issues/560 has
// been fixed.
WrappedScrollView = createNavigationAwareScrollable(ScrollView);
} else {
WrappedScrollView = createNavigationAwareScrollable(GHScrollView);
}
function propsMaybeWithRefreshControl(props) {
const onRefresh = props.onRefresh;