React Native: react-native-android-function
📖 Getting started
$ npm install react-native-android-function --save
$ react-native link react-native-android-function
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.zappi.android.function.AndroidFunctionPackage;
to the imports at the top of the file - Add
new AndroidFunctionPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-android-function' project(':react-native-android-function').projectDir = new File(rootProject.projectDir,'../node_modules/react-native-android-function/android/app')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-android-function')
💻 Usage
;
Intents
Youtube
AndroidFunction;
Prop | Type | Default | Note |
---|---|---|---|
url |
string |
URL of the Youtube video to open. | |
fullscreen |
boolean |
true |
It allows you to choose whether to view the video in fullscreen mode. |
AndroidFunction;
Prop | Type | Default | Note |
---|---|---|---|
url |
string |
URL of the YouTube video to open. | |
fullscreen |
boolean |
It allows you to choose whether to view the video in fullscreen mode. |
AndroidFunction;
Prop | Type | Default | Note |
---|---|---|---|
id |
string |
Id of Facebook profile to open. |
AndroidFunction;
Prop | Type | Default | Note |
---|---|---|---|
id |
string |
Id of Instagram profile to open. |
AndroidFunction;
Prop | Type | Default | Note |
---|---|---|---|
id |
string |
Id of Twitter profile to open. |
Google Play Store
AndroidFunction;
Prop | Type | Default | Note |
---|---|---|---|
id |
string |
Id of Google Play Store profile to open. |
AndroidFunction;
Open as intent the google play store passing id in the app in use it is on the google play store.
General intent
AndroidFunction;
Prop | Type | Default | Note |
---|---|---|---|
appIntent |
string |
||
setPackage |
string |
||
webIntent |
string |
AndroidFunction;
Prop | Type | Default | Note |
---|---|---|---|
urlImg |
string |
Url of the image. | |
cropped |
boolean |
Ability of skill the rounding of the image. | |
shortLabel |
string |
||
longLabel |
string |
||
appUri |
string |
||
setPackage |
string |
AndroidFunction;
Prop | Type | Default | Note |
---|---|---|---|
urlImg |
string |
Url of the image. | |
cropped |
boolean |
Ability of skill the rounding of the image. | |
shortLabel |
string |
||
longLabel |
string |
||
type |
string |
What kind of intent to use: facebook,instagram,twitter,googleplaystore |
|
id |
string |
id of the user to pass |
Pinned ShortCuts
;;; AndroidFunctionpinnedShortcuts; Component { super; thisstate = data: {} ; } { AndroidFunctionpinnedShortcuts ; } { const data = thisstate; return <View style=stylescontainer> <Text style=stylesparagraph>Quick Action: dataname && dataname+" "+datasurname || 'None'</Text> </View> ; } const styles = StyleSheet;
AndroidFunction.pinnedShortcuts.setShortcutItem
Prop | Type | Default | Note |
---|---|---|---|
typeImg |
string |
letter |
url, icon, letter |
icon |
object |
icon, you can only use it as the typeImg is icon. | |
colorText |
string |
#FFFFFF |
Text color, you can only use it as the typeImg is letter. |
colorCircle |
string |
#64B5F6 |
Circle color, you can only use it as the typeImg is letter. |
urlImg |
string |
Image url, you can only use it as the typeImg is url. | |
shortLabel |
string |
||
longLabel |
string |
||
typeIntent |
string |
app |
Uri , allows you to open an intent to an external app, see: examples App , allows you to open the app itself by passing the objects defined in infoIntent, see: infoIntent |
appUri |
string |
||
setPackage |
string |
||
infoIntent |
object |
infoIntent, you can only use it as the typeIntent is app. |
icon
Prop | Type | Default | Note |
---|---|---|---|
family |
string |
Icon family type | |
name |
string |
Icon name | |
colorText |
string |
#FFFFFF |
Text color. |
colorCircle |
string |
#64B5F6 |
Circle color. |
See: react-native-vector-icons To search for icons: react-native-vector-icons
Some examples of appUri and setPackage
Open page browser
appUri | setPackage | Note |
---|---|---|
https://www.google.com/ |
appUri | setPackage | Note |
---|---|---|
https://www.facebook.com/ +id |
com.facebook.katana |
|
fb://facewebmodal/f?href=https://www.facebook.com/ +id |
com.facebook.katana |
appUri | setPackage | Note |
---|---|---|
http://instagram.com/ +id |
com.instagram.android |
|
http://instagram.com/_u/ +id |
com.instagram.android |
appUri | setPackage | Note |
---|---|---|
https://twitter.com/ +id |
com.twitter.android |
|
twitter://user?screen_name= +id |
com.twitter.android |
|
https://twitter.com/intent/tweet?text=%23 +text |
||
https://twitter.com/search?f=tweets&q= +text |
Google Play Store
appUri | setPackage | Note |
---|---|---|
https://play.google.com/store/apps/details?id= +id |
com.android.vending |
|
market://details?id= +id |
com.android.vending |
Youtube
appUri | setPackage | Note |
---|---|---|
http://www.youtube.com/watch?v= +id |
||
vnd.youtube: +id |
Some examples of infoIntent
infoIntent: paramOne: 21//intparamTwo: "James Bond"//stringparamThree: 007//float...
Some suggested colors
-
#e57373
-
#f06292
-
#ba68c8
-
#9575cd
-
#7986cb
-
#64b5f6
-
#4fc3f7
-
#4dd0e1
-
#4db6ac
-
#81c784
-
#aed581
-
#dce775
-
#fff176
-
#ffd54f
-
#ffb74d
-
#ff8a65
-
#a1887f
-
#e0e0e0
-
#90a4ae
-
#000000
📜 License
This library is provided under the Apache License.