npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-common-intents

v0.3.0

Published

A react-native module in which you will use find all of the common intents for only android platform

Downloads

22

Readme

react-native-common-intents

npm

React Native Android Module's Android Common intents actions like for

Image picker from Gallery
Open date settings
Open settings page
Open wifi settings
Open Bluetooth settings
Open airplanemode settings
Open browser with input url
Make web search by entering text
Create alarm
Create timer
dial phone number
Create note

How this Module is useful ?

lets say you want to pick image from gallery and want to upload it, you want user to open wifi settings , date settings etc directly from your app , you want to load a web url in browser or you want to make some web search all these things can be achieved with this library as shown below.

Installation

npm install react-native-common-intents --save
or
yarn add react-native-common-intents

Add it to your android project

Automatic link:

react-native link react-native-common-intents  

Manual link:

  • in android/app/build.gradle

    - dependencies {  
          implementation "com.facebook.react:react-native:+"  // From node_modules  
           
          + implementation project(':react-native-common-intents')  // <------ add this line to your build.gradle file
      } 
         
         
         
  • in android/settings.gradle


include ':app'
// <------ add below two lines to your settings.gradle------>
+ include ':react-native-common-intents' // 
+ project(':react-native-common-intents').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-common-intents/android')// 
  • in MainApplication.java
    @Override
   protected List<ReactPackage> getPackages() {
     return Arrays.<ReactPackage>asList(
         new MainReactPackage(),
           new IntentModulePackage() // <------ add this line to your MainApplication class
     );
   }

Permissions

Add this to your AndroidManifest.xml
...
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
   <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
   <uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
 ...

Import Library

import RNIntents from 'react-native-common-intents';

Example/ Image Picker

RNIntents.ImagePicker Module has two arguments first one will give you the url of the
image that you will choose from gallery and 2nd argument will give you the error which may occur

RNIntents.ImagePicker(url => {
 console.log("image uri",url);
},(err) => {
 console.log("eeeoe",err);
});

Example/ open Web Page

RNIntents.openWeb("https://google.com");

Example/ Perform Web Search

RNIntents.performWebSearch("Winter is coming");

Example/ Open Settings Page

RNIntents.openSettings();

Example/ Open DateSettings

RNIntents.openDateSettings();

Example/ Open WifiSettings

RNIntents.openWifiSettings();

Example/ open AirplaneModeSettings

RNIntents.openAirplaneModeSettings();

Example/ open BluetoothSettings

RNIntents.openBluetoothSettings();

Example/ Dial Phone Number

RNIntents.dialNumber("9086090860");

Example/ Start Timer

you can start a timer in background without opening app or with opening app based

on the boolean value passed as true or false

It takes 3 parameters Message as string , seconds as int , boolean value

RNIntents.startTimer(String message, int seconds,boolean value) 

Example/ Create alarm

It takes 3 parameters

Message as string , hours as int , minutes as int

RNIntents.createAlarm(String message, int hour, int minutes);

Example/ Create note

It takes 2 parameters

subject as string , text as string

RNIntents.createNote(subject,text);

Example


import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View, Button} from 'react-native';
import RNIntents from 'react-native-common-intents';



export default class App extends Component {
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>React-native-common-intents</Text>
        <Button  title =" pick image from gallery" onPress = {() => {


RNIntents.ImagePicker(url => {
  console.log("image uri",url);
},(err) => {
  console.log("error",err);
});

  }  


}  />
<Button title ="open Date settings" onPress = { () => {
  RNIntents.openDateSettings();
}}/>

<Button title ="open Wifi settings" onPress = { () => {
  RNIntents.openWifiSettings();
}}/>

<Button title ="open Airplanemode Settings " onPress = { () => {
  RNIntents.openAirplaneModeSettings();
  console.log("hehehehe")
}}/>

<Button title ="open Bluetooth Settings " onPress = { () => {
  RNIntents.openBluetoothSettings();
}}/>
<Button title ="open browser" onPress = { () => {
  RNIntents.openWeb("http://zigtor.com");
}}/>

<Button title ="Perform web search " onPress = { () => {
  RNIntents.performWebSearch("Winter is coming");
}}/>

      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});