ReactNative: Native Add Shortcuts
npm install react-native-add-shortcuts
ReactNative: Native Add Shortcuts Library (Android/iOS)
If this project has helped you out, please support us with a star 🌟
This library is a React Native bridge around native API's providing capability to add app shortcuts.
> This library is support RN61+
$ npm install react-native-add-shortcuts --save
- Add react-native-image-helper your app package.json
$ npm install react-native-image-helper --save
- Add react-native-vector-icons to your app package.json and configure it as per their installation steps
$ npm install react-native-vector-icons --save
- iOS
> iOS Prerequisite: Please make sure CocoaPods is installed on your system
- Add the following to your Podfile -> ios/Podfile and run pod update:
``
use_native_modules!
pod 'RNAddShortcuts', :path => '../node_modules/react-native-add-shortcuts/ios'
`
- Android
> No configuration is required
- Add Pinned Shortcut
> Note: Only support on Android Platform
`
import { RNAddShortcuts } from 'react-native-add-shortcuts'
let copy = (
size={30}
color="#000000"
family={'FontAwesome'}
/>
)
RNAddShortcuts.AddPinnedShortcut({
label: 'Copy',
description: 'Copy Desc',
icon: copy,
link: 'app:copy',
onDone: () => {
console.log('Shortcut Added');
}
})
`
- Add Dynamic Shortcut
`
import { RNAddShortcuts } from 'react-native-add-shortcuts'
let copy = (
size={30}
color="#000000"
family={'FontAwesome'}
/>
);
RNAddShortcuts.AddDynamicShortcut({
label: 'Copy',
description: 'Copy Desc',
icon: 'copy.png',
link: 'app:copy',
onDone: () => {
console.log('Shortcut Added');
}
});
`
- Get Dynamic Shortcuts
`
import { RNAddShortcuts } from 'react-native-add-shortcuts'
RNAddShortcuts.GetDynamicShortcuts({
onDone: shortcuts => {
console.log('Shortcuts: ' + shortcuts);
}
});
`
- Remove All Dynamic Shortcuts
`
import { RNAddShortcuts } from 'react-native-add-shortcuts'
RNAddShortcuts.RemoveAllDynamicShortcuts({
onDone: () => {
console.log('All Dynamic Shortcuts Removed');
}
})
`
- Pop Dynamic Shortcuts
`
import { RNAddShortcuts } from 'react-native-add-shortcuts'
RNAddShortcuts.PopDynamicShortcuts({
shortcuts: ['Copy'],
onDone: () => {
console.log('Pop Dynamic Shortcuts');
}
})
`
- General(iOS & Android)
| Prop | Type | Default | Note |
| ------------------------------- | ------ | ------- | --------------------------------------------------------- |
| AddPinnedShortcut({}) | func | | Add Pinned Shortcut (Only supported for Android Platform) |AddDynamicShortcut({})
| | func | | Add Dynamic Shortcut |GetDynamicShortcuts({})
| | func | | Get All Dynamic Shortcut |RemoveAllDynamicShortcuts({})
| | func | | Remove All Dynamic Shortcuts |PopDynamicShortcuts({})
| | func` | | Delete Specific Dynamic Shortcuts |
Have an idea? Found a bug? Please raise to ISSUES.
Contributions are welcome and are greatly appreciated! Every little bit helps, and credit will always be given.
If you are using this library in one of your projects, add it in this list below. ✨
This library is provided under the Apache 2 License.
RNAppTour @ prscX
I open-source almost everything I can, and I try to reply everyone needing help using these projects. Obviously, this takes time. You can integrate and use these projects in your applications for free! You can even change the source code and redistribute (even resell it).
However, if you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it:
- Starring and sharing the projects you like 🚀
- If you're feeling especially charitable, please follow prscX on GitHub.
Thanks! ❤️
prscX.github.io
Pranav >