Skip to content

fix for orientation #501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions demo/src/screens/componentScreens/ActionBarScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ export default class ActionBarScreen extends Component {

constructor(props) {
super(props);
this.state = {currentPage: 0};

this.state = {
currentPage: 0
};
}

render() {
Expand All @@ -36,7 +39,7 @@ export default class ActionBarScreen extends Component {
actions={[
{label: 'Delete', onPress: () => Alert.alert('delete'), red30: true},
{label: 'Replace Photo', onPress: () => Alert.alert('replace photo')},
{label: 'Edit', onPress: () => Alert.alert('edit')},
{label: 'Edit', onPress: () => Alert.alert('edit')}
]}
/>
</View>
Expand All @@ -47,7 +50,7 @@ export default class ActionBarScreen extends Component {
actions={[
{label: 'Hide', onPress: () => Alert.alert('hide'), white: true},
{label: 'Add Discount', onPress: () => Alert.alert('add discount'), white: true},
{label: 'Duplicate', onPress: () => Alert.alert('duplicate'), white: true},
{label: 'Duplicate', onPress: () => Alert.alert('duplicate'), white: true}
]}
/>
</View>
Expand All @@ -71,7 +74,7 @@ export default class ActionBarScreen extends Component {
actions={[
{label: 'Bold', labelStyle: {color: Colors.dark10, ...Typography.text60, fontWeight: '400'}},
{label: 'Italic', text60: true, labelStyle: {fontStyle: 'italic', color: Colors.dark10}},
{label: 'Link', text60: true, labelStyle: {textDecorationLine: 'underline', color: Colors.dark10}},
{label: 'Link', text60: true, labelStyle: {textDecorationLine: 'underline', color: Colors.dark10}}
]}
/>
</View>
Expand All @@ -98,8 +101,8 @@ const styles = StyleSheet.create({
},
absoluteContainer: {
position: 'absolute',
bottom: 70,
bottom: 80,
left: 0,
right: 0,
},
right: 0
}
});
10 changes: 5 additions & 5 deletions src/components/carousel/CarouselPresenter-Deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function getDirectionOffset(offset, props) {
let fixedOffset = offset;

if (Constants.isRTL && Constants.isAndroid) {
const {loop, pageWidth} = props;
const {loop, pageWidth = Constants.screenWidth} = props;
const totalWidth = ((getChildrenLength(props) - 1) + (loop ? 2 : 0)) * pageWidth;
fixedOffset = Math.abs(totalWidth - offset);
}
Expand All @@ -21,7 +21,7 @@ export function getChildrenLength(props) {

export function calcOffset(props, state) {
const {currentPage} = state;
const {pageWidth, loop} = props;
const {pageWidth = Constants.screenWidth, loop} = props;

const actualCurrentPage = loop ? currentPage + 1 : currentPage;

Expand All @@ -33,7 +33,7 @@ export function calcOffset(props, state) {

export function calcPageIndex(offset, props) {
const pagesCount = getChildrenLength(props);
const {pageWidth, loop} = props;
const {pageWidth = Constants.screenWidth, loop} = props;
const pageIndexIncludingClonedPages = Math.round(offset / pageWidth);

let actualPageIndex;
Expand All @@ -47,7 +47,7 @@ export function calcPageIndex(offset, props) {
}

export function isOutOfBounds(offset, props) {
const {pageWidth} = props;
const {pageWidth = Constants.screenWidth} = props;
const length = getChildrenLength(props);
const minLimit = 1;
const maxLimit = ((length + 1) * pageWidth) - 1;
Expand All @@ -57,7 +57,7 @@ export function isOutOfBounds(offset, props) {

// todo: need to support more cases of page width in loop mode
export function calcCarouselWidth(props) {
const {pageWidth, loop} = props;
const {pageWidth = Constants.screenWidth, loop} = props;
let length = getChildrenLength(props);
length = loop ? length + 2 : length;
return pageWidth * length;
Expand Down
7 changes: 1 addition & 6 deletions src/components/carousel/carousel-Deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ export default class CarouselDeprecated extends BaseComponent {
};

static defaultProps = {
initialPage: 0,
pageWidth: Constants.screenWidth
initialPage: 0
};

constructor(props) {
Expand All @@ -67,10 +66,6 @@ export default class CarouselDeprecated extends BaseComponent {
this.styles = createStyles(this.props);
}

get pageWidth() {
return Math.floor(this.props.pageWidth);
}

updateOffset = (animated = false) => {
const x = presenter.calcOffset(this.props, this.state);

Expand Down