Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-native-invertible-scroll-view
Advanced tools
InvertibleScrollView is a React Native scroll view that can be inverted so that content is rendered starting from the bottom, and the user must scroll down to reveal more. This is a common design in chat applications and the command-line terminals. InvertibleScrollView also supports horizontal scroll views to present content from right to left.
It conforms to ScrollableMixin so you can compose it with other scrollable components.
Use this with react-native 0.8.0-rc or later.
npm install react-native-invertible-scroll-view
Compose InvertibleScrollView with the scrollable component you would like to invert. In the case of a ListView, you would write:
import React from 'react-native';
let {
ListView,
Text,
TouchableHighlight,
View,
StyleSheet,
} = React;
import InvertibleScrollView from 'react-native-invertible-scroll-view';
class InvertedScrollComponent extends React.Component {
constructor(props, context) {
super(props, context);
this._data = [];
this.state = {
dataSource: new ListView.DataSource({
rowHasChanged: (r1, r2) => r1 !== r2,
}),
};
}
render() {
return (
<ListView
renderScrollComponent={props => <InvertibleScrollView {...props} inverted />}
dataSource={this.state.dataSource}
renderHeader={this._renderHeader.bind(this)}
renderRow={this._renderRow.bind(this)}
style={styles.container}
/>
);
}
_renderHeader() {
return (
<TouchableHighlight
onPress={this._onPress.bind(this)}
style={styles.button}>
<Text>Add a row</Text>
</TouchableHighlight>
);
},
_renderRow(row) {
return <Text key={row} style={styles.row}>{row}</Text>
},
_onPress() {
this._data.push(`${new Date}`);
var rows = this._data;
// It's important to keep row IDs consistent to avoid extra rendering. You
// may need to reverse the list of row IDs so the so that the inversion
// will order the rows correctly.
var rowIds = rows.map((row, index) => index).reverse();
this.setState({
dataSource: this.state.dataSource.cloneWithRows(rows, rowIds),
});
}
}
let styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
button: {
padding: 20,
borderStyle: 'solid',
borderWidth: 1,
borderColor: 'black',
},
row: {
padding: 4,
},
}
NOTE: When inverting a ListView, you must create a ListView that delegates to an InvertibleScrollView as shown above and not the other way around. Otherwise it will not be able to invert the rows and the content will look upside down. This is true for any scroll view that adds its own children, not just ListView.
scrollTo(0)
on a ref to the scroll viewpadding
are not corrected, so top padding will actually pad the bottom of the componentcontentOffset
and contentInset
are not flipped; for example, the top inset adjusts the bottom of an inverted scroll viewInvertibleScrollView uses a scale transformation to efficiently invert the view. The scroll view's viewport is inverted to flip the entire component, and then each child is inverted again so that the content appears unflipped.
FAQs
An invertible ScrollView for React Native
The npm package react-native-invertible-scroll-view receives a total of 876 weekly downloads. As such, react-native-invertible-scroll-view popularity was classified as not popular.
We found that react-native-invertible-scroll-view demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.