Skip to content

Commit

Permalink
bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
LuoHao[罗浩] committed Nov 21, 2018
1 parent 0cd44a3 commit 719c714
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 6 deletions.
52 changes: 48 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
[download-url]: https://npmjs.org/package/react-native-ping
[license-image]: https://img.shields.io/npm/l/react-native-ping.svg



## Getting started

`$ npm install react-native-ping --save`
Expand Down Expand Up @@ -60,8 +58,54 @@ or
## Usage

```javascript
import RNReactNativePing from 'react-native-ping';
import Ping from 'react-native-ping';

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF'
},
buttonText: {
fontSize: 24,
padding: 32
},
msText: {
fontSize: 24,
padding: 32
}
});

// TODO: What to do with the module?
RNReactNativePing;
export default class App extends Component {
state = {
ipAddress: '114.114.114.114',
ms: ''
};
onPressButton = async () => {
const ms = await Ping.start('114.114.114.114');
this.setState({ ms });
};
render() {
return (
<View style={styles.container}>
<TextInput
style={{
height: 40,
borderColor: 'gray',
borderWidth: 1,
alignSelf: 'stretch'
}}
onChangeText={ipAddress => this.setState({ ipAddress })}
value={this.state.ipAddress}
/>
<TouchableOpacity onPress={this.onPressButton}>
<Text style={styles.buttonText}>Ping</Text>
</TouchableOpacity>
<Text style={styles.msText}>ms:{this.state.ms}</Text>
</View>
);
}
}
```
2 changes: 1 addition & 1 deletion example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default class App extends Component {
borderWidth: 1,
alignSelf: 'stretch'
}}
onChangeText={text => this.setState({ ipAddress })}
onChangeText={ipAddress => this.setState({ ipAddress })}
value={this.state.ipAddress}
/>
<TouchableOpacity onPress={this.onPressButton}>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-ping",
"version": "1.0.3",
"version": "1.0.4",
"description": "Highly accurate ICMP Ping controller for React Native",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 719c714

Please sign in to comment.