Giter Club home page Giter Club logo

react-native-swiper's Issues

Doesn't fit inside container unless width/height are hard-coded

I'd like the Swiper to take up the full size of its parent View element. Approaches:

  1. If I don't specify width and height attributes, the Swiper element extends outside the parent container to full-screen (gets size from device properties?).
  2. Styling the container doesn't appear to have any effect.
  3. If I hard-code width and height attributes it will sit inside the container, but I don't want to hard-code these numbers.

If the container is indeed flex:1, I'd expect it to expand to the parent container size rather than the full screen dimensions. Is there a way to achieve this?

Index not updating

Hello.

I've bound onMomentumScrollEnd and there I'm console logging the ref to my Swiper.
The state.index is always set to 0.

Is that a bug or is there another way to find out which node is viewed?

Initial index not working?

Hi
I cannot set the initial index. It always shows the first page. What is wrong?

Thank you
Bernd

In this example I expect the page at index 3 to be the visible at startup, but it is not :(

    render() {
        return (
            <Swiper showsButtons={false} index={3}>
                {this.props.route.approvalIds.map(function (approvalId, pageIndex) {
                    return (
                        <View style={{flex: 1}} key={pageIndex}>
                            <Approval approvalId={approvalId} pageIndex={pageIndex} pageCount={this.props.route.approvalIds.length} />
                        </View>
                    );
                }.bind(this))}
            </Swiper>
        );
    }

Tiny docs update

Hey, I think that given the loop attribute is true by default, the docs should say

Set to false to disable continuous loop mode.

instead of

Set to true to enable continuous loop mode.

:)

WebView overrides horizontal scrolling

Is there a way to navigate to the next page when the user is still scrolling left or right but there's nothing more to scroll inside a webview ?

Thanks

Auto play issue when only a child view

Your code in autoplay function:

if (!this.props.autoplay || this.state.isScrolling || this.state.autoplayEnd) {
  return;
}

should be:

if (!Array.isArray(this.props.children) || !this.props.autoplay || this.state.isScrolling || this.state.autoplayEnd) {
  return;
}

or the child view will fly away.

Xcode 7.0 command and /bin/sh failed with exit code 1

When I require swiper in my index.ios.js,the project occupy run failed.but when i download the examples and run it. it success I'm confuse about this,whether I should require other modules? It's very thankful if you can response me and help me clear what happen.
ar Swiper = require('react-native-swiper')
// es6
// import Swiper from 'react-native-swiper'

var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
View,
} = React;

var styles = StyleSheet.create({
wrapper: {
},
slide1: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#9DD6EB',
},
slide2: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#97CAE5',
},
slide3: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#92BBD9',
},
text: {
color: '#fff',
fontSize: 30,
fontWeight: 'bold',
}
})

var swiper = React.createClass({
render: function() {
return (


Hello Swiper


Beautiful


And simple


)
}
})

