import React, {Component} from 'react';
import {StyleSheet, ScrollView} from 'react-native';
import {Marquee, MarqueeDirections, Text, View, Spacings} from 'react-native-ui-lib';
import {renderBooleanOption, renderMultipleSegmentOptions} from '../ExampleScreenPresenter';
export default class MarqueeScreen extends Component<{}> {
state = {
duration: 5000,
directionHorizontal: true,
directionVertical: true,
numOfReps: -1
};
renderHorizontalSection = () => {
const {directionHorizontal, numOfReps, duration} = this.state;
return (
Horizontal
Marquee: {directionHorizontal ? MarqueeDirections.LEFT : MarqueeDirections.RIGHT}
);
};
renderVerticalSection = () => {
const {directionVertical, numOfReps, duration} = this.state;
return (
Vertical
Marquee: {directionVertical ? MarqueeDirections.UP : MarqueeDirections.DOWN}
);
};
render() {
return (
Marquee
{renderMultipleSegmentOptions.call(this, 'Duration (optional)', 'duration', [
{label: '3000', value: 3000},
{label: '5000', value: 5000},
{label: '10000', value: 10000}
])}
{renderMultipleSegmentOptions.call(this, 'Number Of Reps', 'numOfReps', [
{label: 'Infinite', value: -1},
{label: '1', value: 1},
{label: '3', value: 3},
{label: '5', value: 5}
])}
{renderBooleanOption.call(this, 'Direction Horizontal: Left To Right/Right To Left', 'directionHorizontal')}
{renderBooleanOption.call(this, 'Direction Vertical: Bottom To Up/Up To Bottom', 'directionVertical')}
{this.renderHorizontalSection()}
{this.renderVerticalSection()}
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
padding: 20
},
containerHorizontal: {
borderWidth: 1,
borderColor: 'black',
marginVertical: Spacings.s2
},
horizontal: {width: 200},
vertical: {width: 250, height: 100, alignItems: 'center'},
containerVertical: {borderWidth: 1, borderColor: 'black', marginVertical: Spacings.s2},
label: {alignSelf: 'center'}
});