Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
react-native-viewpager-enhanced
Advanced tools
ViewPager component for react-native, same api on both android and ios.
This module is not mine, I forked it from ZbTang and I uploaded an enhanced version on npm called react-native-viewpager-enhanced.
Additional features:
Add props indicatorPosition
direction (possible values are top
and bottom
)
Custom render tab titles on PagerTitleIndicator
component
Listen event onItemPress(index, isSelected)
on PagerTabIndicator
and PagerTitleIndicator
Listen event onPageChange(index)
on PagerTabIndicator
, PagerTitleIndicator
and PagerDotIndicator
Add method getCurrentPageIndex()
on IndicatorViewPager
ref
Add management of topTitle[Value/Enabled/ContainerStyle/TextStyle]
, see example:
<PagerTitleIndicator
ref="pageIndicator"
style={{backgroundColor:'#E62118'}}
autoUpdateTitle={true}
topTitleValue="This title is static if autoUpdateTitle = false"
topTitleEnabled={true}
topTitleContainerStyle={{backgroundColor: '#E62118'}}
topTitleTextStyle={{color: 'white'}}
itemsContainerStyle={{backgroundColor: '#E62118'}}
selectedBorderStyle={{backgroundColor: 'white'}}
titles={titles}
renderTitle={(index, title, isSelected) => {
// I can render my own tab, here I decide to render only an icon
let icon = null;
if (index == 0) icon = require('../img/menu-0.png');
else if (index == 1) icon = require('../img/menu-1.png');
else if (index == 2) icon = require('../img/menu-2.png');
return (
<View style={{backgroundColor: '#E62118', flexDirection:'column', justifyContent:'center', alignItems:'center', alignSelf:'stretch'}}>
<Image source={icon} style={{width:18,height:18,tintColor:isSelected ? 'white' : '#5F0707'}} />
</View>
);
}}
/>
ViewPager and Indicator component for react-native on both android and ios. ViewPager's props is the same as ViewPagerAndroid.
cd demo/
npm install
react-native run-ios
npm install --save rn-viewpager
import {StyleSheet, View, Text} from 'react-native';
import React, {Component} from 'react';
import {PagerTabIndicator, IndicatorViewPager, PagerTitleIndicator, PagerDotIndicator} from 'rn-viewpager';
export default class ViewPagerPage extends Component {
render() {
return (
<View style={{flex:1}}>
<IndicatorViewPager
style={{height:200}}
indicator={this._renderDotIndicator()}
>
<View style={{backgroundColor:'cadetblue'}}>
<Text>page one</Text>
</View>
<View style={{backgroundColor:'cornflowerblue'}}>
<Text>page two</Text>
</View>
<View style={{backgroundColor:'#1AA094'}}>
<Text>page three</Text>
</View>
</IndicatorViewPager>
<IndicatorViewPager
indicatorPosition="top"
style={{flex:1, paddingTop:20, backgroundColor:'white'}}
indicator={this._renderTitleIndicator()}
>
<View style={{backgroundColor:'cadetblue'}}>
<Text>page one</Text>
</View>
<View style={{backgroundColor:'cornflowerblue'}}>
<Text>page two</Text>
</View>
<View style={{backgroundColor:'#1AA094'}}>
<Text>page three</Text>
</View>
</IndicatorViewPager>
<IndicatorViewPager
indicatorPosition="bottom"
style={{flex:1, paddingTop:20, backgroundColor:'white'}}
indicator={this._renderTabIndicator()}
>
<View style={{backgroundColor:'cadetblue'}}>
<Text>page one</Text>
</View>
<View style={{backgroundColor:'cornflowerblue'}}>
<Text>page two</Text>
</View>
<View style={{backgroundColor:'#1AA094'}}>
<Text>page three</Text>
</View>
</IndicatorViewPager>
</View>
);
}
_renderTitleIndicator() {
return <PagerTitleIndicator titles={['one', 'two', 'three']} />;
}
_renderDotIndicator() {
return <PagerDotIndicator pageCount={3} />;
}
_renderTabIndicator() {
let tabs = [{
text: 'Home',
iconSource: require('../imgs/ic_tab_home_normal.png'),
selectedIconSource: require('../imgs/ic_tab_home_click.png')
},{
text: 'Message',
iconSource: require('../imgs/ic_tab_task_normal.png'),
selectedIconSource: require('../imgs/ic_tab_task_click.png')
},{
text: 'Profile',
iconSource: require('../imgs/ic_tab_my_normal.png'),
selectedIconSource: require('../imgs/ic_tab_my_click.png')
}];
return (
<PagerTabIndicator
tabs={tabs}
textStyle={{color:'#999'}}
selectedTextStyle={{color:'#111'}}
iconStyle={{width:25, height:25, tintColor:'#999'}}
selectedIconStyle={{width:25, height:25, tintColor:'#111'}}
/>
);
}
}
When use this lib in ListView header on android platform, please add removeClippedSubviews={false}
prop to your ListView.
FAQs
ViewPager component for react-native, same api on both android and ios.
The npm package react-native-viewpager-enhanced receives a total of 1 weekly downloads. As such, react-native-viewpager-enhanced popularity was classified as not popular.
We found that react-native-viewpager-enhanced demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.