mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-05-22 08:01:56 +08:00
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:
@@ -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',
|
||||
}}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user