question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

It is not working on android

See original GitHub issue

Which OS ?

Windows

Version

10 Which versions are you using:

  • react-native-swiper v1.5.13
  • react-native v0.55

Expected behaviour

Expect to load a sliding carousel on android

Actual behaviour

displays this weird screen screenshot_20180503-142443

How to reproduce it-

import React from "react";
import {
    Dimensions,
    View,
    StyleSheet,
    Text,
    Platform
} from "react-native";
import Swiper from "react-native-swiper";

class Splash extends React.Component {
  render() {
        return (
            <View style={styles.container}>
              <View style={{height: 200,alignItems:'flex-start'}}> 
               <Swiper
                 showsButtons={false}
                 loop={false}
                 >
                <View style={styles.container}>
                  <Text>
                    Fun
                  </Text>
                </View>
                <View style={styles.container}>
                  <Text>
                    play,chat,have fun
                  </Text>
                </View>
              </Swiper>
             </View>
            </View>
        );
    }
}
export default Splash;
const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

Steps to reproduce

Try running on expo

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:18

github_iconTop GitHub Comments

27reactions
stevulacommented, Jul 12, 2018

For me it was not working when <Swiper>'s parent had alignItems: 'center'. It worked fine when I removed that property. If it’s relevant, the parent was an <ImageBackground> element with the following styles:

{
    flex: 1,
    justifyContent: 'flex-start',
    alignItems: 'center',
  }

It worked fine when I changed the parent styles to this:

{
    height: '100%',
    width: '100%',
}

But it also worked when I just commented out the alignItems rule I had originally.

TLDR: just remove alignItems: 'center' from the parent element.

3reactions
cngerucommented, May 7, 2018

The only thing that seems to work is by wrapping the Swiper Component <Swiper></Swiper> with ScrollView instead of View

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix an installed Android app that isn't working
Step 1: Restart & update ... Important: Settings can vary by phone. For more info, contact your device manufacturer. On most phones, press...
Read more >
are my apps not working on my Android phone
How to fix android apps not working · Reboot your phone · Update or roll back Android System WebView app · Check and...
Read more >
Top 8 Ways to Fix Apps Won't Open on Android
App glitches, corrupted cache data, and outdated Android OS are prominent reasons behind the apps not opening on Android.
Read more >
Your Android Phone or Tablet Won't Turn On? 6 Ways to Fix
Check Your Connections. Firstly, check the obvious points. · Dirt and Dust. Next, ensure there's no dust, dirt, or other gunk clogging up...
Read more >
Android Apps Not Working? Try These Fixes
Possible Fixes for Unresponsive Android Apps · Roll Back to an Older Version of the App · Uninstall Android System WebView Updates ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found