UNPKG

react-native-slider-intro

Version:

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

98 lines (97 loc) 2.79 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _react = _interopRequireDefault(require("react")); var _reactNative = require("react-native"); var _jsxRuntime = require("react/jsx-runtime"); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } const styles = _reactNative.StyleSheet.create({ wrapper: { marginTop: 10, flex: 1, flexDirection: 'column', justifyContent: 'space-around', alignItems: 'center', maxHeight: _reactNative.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: _reactNative.Dimensions.get('window').width, maxHeight: _reactNative.Dimensions.get('window').width }, link: { marginLeft: 20, marginRight: 20, fontSize: 15, color: '#2f39ff', textDecorationLine: 'underline', textAlign: 'center' } }); const deviceMaxHeight = _reactNative.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__*/(0, _jsxRuntime.jsx)(_reactNative.View, { style: [styles.slide, { backgroundColor }], children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, { style: [styles.wrapper, { height: slideHeight, maxHeight: slideHeight }], children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, { style: styles.title, children: Array.isArray(title) ? title[language] : title }), image && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Image, { style: styles.image, source: image }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, { children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, { style: styles.text, children: Array.isArray(text) ? text[language] : text }), link && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, { onPress: () => _reactNative.Linking.openURL(link), children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, { style: styles.link, children: link }) })] })] }) }, index); }; var _default = exports.default = Slide; //# sourceMappingURL=Slide.js.map