4.0.2 • Published 5 years ago

nativescript-swiss-army-knife v4.0.2

Weekly downloads
36
License
MIT
Repository
github
Last release
5 years ago

nativescript-swiss-army-knife

npm npm

A repo for all those functions you copy and paste between projects.

Common Functions

getListViewVerticalOffset Returns the scroll position/vertical offset relative to the visibile contenten of the listView on Android and iOS

disableScrollBounce Disables bounce/overscroll for a ScrollView or ListView on Android and iOS.

removeHorizontalScrollBars Hides horizontal scrollbars for scrollViews or ListViews on Android and iOS

removeVerticalScrollBars Hides vertical scrollbars for scrollViews or ListViews on Android and iOS

pluckChildViewsFromLayout accepts any layout and removes all it's child views and returns them in an array.

getScreenHeight returns an object of type IScreenHeight with the properties portrait and landscape dimensions. IScreenHeight also has the properties androidStatusBar and androidNavBar which are android specific properties that will return the Nav bar and Status bar heights as well. if accessed on iOS they will have a value of 0. These can come in handy since the portrait and landscape dimensions do not take these into account.

dismissSoftKeyboard Dismiss the soft keyboard.

  • ActionBar Utilities

actionBarSetTitle Programmatically set title on ActionBar

actionBarAddButton Programmatically add button to the ActionBar

actionBarClearButtons Programmatically remove all buttons from the ActionBar

Android specific functions

setAndroidStatusBarTranslucentFlag sets the Android statusbar to translucent Android Documentation

resetAndroidStatusBarTranslucentFlag resets the Translucent Android statusbar flag.

setAndroidNavBarTranslucentFlag sets the Android navigation bar to translucent Android Documentaion

resetAndroidNavBarTranslucentFlag resets the Translucent Android navigation bar flag.

setAndroidStatusBarColor Sets the Android navigation bar color, accepts either a string color or a Color object

setAndroidNavBarColor Sets the Android status bar color, accepts either a string color or a Color object

iOS specific functions

actionBarHideBackButton Programmatically hide the back button from the ActionBar

actionBarSetStatusBarStyle Programmatically remove all buttons from the ActionBar

Plugin Development Work Flow:

  • Clone repository to your machine.
  • Run npm run setup to prepare the demo project
  • Build with npm run build
  • Run and deploy to your device or emulator with npm run demo.android or npm run demo.ios

If you add a new function make sure to add it to nativescript-swiss-army-knife.d.ts as well.

Thanks to these awesome contributors!

Brad Martin

Nathan Walker

Contributing guidelines

Contributing guidelines

MIT

for {N} version 2.0.0+

4.0.2

5 years ago

4.0.1

5 years ago

4.0.0

5 years ago

3.1.1

6 years ago

3.1.0

6 years ago

3.0.0

7 years ago

1.1.7

8 years ago

1.0.71

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago