Authored by chenl

启用了android优化的ViewPager。review by liben。

... ... @@ -280,7 +280,6 @@ export default class extends Component {
* @param {object} e native event
*/
onScrollEnd = e => {
console.log('onPageSelected');
// update scroll state
this.internals.isScrolling = false
... ... @@ -395,7 +394,6 @@ export default class extends Component {
if (state.dir === 'x') x = diff * state.width
if (state.dir === 'y') y = diff * state.height
console.log('xxxxx scrollBy diff=' + diff);
if (Platform.OS === 'android') {
this.refs.scrollView && this.refs.scrollView[animated ? 'setPage' : 'setPageWithoutAnimation'](diff)
} else {
... ... @@ -459,7 +457,7 @@ export default class extends Component {
let dots = []
const ActiveDot = this.props.activeDot || <View style={[{
backgroundColor: this.props.activeDotColor || '#007aff',
backgroundColor: this.props.activeDotColor || 'white',
width: 8,
height: 8,
borderRadius: 4,
... ... @@ -469,7 +467,7 @@ export default class extends Component {
marginBottom: 3
}, this.props.activeDotStyle]} />
const Dot = this.props.dot || <View style={[{
backgroundColor: this.props.dotColor || 'rgba(0,0,0,.2)',
backgroundColor: this.props.dotColor || 'rgba(237, 237, 237, 0.5)',
width: 8,
height: 8,
borderRadius: 4,
... ... @@ -606,7 +604,6 @@ export default class extends Component {
pages.unshift(total - 1 + '')
pages.push('0')
}
console.log(pages);
pages = pages.map((page, i) => {
if (props.loadMinimal) {
... ...
... ... @@ -5,6 +5,7 @@ import ReactNative from 'react-native';
import Swiper from 'react-native-swiper';
import YH_Image from '../../../common/components/YH_Image';
import Immutable, {Map} from 'immutable';
import RecyclerSwiper from '../../../common/recycler-swiper/recyclerswiper'
const {
View,
... ... @@ -15,6 +16,8 @@ const {
Platform,
} = ReactNative;
const YH_Swiper = (Platform.OS === 'ios') ? Swiper : RecyclerSwiper;
export default class ImageSlider extends React.Component {
... ... @@ -84,7 +87,7 @@ export default class ImageSlider extends React.Component {
);
} else {
return (
<Swiper
<YH_Swiper
showsButtons={false}
loop={true}
autoplay={true}
... ... @@ -123,7 +126,7 @@ export default class ImageSlider extends React.Component {
</TouchableOpacity>
);
})}
</Swiper>
</YH_Swiper>
);
}
}
... ...
... ... @@ -5,6 +5,8 @@ import ReactNative from 'react-native';
import Swiper from 'react-native-swiper';
import YH_Image from '../../../common/components/YH_Image';
import Immutable, {Map} from 'immutable';
import RecyclerSwiper from '../../../common/recycler-swiper/recyclerswiper'
const {
View,
... ... @@ -13,8 +15,12 @@ const {
TouchableOpacity,
StyleSheet,
Dimensions,
Platform,
} = ReactNative;
const YH_Swiper = (Platform.OS === 'ios') ? Swiper : RecyclerSwiper;
export default class Announcement extends React.Component {
constructor(props) {
... ... @@ -48,7 +54,7 @@ export default class Announcement extends React.Component {
<Image style={styles.icon} source={require('../../images/announcement_speaker_icon.png')} />
<Swiper
<YH_Swiper
style={styles.banner}
horizontal={false}
showsButtons={false}
... ... @@ -73,7 +79,7 @@ export default class Announcement extends React.Component {
</TouchableOpacity>
);
})}
</Swiper>
</YH_Swiper>
</View>
);
}
... ...