Showing posts with label Tut React Native. Show all posts
Showing posts with label Tut React Native. Show all posts

Oct 3, 2018

Setup NODE.JS and NPM install behind a web proxy

Check your settings with:
npm config list

Settings behind a proxy:
npm config set registry http://registry.npmjs.org/
npm config set http-proxy http://username:password@ip:port
npm config set https-proxy http://username:password@ip:port
npm config set proxy http://username:password@ip:port
npm set strict-ssl false


Mar 19, 2018

Detect Back to Previous Screen on StackNavigator - React Native

//screen A go to screen B, then back
 
//screenA 
import {DeviceEventEmitter} from "react-native"
componentWillMount() {
    DeviceEventEmitter.addListener('YOUR_LISTENER', (e)=>{})
}

//screenB
DeviveEventEmitter.emit("YOUR_LISTENER",  {})

Mar 15, 2018

React Native Sound


// INSTALL
1. npm install react-native-sound --save
   react-native link react-native-sound
// RESOURCE
2. Add file "yoursound.mp3" to Resources folder in iOS XCode project
// CODE 
3. import Sound from "react-native-sound";
4. constructor(props) {
      super(props); 
      Sound.setCategory("Playback");
      mSound = new Sound("yoursound.mp3", Sound.MAIN_BUNDLE); 
   }
5. _playSound() {
      mSound.play(success => {
         if (success) {
            console.log("Success");
         } else {
            console.log("Failure");
            mSound.reset(); 
         } 
      });
   } 
 
https://github.com/hu2di/react-native-mosquito-sound

React Native: Delete Installed Library

1. rnpm unlink package_name (if library with native content requires linking)
2. npm uninstall --save package_name