AppRegistry.registerComponent('ProjectName, () => swiper)

Memory Leak with 100-page slider (and images)

I have a slider that swipes through about 100 1/2-page images. It looks great, and works great on the simuator. However, when I run it live it runs for a few seconds, and then crashes with the below error in XCode:

Terminated due to memory error
And in the Output on XCode: Received memory warning.

On my end, I'm building out the jsx dynamically (I loop over my list of items and make jsx for each using items.map).

I'm not sure why it's causing it to crash. Has anyone else seen this?

Adding and removing pages

Is there a way to add pages, like adding rows to a list view?

When I try to do this naively by rendering a new child view in the Swiper the new views all show up on the last page instead of creating new pages.

Display parts of previous and next slides/pages

Is it possible to use this component to display parts of the previous and next slides in the carousel, without changing the source? I.e. have the current page in the center and show a couple of pixels of the previous slide to the left and couple of pixels of the next slide to the right?

Dynamic Items

I'm loading remote data and then setup my views, but when I generate them dynamically it stacks them on a single screen. It looks like its grabbing the children in getInitialState() and they aren't available yet. When render() runs the children are there, but the total is set to 1.

WebView scrolls up, sometimes

Hello.

When swiping between a few WebViews, the non focused webview scrolls up to top and flicks back to the last scroll positions shortly after the slide gets in position.
This happens about 50% of the time. And only if I swipe between more than two WebView slides.
(Have only tried this in iOS Simulator)

Landscape mode

Great module! Any pointers on how to get it working when changing the device orientation to landscape?

scroll has a little problem

I use swiper and inside embedded a ListView, when I first upwards sliding ListView, no problem, but before the end of the sliding effect no I loosen the fingers, sliding again, ListView can't slide, can only wait for it to stop, to continue to slide, not straight, I do not have this problem using a ListView alone, how to solve?

Git repo is ahead of npm module and non-functional

Please correct me if I'm wrong, but it appears that a recent commit has made the swiper non-functional. The npm module is dated '5 months ago', but there are a number of commits past that on the master github branch. My slides just stack vertically instead of being swipeable. Is it possible or reasonable to move recent commits to a branch and sync the master branch with what's on npm?

WebView inside swiper reloads

I'm using a Swiper to wrap a couple of WebViews.
But each time I swipe, the WebView reloads (and scrolls to the top).

Only iOS?

Hi,

I would like to use your component in an Android app, is it possible?

Thank you for your hard work.

J

Unable to resolve module Dimensions from

Hello,

I get the following warning in the packager:

Unable to resolve module Dimensions from .... dist.js

Any idea how to fix that? Everything is working correctly, just the message in the packager.

Regards

scrollTo() breaks after attempting to swipe to cell before first

Title says it all really. If I have a swiper that has 4 slides and on the first slide I have button that call scrollTo(index) they all work but it I then swipe back to the start and try to swipe one extra slide before the start then scrollTo(index) stops working. Manually swiping to the second slide and back again corrects the issue.

Performance optimization concerning huge pages

Hello,

first of all: thanks a lot for this nice swiper! I'm currently using it for about 20 pages, each of the pages being quite big. Is there any way to optimize the rendering (e.g. render only some pages next to the currently active page), as the initial loading is taking about 3 seconds in my case at the moment.

Regards
Philipp

Example Error

I just tried your example and I get this error in the console.

"Warning: Failed propType: Invariant Violation: index: prop type renderPagination is invalid; it must be a function, usually from React.PropTypes. "

I'm following your "Basic usage" in the readme.md so I'm not passing anything to renderPagination. I wonder if it's in your lib code?

Issue rendering dynamic data, stacked 'slides'

The swiper is working great for us when we create slides that contain static stuff:

i.e.
< swiper >
< view >stuff< /view >
< view >stuff< /view >
< view >stuff< /view >
< /swiper >

However, when we loop in dynamic content for the list of interior views like so:

< swiper >
{ slideLoop }
< /swiper >

all of the views render vertically stacked within the first 'slide', instead of each displaying as a slide as you'd expect. Has anyone experienced issues like this?

Thanks

Installation gives ENOENT for Babel

I get the following error when running npm install react-native-swiper --save:

$ npm install react-native-swiper --save
npm ERR! Darwin 14.3.0
npm ERR! argv "node" "/usr/local/nvm/versions/node/v0.12.2/bin/npm" "install" "react-native-swiper" "--save" "--production"
npm ERR! node v0.12.2
npm ERR! npm  v2.8.3
npm ERR! path /Users/jwaples/Repositories/Lemmeno/LemmenoNative/node_modules/react-native-swiper/bin/babel
npm ERR! code ENOENT
npm ERR! errno -2

npm ERR! enoent ENOENT, chmod '/Users/jwaples/Repositories/Lemmeno/LemmenoNative/node_modules/react-native-swiper/bin/babel'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/jwaples/Repositories/Lemmeno/LemmenoNative/npm-debug.log

This occurs both with Node 0.12.2 and Node 0.10.36, with or without the --production flag to NPM.

Changing height due to statusbar change

Hi,

I'm currently facing the issue that I try to update the height of the swiper dynamically when the status bar height changes e.g. due to tethering etc. However, I dont really know how to give the new height to the swiper element as it seems to set the props in the getInitialState

Any idea?

Regards
Philipp

Dynamic slides are breaking app in some cases

When using single app state and keeping currentSlideItem in a store, every time we update them, the componentWillReceiveProps re-renders the whole slider resetting the index. It makes sliding impossible. I believe there should be one extra check to ensure the children are different and reset only if that happens. Maybe shallowEqual on the array + support for Immutable list can do the trick?

scrollTo method

Hi,

I looked into your code to use it with tabs, the scrollTo(index) method was great but is bugged. You should get rid of the this.state.index which has nothing to do here. This took me so much time to find the problem so I share it !

Pagination warning (missed keys)

Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of index. It was passed a child from ProfilePictures. See https://fb.me/react-warning-keys for more information.
reactConsoleError @ ExceptionsManager.js:83
warning @ warning.js:42
validateExplicitKey @ ReactElementValidator.js:104
validateChildKeys @ ReactElementValidator.js:203
ReactElementValidator.createElement @ ReactElementValidator.js:338
renderPagination @ index.js:347
render @index.js:494
ReactCompositeComponentMixin._renderValidatedComponentWithoutOwnerOrContext @ ReactCompositeComponent.js:715ReactCompositeComponentMixin._renderValidatedComponent @ ReactCompositeComponent.js:737ReactPerf.measure.wrapper @ ReactPerf.js:70ReactCompositeComponentMixin.mountComponent @ ReactCompositeComponent.js:234ReactPerf.measure.wrapper @ ReactPerf.js:70ReactReconciler.mountComponent @ ReactReconciler.js:37ReactMultiChild.Mixin._mountChildByNameAtIndex @ ReactMultiChild.js:400ReactMultiChild.Mixin._updateChildren @ ReactMultiChild.js:306ReactMultiChild.Mixin.updateChildren @ ReactMultiChild.js:251ReactNativeBaseComponent.Mixin.receiveComponent @ ReactNativeBaseComponent.js:209ReactReconciler.receiveComponent @ ReactReconciler.js:94ReactCompositeComponentMixin._updateRenderedComponent @ ReactCompositeComponent.js:675ReactCompositeComponentMixin._performComponentUpdate @ ReactCompositeComponent.js:654ReactCompositeComponentMixin.updateComponent @ ReactCompositeComponent.js:564ReactPerf.measure.wrapper @ ReactPerf.js:70ReactCompositeComponentMixin.receiveComponent @ ReactCompositeComponent.js:463ReactReconciler.receiveComponent @ ReactReconciler.js:94ReactCompositeComponentMixin._updateRenderedComponent @ ReactCompositeComponent.js:675ReactCompositeComponentMixin._performComponentUpdate @ ReactCompositeComponent.js:654ReactCompositeComponentMixin.updateComponent @ ReactCompositeComponent.js:564ReactPerf.measure.wrapper @ ReactPerf.js:70ReactCompositeComponentMixin.receiveComponent @ ReactCompositeComponent.js:463ReactReconciler.receiveComponent @ ReactReconciler.js:94ReactChildReconciler.updateChildren @ ReactChildReconciler.js:83ReactMultiChild.Mixin._updateChildren @ ReactMultiChild.js:277ReactMultiChild.Mixin.updateChildren @ ReactMultiChild.js:251ReactNativeBaseComponent.Mixin.receiveComponent @ ReactNativeBaseComponent.js:209ReactReconciler.receiveComponent @ ReactReconciler.js:94ReactCompositeComponentMixin._updateRenderedComponent @ ReactCompositeComponent.js:675ReactCompositeComponentMixin._performComponentUpdate @ ReactCompositeComponent.js:654ReactCompositeComponentMixin.updateComponent @ ReactCompositeComponent.js:564ReactPerf.measure.wrapper @ ReactPerf.js:70ReactCompositeComponentMixin.receiveComponent @ ReactCompositeComponent.js:463ReactReconciler.receiveComponent @ ReactReconciler.js:94ReactChildReconciler.updateChildren @ ReactChildReconciler.js:83ReactMultiChild.Mixin._updateChildren @ ReactMultiChild.js:277ReactMultiChild.Mixin.updateChildren @ ReactMultiChild.js:251ReactNativeBaseComponent.Mixin.receiveComponent @ ReactNativeBaseComponent.js:209ReactReconciler.receiveComponent @ ReactReconciler.js:94ReactCompositeComponentMixin._updateRenderedComponent @ ReactCompositeComponent.js:675ReactCompositeComponentMixin._performComponentUpdate @ ReactCompositeComponent.js:654ReactCompositeComponentMixin.updateComponent @ ReactCompositeComponent.js:564ReactPerf.measure.wrapper @ ReactPerf.js:70ReactCompositeComponentMixin.receiveComponent @ ReactCompositeComponent.js:463ReactReconciler.receiveComponent @ ReactReconciler.js:94ReactChildReconciler.updateChildren @ ReactChildReconciler.js:83ReactMultiChild.Mixin._updateChildren @ ReactMultiChild.js:277ReactMultiChild.Mixin.updateChildren @ ReactMultiChild.js:251ReactNativeBaseComponent.Mixin.receiveComponent @ ReactNativeBaseComponent.js:209ReactReconciler.receiveComponent @ ReactReconciler.js:94ReactCompositeComponentMixin._updateRenderedComponent @ ReactCompositeComponent.js:675ReactCompositeComponentMixin._performComponentUpdate @ ReactCompositeComponent.js:654ReactCompositeComponentMixin.updateComponent @ ReactCompositeComponent.js:564ReactPerf.measure.wrapper @ ReactPerf.js:70ReactCompositeComponentMixin.receiveComponent @ ReactCompositeComponent.js:463ReactReconciler.receiveComponent @ ReactReconciler.js:94ReactCompositeComponentMixin._updateRenderedComponent @ ReactCompositeComponent.js:675ReactCompositeComponentMixin._performComponentUpdate @ ReactCompositeComponent.js:654ReactCompositeComponentMixin.updateComponent @ ReactCompositeComponent.js:564ReactPerf.measure.wrapper @ ReactPerf.js:70ReactCompositeComponentMixin.receiveComponent @ ReactCompositeComponent.js:463ReactReconciler.receiveComponent @ ReactReconciler.js:94ReactCompositeComponentMixin._updateRenderedComponent @ ReactCompositeComponent.js:675ReactCompositeComponentMixin._performComponentUpdate @ ReactCompositeComponent.js:654ReactCompositeComponentMixin.updateComponent @ ReactCompositeComponent.js:564ReactPerf.measure.wrapper @ ReactPerf.js:70ReactCompositeComponentMixin.receiveComponent @ ReactCompositeComponent.js:463ReactReconciler.receiveComponent @ ReactReconciler.js:94ReactCompositeComponentMixin._updateRenderedComponent @ ReactCompositeComponent.js:675ReactCompositeComponentMixin._performComponentUpdate @ ReactCompositeComponent.js:654ReactCompositeComponentMixin.updateComponent @ ReactCompositeComponent.js:564ReactPerf.measure.wrapper @ ReactPerf.js:70ReactCompositeComponentMixin.performUpdateIfNecessary @ ReactCompositeComponent.js:490ReactReconciler.performUpdateIfNecessary @ ReactReconciler.js:112runBatchedUpdates @ ReactUpdates.js:149Mixin.perform @ Transaction.js:140Mixin.perform @ Transaction.js:140assign.perform @ ReactUpdates.js:93flushBatchedUpdates @ ReactUpdates.js:173ReactPerf.measure.wrapper @ ReactPerf.js:70Mixin.closeAll @ Transaction.js:213Mixin.perform @ Transaction.js:154ReactDefaultBatchingStrategy.batchedUpdates @ ReactDefaultBatchingStrategy.js:66enqueueUpdate @ ReactUpdates.js:206enqueueUpdate @ ReactUpdateQueue.js:24ReactUpdateQueue.enqueueSetState @ ReactUpdateQueue.js:233ReactComponent.setState @ ReactComponent.js:72altSetState @ mixinContainer.js:134(anonymous function) @ transmitter.js:21push @ transmitter.js:20StoreModel.emitChange @ AltStore.js:49(anonymous function) @ AltStore.js:97Dispatcher.$Dispatcher_invokeCallback @ Dispatcher.js:220Dispatcher.dispatch @ Dispatcher.js:195(anonymous function) @ index.js:74Alt.batchingFunction @ index.js:56dispatch @ index.js:72dispatch @ index.js:38dispatchIdentity @ AltUtils.js:56action @ index.js:61fire @ StoreMixin.js:79StoreMixin.registerAsync.Object.keys.reduce.publicMethods.(anonymous function).makeActionHandler @ StoreMixin.js:84tryCallOne @ core.js:37(anonymous function) @ core.js:103JSTimers.setImmediate.JSTimersExecution.callbacks.(anonymous function) @ JSTimers.js:79JSTimersExecution.callTimer @ JSTimersExecution.js:68JSTimersExecution.callImmediates @ JSTimersExecution.js:117(anonymous function) @ MessageQueue.js:107guard @ MessageQueue.js:39flushedQueue @ MessageQueue.js:107processBatch @ MessageQueue.js:92messageHandlers.executeJSCall @ debugger-ui:66ws.onmessage @ debugger-ui:93

Callbacks for each slide

There should be away to execute code based on if you are currently on a certain slider. This could be a prop called onView or something that receives a callback function.

Use case:
There are multiple slides in the swiper. On the last slide, you can auto-focus on a text field at the same time onMomentumScrollEnd is called

Show numbers instead of dots?

Great component! It would be good to have X/Y (X current page / Y total pages) customizable label string instead of dots for big lists.

ScrollResponders are not supported

ScrollResponders are documented in the readme, but onMomentumScrollEnd along with the other responders throw invalid property errors when added to a Swiper.

Support for Android

I am planning to use this module for a project and would like to know if this works on Android. All the components used in this repo does not have 'IOS' suffix to it, so I believe it should be fine. :)

Warning in console about key prop for pagination

I noticed that the code that generates the dots is looping without a key prop on the component which leads to this warning, no biggie just thought I would share.

"Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of index. It was passed a child from SignDetail. See http://fb.me/react-warning-keys for more information."

Allow a prop to update (and animate to) a new active index

Hello,

I'd like to allow the parent component of the slider to update the current index of the pager and have it animate to that page. Right now it doesn't seem to do that.

I've tried to tweak the code a bit in order to do this using the componentWillReceiveProps lifecycle method, but I can't seem to get it to work.

Anyway, if you could add this, that would be great.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.