Skip to content

Feat/stack aggregator #541

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Oct 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions demo/src/screens/MenuStructure.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const navigationData = {
{title: 'Pan Listener', tags: 'pan swipe drag listener', screen: 'unicorn.components.PanListenerScreen'},
{title: 'Pan Responder', tags: 'pan swipe drag responder', screen: 'unicorn.components.PanResponderScreen'},
{title: 'Shared Transition', tags: 'shared transition element', screen: 'unicorn.components.SharedTransitionScreen'},
{title: 'Stack Aggregator', tags: 'stack aggregator', screen: 'unicorn.components.StackAggregatorScreen'},
{title: 'TabBar', tags: 'tab bar', screen: 'unicorn.components.TabBarScreen'},
{title: 'Toast', tags: 'toast top bottom snackbar', screen: 'unicorn.components.ToastsScreen'},
{title: 'Wheel Picker Dialog', tags: 'wheel picker dialog', screen: 'unicorn.components.WheelPickerDialogScreen'},
Expand Down
15 changes: 5 additions & 10 deletions demo/src/screens/PlaygroundScreen.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
import _ from 'lodash';
import React, {Component} from 'react';
import {StyleSheet} from 'react-native';
import {Colors, View, Text} from 'react-native-ui-lib'; //eslint-disable-line
import {View, Text} from 'react-native-ui-lib'; //eslint-disable-line

export default class PlaygroundScreen extends Component {

constructor(props) {
super(props);
this.state = {};
}

componentDidMount() {}
export default class PlaygroundScreen extends Component {

render() {
return (
<View flex bg-dark80 center style={styles.container}>
<Text>Unicorn Playground Screen</Text>
<View center bg-dark80 flex>
<Text text50>Playground Screen</Text>
</View>
);
}
Expand Down
62 changes: 62 additions & 0 deletions demo/src/screens/componentScreens/StackAggregatorScreen.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import _ from 'lodash';
import React, {Component} from 'react';
import {ScrollView} from 'react-native';
import {/* Colors, Typography, */View, Text, Button, StackAggregator} from 'react-native-ui-lib'; //eslint-disable-line


const contents = [
'Lorem Ipsum is simply dummy text of the printing and typesetting industry.',
'Lorem Ipsum is simply dummy text of the printing and typesetting industry.',
'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum is simply dummy text of the printing and typesetting industry.',
'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum is simply dummy text of the printing and typesetting industry.'
]

export default class StackAggregatorScreen extends Component {

onItemPress = (index) => {
console.warn('item pressed: ', index);
}

onPress = (index) => {
console.warn('item\'s button pressed: ', index);
}

renderItem = (item, index) => {
return (
<View key={index} center padding-12>
<Button label={`${index}`} marginB-10 size={'small'} onPress={() => this.onPress(index)}/>
<Text>{contents[index]}</Text>
</View>
);
}

render() {
return (
<ScrollView bg-dark80 keyboardShouldPersistTaps={'handled'} showsVerticalScrollIndicator={false}>
<Text center dark40 text90 marginT-20>Thu, 10 Dec, 11:29</Text>
<StackAggregator
containerStyle={{marginTop: 12}}
onItemPress={this.onItemPress}
>
{_.map(contents, (item, index) => {
return this.renderItem(item, index);
})}
</StackAggregator>

<Text center dark40 text90 marginT-20>Thu, 11 Dec, 13:03</Text>
<StackAggregator
containerStyle={{marginTop: 12}}
onItemPress={this.onItemPress}
collapsed={false}
// contentContainerStyle={{backgroundColor: Colors.red30}}
// itemBorderRadius={10}
// buttonProps={{color: Colors.green30, labelStyle: {...Typography.text80, fontWeight: '500'}}}
>
{_.map(contents, (item, index) => {
return this.renderItem(item, index);
})}
</StackAggregator>
</ScrollView>
);
}
}
2 changes: 2 additions & 0 deletions demo/src/screens/componentScreens/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import WheelPickerDialogScreen from './WheelPickerDialogScreen';
import SliderScreen from './SliderScreen';
import FloatingButtonScreen from './FloatingButtonScreen';
import ColorPickerScreen from './ColorPickerScreen';
import StackAggregatorScreen from './StackAggregatorScreen';


Navigation.registerComponent('unicorn.components.ActionSheetScreen', () => ActionSheetScreen);
Expand Down Expand Up @@ -65,3 +66,4 @@ Navigation.registerComponent('unicorn.components.WheelPickerDialogScreen', () =>
Navigation.registerComponent('unicorn.components.SliderScreen', () => SliderScreen);
Navigation.registerComponent('unicorn.components.FloatingButtonScreen', () => FloatingButtonScreen);
Navigation.registerComponent('unicorn.components.ColorPickerScreen', () => ColorPickerScreen);
Navigation.registerComponent('unicorn.components.StackAggregatorScreen', () => StackAggregatorScreen);
3 changes: 3 additions & 0 deletions src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ module.exports = {
get SharedTransition() {
return require('./sharedTransition').default;
},
get StackAggregator() {
return require('./stackAggregator').default;
},

get Slider() {
return require('./slider').default;
Expand Down
Binary file added src/components/stackAggregator/assets/arrow-down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading