leecade / leecade/react-native-swiper

Can not slide manually on ios

Open
#580 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Need answer from author
Dominant language
JavaScript
Stars
10.5k
Forks
2.3k
PR merge metrics
No merged PRs in 30d

Description

Which OS ?

ios

Version

Which versions are you using:

  • react-native-swiper v1.5.12
  • react-native v0.48.3
Expected behaviour
Actual behaviour

Can not slide manually

How to reproduce it>

import React, { Component } from 'react';
import {
StyleSheet,
Text,
TextInput,
View,
Dimensions,
Image,
TouchableHighlight,
TouchableWithoutFeedback,
PixelRatio
} from 'react-native';
import Icon from 'react-native-vector-icons/FontAwesome';
import Swiper from 'react-native-swiper';

const ptToPx = pt=>PixelRatio.getPixelSizeForLayoutSize(pt);
const pxToPt = px=>PixelRatio.roundToNearestPixel(px);

var {height, width} = Dimensions.get('window');

export default class ExpressionBox extends Component {
constructor(props) {
super(props);
this.onPressEmoji = this.onPressEmoji.bind(this);
}

onPressEmoji(emojiText){
this.props.setEmoji(emojiText,Date.now())
}
render(){

  return(
      <View style={styles.ThouchBarBoxBottomBox}>
      <Swiper style={styles.wrapper} showsButtons={false} activeDotColor={'#434343'} loop={false} >
         <View style={styles.swiperSlide}>
          <TouchableWithoutFeedback onPress={this.onPressEmoji.bind(this,'[呲牙]')}>
            <Image source={require('../../resource/sm.png')} style={styles.img}></Image>
          </TouchableWithoutFeedback>
          <TouchableWithoutFeedback onPress={this.onPressEmoji.bind(this,'[微笑]')}>
            <Image source={require('../../resource/weixiao.png')} style={styles.img}></Image>
          </TouchableWithoutFeedback>
          <TouchableWithoutFeedback onPress={this.onPressEmoji.bind(this,'[屎]')}>
            <Image source={require('../../resource/poo.png')} style={styles.img}></Image>
          </TouchableWithoutFeedback>
          <TouchableWithoutFeedback onPress={this.onPressEmoji.bind(this,'[微笑]')}>
            <Image source={require('../../resource/weixiao.png')} style={styles.img}></Image>
          </TouchableWithoutFeedback>
          <TouchableWithoutFeedback onPress={this.onPressEmoji.bind(this,'[呲牙]')}>
            <Image source={require('../../resource/sm.png')} style={styles.img}></Image>
          </TouchableWithoutFeedback>
          <TouchableWithoutFeedback onPress={this.onPressEmoji.bind(this,'[屎]')}>
            <Image source={require('../../resource/poo.png')} style={styles.img}></Image>
          </TouchableWithoutFeedback>
          <TouchableWithoutFeedback onPress={this.onPressEmoji.bind(this,'[呲牙]')}>
            <Image source={require('../../resource/sm.png')} style={styles.img}></Image>
          </TouchableWithoutFeedback>
          <TouchableWithoutFeedback onPress={this.onPressEmoji.bind(this,'[微笑]')}>
            <Image source={require('../../resource/weixiao.png')} style={styles.img}></Image>
          </TouchableWithoutFeedback>
        </View>
        <View style={styles.swiperSlide}>
          <TouchableWithoutFeedback onPress={()=>{alert('表情')}}>
            <Image source={require('../../resource/sm.png')} style={styles.img}></Image>
          </TouchableWithoutFeedback>
        </View>
        <View style={styles.swiperSlide}>
         <TouchableWithoutFeedback onPress={()=>{alert('表情')}}>
            <Image source={require('../../resource/sm.png')} style={styles.img}></Image>
          </TouchableWithoutFeedback>
        </View>
      </Swiper>
      <View style={styles.sendBox}>
        <TouchableWithoutFeedback onPress={this.props._onSubmitEditing}>
          <View style={[styles.send,{backgroundColor:this.props.textInputData?'#3399ff':'#fff'}]}>
            <Text style={styles.sendText}>发送</Text>
          </View>
        </TouchableWithoutFeedback>
      </View>
    </View>
    )
}

}

const styles = StyleSheet.create({
ThouchBarBoxBottomBox:{
height:230,
borderColor:'#ccc',
borderTopWidth:1
},
wrapper:{
flex:1,
},
swiperSlide:{
flex:1,
flexWrap:'wrap',
flexDirection:'row',
},
plusItemBox:{
width:pxToPt(60),
height:pxToPt(70),
marginTop:20,
marginHorizontal:(width-4*pxToPt(60))/8,
alignItems:'center',
},
plusItemImgBox:{
height:pxToPt(50),
width:pxToPt(50),
borderRadius:pxToPt(10),
borderColor:'#ccc',
borderWidth:pxToPt(1),
justifyContent:'center',
alignItems:'center'
},
img:{
height:pxToPt(25),
width:pxToPt(25),
resizeMode:'stretch',
margin:10
},
plusItemTit:{
fontSize:12,
color:'#bbb'
},
sendBox:{
height:40,
backgroundColor:'#fff',
flexDirection:'row',
justifyContent:'flex-end',
alignItems:'center',
},
send:{
width:60,
height:40,
justifyContent:'center',
alignItems:'center'
},
sendText:{
color:'#aaa'
}
});

Steps to reproduce

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided React Native reproduction and the Swiper component configured with loop={false} on iOS, using react-native-swiper v1.5.12 and React Native v0.48.3. Reproduce the inability to slide manually, then verify that the same example can move between its three slides by swiping on iOS.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, javascript, react-native
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.