Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import React, {Component} from 'react';
import {StyleSheet} from 'react-native';
import {Constants, View, Text, Carousel, Image, Card} from 'react-native-ui-lib'; // eslint-disable-line
import _ from 'lodash';
const INITIAL_PAGE = 2;
const WIDTH = Constants.screenWidth - 120;
const IMAGES = [
'https://images.pexels.com/photos/1212487/pexels-photo-1212487.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260',
'https://images.pexels.com/photos/1366630/pexels-photo-1366630.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500',
'https://images.pexels.com/photos/1477459/pexels-photo-1477459.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260',
'https://images.pexels.com/photos/60597/dahlia-red-blossom-bloom-60597.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260'
];
class CarouselScreen extends Component {
state = {
currentPage: INITIAL_PAGE
};
onChangePage(index) {
this.setState({currentPage: index});
}
}}
numOfPages={2}
currentPage={this.state.currentPage}
/>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
},
pageView: {
width: Constants.screenWidth,
height: Constants.screenHeight,
},
});
const backgroundColor = selectedColor === 'none' ? undefined : selectedColor;
const action = showLoader ? [{label: 'Undo', backgroundColor: Colors.red40, onPress: () => Alert.alert('undo')}] : [];
return (
renderHeader() {
return (
setTimeout(() => {
this.setState({rightPanelWidth: Constants.screenWidth - 40});
}, 100);
this.rightPanel = !this.rightPanel;
<button label="Show Toast" size="medium"> this.setState({showToast: true})} />
this.setState({showToast: false})}
visible={this.state.showToast}
/>
</button><button label="Show Toast" size="medium"> this.setState({showToast: true})}/>
</button>
setCurrentPage(offsetX) {
if (offsetX >= 0) {
this.setState({
currentPage: Math.floor(offsetX / Constants.screenWidth),
});
}
}
size={15}
/>
);
}
}
const styles = StyleSheet.create({
page: {
width: Constants.screenWidth,
flex: 1,
},
pageControl: {
position: 'absolute',
bottom: 70,
width: Constants.screenWidth,
},
});