-
Notifications
You must be signed in to change notification settings - Fork 717
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
391 additions
and
175 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
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
68 changes: 68 additions & 0 deletions
68
demo/src/screens/componentScreens/TabControllerWithStickyHeaderScreen.tsx
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,68 @@ | ||
import React, {Component} from 'react'; | ||
import {ScrollView} from 'react-native'; | ||
import {View, Text, Card, Image, TabController} from 'react-native-ui-lib'; | ||
import _ from 'lodash'; | ||
|
||
const IMAGE_URL = | ||
'https://images.pexels.com/photos/1598505/pexels-photo-1598505.jpeg?auto=compress&cs=tinysrgb&w=500&dpr=1'; | ||
const items = [ | ||
{key: 'tab1', label: 'Tab 1'}, | ||
{key: 'tab2', label: 'Tab 2'} | ||
]; | ||
|
||
export default class TabControllerWithStickyHeaderScreen extends Component { | ||
renderHeader = () => { | ||
return ( | ||
<View bg-red30 height={280} bottom> | ||
<Image source={{uri: IMAGE_URL}} style={{flex: 1}}/> | ||
</View> | ||
); | ||
}; | ||
|
||
renderTab1 = () => { | ||
return ( | ||
<View bg-green80 paddingT-s5> | ||
{_.times(7, i => { | ||
return ( | ||
<Card key={i} height={100} marginB-s5 marginH-s5 center> | ||
<Text text40>item {i}</Text> | ||
</Card> | ||
); | ||
})} | ||
</View> | ||
); | ||
}; | ||
|
||
renderTab2 = () => { | ||
return ( | ||
<View bg-orange40 paddingT-s5> | ||
{_.times(15, i => { | ||
return ( | ||
<View key={i} height={100} marginB-s5 marginH-s5 center bg-orange60> | ||
<Text text40> item {i}</Text> | ||
</View> | ||
); | ||
})} | ||
</View> | ||
); | ||
}; | ||
|
||
render() { | ||
return ( | ||
<TabController items={items} nestedInScrollView> | ||
<ScrollView | ||
// stickyHeaderHiddenOnScroll | ||
stickyHeaderIndices={[1]} | ||
> | ||
{this.renderHeader()} | ||
<TabController.TabBar/> | ||
|
||
<View flex> | ||
<TabController.TabPage index={0}>{this.renderTab1()}</TabController.TabPage> | ||
<TabController.TabPage index={1}>{this.renderTab2()}</TabController.TabPage> | ||
</View> | ||
</ScrollView> | ||
</TabController> | ||
); | ||
} | ||
} |
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
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
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
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
Oops, something went wrong.