-
Notifications
You must be signed in to change notification settings - Fork 428
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(#722): revert not working back navigation gesture in favour of Pa…
…gerView inside ScrollView
- Loading branch information
Showing
4 changed files
with
71 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import * as React from 'react'; | ||
import { View, useWindowDimensions, Text, ScrollView } from 'react-native'; | ||
import { TabView, SceneMap } from 'react-native-tab-view'; | ||
import {Header} from 'react-native/Libraries/NewAppScreen'; | ||
|
||
function FirstRoute() { | ||
return ( | ||
<View style={{ flex: 1, padding: 20, backgroundColor: 'blue' }}> | ||
<Text style={{color: 'white'}}>First Route</Text> | ||
</View> | ||
); | ||
} | ||
|
||
function SecondRoute() { | ||
return ( | ||
<View style={{ flex: 1, padding: 20, backgroundColor: 'purple' }}> | ||
<Text style={{color: 'white'}}>Second Route</Text> | ||
</View> | ||
); | ||
} | ||
|
||
const renderScene = SceneMap({ | ||
first: FirstRoute, | ||
second: SecondRoute, | ||
}); | ||
|
||
const routes = [ | ||
{ key: 'first', title: 'First' }, | ||
{ key: 'second', title: 'Second' }, | ||
]; | ||
|
||
function Xd() { | ||
return <ScrollView contentContainerStyle={{flexGrow: 1, backgroundColor: 'red', height: 5000}} nestedScrollEnabled> | ||
<ScrollView | ||
contentContainerStyle={{flexGrow: 1, backgroundColor: 'blue', width: 1000, height: 300}} | ||
horizontal={true} | ||
> | ||
<Text>Test horizontal</Text> | ||
</ScrollView> | ||
</ScrollView> | ||
} | ||
|
||
export function NestedTabViewExample() { | ||
const layout = useWindowDimensions(); | ||
const [index, setIndex] = React.useState(0); | ||
|
||
return ( | ||
<ScrollView | ||
contentContainerStyle={{flexGrow: 1, backgroundColor: 'red'}} | ||
nestedScrollEnabled={false} | ||
scrollEnabled={true} | ||
> | ||
<Header /> | ||
|
||
<View> | ||
<TabView | ||
// TODO: Fix the height measurement for nested pager view | ||
style={{height: 5000}} | ||
navigationState={{ index, routes }} | ||
renderScene={renderScene} | ||
onIndexChange={setIndex} | ||
initialLayout={{ width: layout.width }} | ||
/> | ||
</View> | ||
</ScrollView> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters