• You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

Anyone knows react-native here?

Jg_selisa

Well-known member
Trusted Uploader
Feb 10, 2019
454
313
63
I am trying to achieve this
https://cdn-media-1.freecodecamp.org/images/1*mOSwlhVAq7PTzOuc1J-Hpg.gif


this is my current code that im trying to edit

import React from 'react';
import {connect} from 'react-redux';
import {withTranslation} from 'react-i18next';
import {
StyleSheet,
ScrollView,
View,
Image,
Animated,
Dimensions,
} from 'react-native';
import {Text} from 'src/components';
import Container from './Container';
import Pagination from './Pagination';
import {languageSelector} from 'src/modules/common/selectors';
import {margin} from 'src/components/config/spacing';
const {width} = Dimensions.get('window');
const WIDTH_IMAGE = width;
const HEIGHT_IMAGE = (WIDTH_IMAGE * 390) / 375;
const data = [
{
image: require('src/assets/images/getting-start/get-start-1.png'),
title: {
en: 'Shopping Smart',
ar: 'التسوق الذكي',
},
subtitle: {
en: 'Bienvenido a C-lina Esthetic & Spa',
ar: 'مرحبًا بكم في متجر OREO',
},
},
{
image: require('src/assets/images/getting-start/get-start-2.png'),
title: {
en: 'Focus UX',
ar: 'التركيز UX',
},
subtitle: {
en: 'Personalization of User Experience',
ar: 'إضفاء الطابع الشخصي على تجربة المستخدم',
},
},
{
image: require('src/assets/images/getting-start/get-start-3.png'),
title: {
en: 'Creative Concept',
ar: 'مفهوم الإبداعي',
},
subtitle: {
en: 'Discovering new horizons',
ar: 'اكتشاف آفاق جديدة',
},
},
];
class GetStartSwiper extends React.Component {
constructor(props) {
super(props);
this.state = {scrollX: new Animated.Value(0), height: 0};
}
render() {
const {t} = this.props;
const {scrollX} = this.state;
const position = Animated.divide(scrollX, width);
const data = [
{
image: require('src/assets/images/getting-start/get-start-1.png'),
title: t('getting:text_title_1'),
subtitle: t('getting:text_subtitle_1'),
},
{
image: require('src/assets/images/getting-start/get-start-2.png'),
title: t('getting:text_title_2'),
subtitle: t('getting:text_subtitle_2'),
},
{
image: require('src/assets/images/getting-start/get-start-3.png'),
title: t('getting:text_title_3'),
subtitle: t('getting:text_subtitle_3'),
},
];
return (
<ScrollView style={styles.container}>
<ScrollView
horizontal={true}
pagingEnabled={true}
showsHorizontalScrollIndicator={false}
onScroll={Animated.event([
{
nativeEvent: {
contentOffset: {x: scrollX},
},
},
])}
scrollEventThrottle={16}
{data.map((swiper, index) => (
<View key={index} style={styles.viewItem}>
<Image
source={swiper.image}
resizeMode="stretch"
style={styles.image}
/>
<Container style={styles.viewInfo}>
<Text h1 medium style={[styles.text, styles.title]}>
{swiper.title}
</Text>
<Text colorSecondary style={styles.text}>
{swiper.subtitle}
</Text>
</Container>
</View>
))}
</ScrollView>
<Pagination
type="animated"
activeVisit={position}
count={data.length}
containerStyle={styles.viewPagination}
/>
</ScrollView>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
image: {
width: WIDTH_IMAGE,
height: HEIGHT_IMAGE,
},
viewInfo: {
marginVertical: margin.big + margin.small,
},
text: {
textAlign: 'center',
},
title: {
marginBottom: margin.small,
},
viewPagination: {
marginTop: margin.small,
marginBottom: margin.big,
justifyContent: 'center',
},
});
export default withTranslation()(GetStartSwiper);
 
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock