1.0.0 • Published 8 years ago
react-native-ios-volume v1.0.0
react-native-ios-volume
Getting started
$ npm install react-native-ios-volume --save
Mostly automatic installation
$ react-native link react-native-ios-volume
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries➜Add Files to [your project's name] - Go to
node_modules➜react-native-ios-volumeand addRNIosVolume.xcodeproj - In XCode, in the project navigator, select your project. Add
libRNIosVolume.ato your project'sBuild Phases➜Link Binary With Libraries - Run your project (
Cmd+R)<
Usage
import RNIosVolume from 'react-native-ios-volume';
import React, {Component} from 'react';
class VolumeTest extends Component {
constructor(props) {
super(props);
RNIosVolume.onVolumeChange = e=>{
console.log(`onChange===${e.volume}===`);
};
}
componentDidMount(){
console.log("testing start");
RNIosVolume.getVolume().then(e=>{
console.log(`onGet===${e}===`);
});
RNIosVolume.setVolume(1);
RNIosVolume.setVolume(0.2);
RNIosVolume.setVolume(0.5);
}
...
}| Method Name | Description | Platform |
|---|---|---|
| RNIosVolume.getVolume() | Get a promise that return volume .2f float value | iOS |
| RNIosVolume.setVolume() | Set a number to your device on volume | iOS |
| Event Name | Description | Event | Platform |
|---|---|---|---|
| RNIosVolume.onChangeVolume(event) | Invoked when ios system volume is changed | event.volume | iOS |
- @pohsiu
- @zxcal
1.0.0
8 years ago