UNPKG

react-native-slider-intro

Version:

A simple and full customizable React Native package which implements a unique slider.

93 lines (92 loc) 2.33 kB
"use strict"; import React from 'react'; import { Dimensions, Image, Linking, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; const styles = StyleSheet.create({ wrapper: { marginTop: 10, flex: 1, flexDirection: 'column', justifyContent: 'space-around', alignItems: 'center', maxHeight: Dimensions.get('window').height * 0.85 }, slide: { flex: 1, justifyContent: 'flex-start', alignItems: 'center' }, title: { fontSize: 24, color: 'white', textAlign: 'center' }, text: { marginLeft: 20, marginRight: 20, lineHeight: 24, fontSize: 15, color: 'white', textAlign: 'center' }, image: { maxWidth: Dimensions.get('window').width, maxHeight: Dimensions.get('window').width }, link: { marginLeft: 20, marginRight: 20, fontSize: 15, color: '#2f39ff', textDecorationLine: 'underline', textAlign: 'center' } }); const deviceMaxHeight = Dimensions.get('screen').height; const Slide = ({ item }) => { const { activeLanguage, slideMaxHeightPercent, index, backgroundColor, title, image, text, link } = item; const language = activeLanguage || 'en'; const slideHeight = deviceMaxHeight * (slideMaxHeightPercent || 0.78); return /*#__PURE__*/_jsx(View, { style: [styles.slide, { backgroundColor }], children: /*#__PURE__*/_jsxs(View, { style: [styles.wrapper, { height: slideHeight, maxHeight: slideHeight }], children: [/*#__PURE__*/_jsx(Text, { style: styles.title, children: Array.isArray(title) ? title[language] : title }), image && /*#__PURE__*/_jsx(Image, { style: styles.image, source: image }), /*#__PURE__*/_jsxs(View, { children: [/*#__PURE__*/_jsx(Text, { style: styles.text, children: Array.isArray(text) ? text[language] : text }), link && /*#__PURE__*/_jsx(TouchableOpacity, { onPress: () => Linking.openURL(link), children: /*#__PURE__*/_jsx(Text, { style: styles.link, children: link }) })] })] }) }, index); }; export default Slide; //# sourceMappingURL=Slide.js.map