Skip to content

Commit

Permalink
fix(docs): add docs to every method to be used with intellisense
Browse files Browse the repository at this point in the history
* chore(docs): update RNN more info links on README

* chore(deps): downgrade typescript to 3.3.1
  • Loading branch information
aschenkel authored May 18, 2020
1 parent 970d5e8 commit ae938ae
Show file tree
Hide file tree
Showing 14 changed files with 268 additions and 84 deletions.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ A set of React hooks for React Native Navigation

### useNavigationComponentDidAppear

Called each time this component appears on screen (attached to the view hierarchy) [more info](https://wix.github.io/react-native-navigation/#/docs/events?id=componentdidappear)
Called each time this component appears on screen (attached to the view hierarchy) [more info](https://wix.github.io/react-native-navigation/api/events/#componentdidappear)

```js
import { useNavigationComponentDidAppear } from 'react-native-navigation-hooks'
Expand All @@ -61,7 +61,7 @@ const ScreenComponent = ({ componentId }) => {

### useNavigationComponentDidDisappear

Called each time this component disappears from screen (detached from the view heirarchy) [more info](https://wix.github.io/react-native-navigation/#/docs/events?id=componentdiddisappear)
Called each time this component disappears from screen (detached from the view heirarchy) [more info](https://wix.github.io/react-native-navigation/api/events/#componentdiddisappear)

```js
import { useNavigationComponentDidDisappear } from 'react-native-navigation-hooks'
Expand All @@ -87,7 +87,7 @@ const ScreenComponent = ({ componentId }) => {

### useNavigationCommand

The commandListener is called whenever a Navigation command (i.e push, pop, showModal etc) is invoked. [more info](https://wix.github.io/react-native-navigation/#/docs/events?id=registercommandlistener)
The commandListener is called whenever a Navigation command (i.e push, pop, showModal etc) is invoked. [more info](https://wix.github.io/react-native-navigation/api/events/#registercommandlistener)

```js
import { useNavigationCommand } from 'react-native-navigation-hooks'
Expand All @@ -108,7 +108,7 @@ const ScreenComponent = ({ componentId }) => {

### useNavigationCommandComplete

Invoked when a command finishes executing in native. If the command contains animations, for example pushed screen animation,) the listener is invoked after the animation ends. [more info](https://wix.github.io/react-native-navigation/#/docs/events?id=registercommandcompletedlistener)
Invoked when a command finishes executing in native. If the command contains animations, for example pushed screen animation,) the listener is invoked after the animation ends. [more info](https://wix.github.io/react-native-navigation/api/events/#registercommandcompletedlistener)

```js
import { useNavigationCommandComplete } from 'react-native-navigation-hooks'
Expand All @@ -129,7 +129,7 @@ const ScreenComponent = ({ componentId }) => {

### useNavigationModalAttemptedToDismiss

Invoked only on iOS pageSheet modal when swipeToDismiss flag is set to true and modal swiped down to dismiss. [more info](https://wix.github.io/react-native-navigation/#/docs/events?id=registermodalattemptedtodismisslistenerios-13-only)
Invoked only on iOS pageSheet modal when swipeToDismiss flag is set to true and modal swiped down to dismiss. [more info](https://wix.github.io/react-native-navigation/api/events/#registermodalattemptedtodismisslistenerios-13-only)

```js
import { useNavigationModalAttemptedToDismiss } from 'react-native-navigation-hooks'
Expand All @@ -155,7 +155,7 @@ const ScreenComponent = ({ componentId }) => {

### useNavigationModalDismiss

Invoked when modal dismissed. [more info](https://wix.github.io/react-native-navigation/#/docs/events?id=registermodaldismissedlistener)
Invoked when modal dismissed. [more info](https://wix.github.io/react-native-navigation/api/events/#registermodaldismissedlistener)

```js
import { useNavigationModalDismiss } from 'react-native-navigation-hooks'
Expand All @@ -181,7 +181,7 @@ const ScreenComponent = ({ componentId }) => {

### useNavigationScreenPop

Invoked when screen is popped. [more info](https://wix.github.io/react-native-navigation/#/docs/events?id=registerscreenpoppedlistener)
Invoked when screen is popped. [more info](https://wix.github.io/react-native-navigation/api/events/#registerscreenpoppedlistener)

```js
import { useNavigationScreenPop } from 'react-native-navigation-hooks'
Expand All @@ -207,7 +207,7 @@ const ScreenComponent = ({ componentId }) => {

### useNavigationBottomTabSelect

Invoked when a BottomTab is selected by the user. [more info](https://wix.github.io/react-native-navigation/#/docs/events?id=registerbottomtabselectedlistener)
Invoked when a BottomTab is selected by the user. [more info](https://wix.github.io/react-native-navigation/api/events/#registerbottomtabselectedlistener)

```js
import { useNavigationBottomTabSelect } from 'react-native-navigation-hooks'
Expand All @@ -228,7 +228,7 @@ const ScreenComponent = ({ componentId }) => {

### useNavigationBottomTabPress

Invoked when a BottomTab is pressed by the user. [more info](https://wix.github.io/react-native-navigation/#/docs/events)
Invoked when a BottomTab is pressed by the user. [more info](https://wix.github.io/react-native-navigation/api/events/#registerbottomtabpressedlistener)

```js
import { useNavigationBottomTabPress } from 'react-native-navigation-hooks'
Expand All @@ -249,7 +249,7 @@ const ScreenComponent = ({ componentId }) => {

### useNavigationBottomTabLongPress

Invoked when a BottomTab is long pressed by the user. [more info](https://wix.github.io/react-native-navigation/#/docs/events?id=registerbottomtablongpressedlistener)
Invoked when a BottomTab is long pressed by the user. [more info](https://wix.github.io/react-native-navigation/api/events/#registerbottomtablongpressedlistener)

```js
import { useNavigationBottomTabLongPress } from 'react-native-navigation-hooks'
Expand All @@ -270,7 +270,7 @@ const ScreenComponent = ({ componentId }) => {

### useNavigationButtonPress

Emitted whenever a TopBar button is pressed by the user. [more info](https://wix.github.io/react-native-navigation/#/docs/topBar-buttons?id=handling-button-press-events)
Emitted whenever a TopBar button is pressed by the user. [more info](https://wix.github.io/react-native-navigation/api/events/#navigationbuttonpressed-event)

```js
import { useNavigationButtonPress } from 'react-native-navigation-hooks'
Expand Down Expand Up @@ -305,7 +305,7 @@ const ScreenComponent = ({ componentId }) => {

### useNavigationSearchBarUpdate (iOS 11+ only)

Called when a SearchBar from NavigationBar gets updated. [more info](https://wix.github.io/react-native-navigation/#/docs/events?id=searchbarupdated-ios-11-only)
Called when a SearchBar from NavigationBar gets updated. [more info](https://wix.github.io/react-native-navigation/api/events/#searchbarupdated-ios-11-only)

```js
import { useNavigationSearchBarUpdate } from 'react-native-navigation-hooks'
Expand Down Expand Up @@ -333,7 +333,7 @@ const ScreenComponent = ({ componentId }) => {

### useNavigationSearchBarCancelPress (iOS 11+ only)

Called when the cancel button on the SearchBar from NavigationBar gets pressed. [more info](https://wix.github.io/react-native-navigation/#/docs/events?id=searchbarcancelpressed-ios-11-only)
Called when the cancel button on the SearchBar from NavigationBar gets pressed. [more info](https://wix.github.io/react-native-navigation/api/events/#searchbarcancelpressed-ios-11-only)

```js
import { useNavigationSearchBarCancelPress } from 'react-native-navigation-hooks'
Expand All @@ -359,7 +359,7 @@ const ScreenComponent = ({ componentId }) => {

### useNavigationPreviewComplete (iOS 11.4+ only)

Called when preview peek is completed. [more info](https://wix.github.io/react-native-navigation/#/docs/events?id=previewcompleted-ios-114-only)
Called when preview peek is completed. [more info](https://wix.github.io/react-native-navigation/api/events/#previewcompleted-ios-114-only)

```js
import { useNavigationPreviewComplete } from 'react-native-navigation-hooks'
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.58.0",
"prettier": "2.0.5",
"react-test-renderer": "16.11.0"
"react-test-renderer": "16.11.0",
"typescript": "3.3.1"
},
"jest": {
"preset": "react-native"
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions example/src/interfaces.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export type ScreenProps = {
componentId: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import { useNavigationCommandComplete } from 'react-native-navigation-hooks'
import { Navigation } from 'react-native-navigation'

import { TestLabels } from '../testIDs'
import { ScreenProps } from '../interfaces'

/**
* ModalScreen
*/

const ModalScreen = ({ componentId }) => {
const ModalScreen = ({ componentId }: ScreenProps) => {
/**
* State
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import { View, Text, StyleSheet, Alert } from 'react-native'
import { useNavigationScreenPop } from 'react-native-navigation-hooks'

import { TestLabels } from '../testIDs'
import { ScreenProps } from '../interfaces'

/**
* PushedScreen
*/

const PushedScreen = ({ componentId }) => {
const PushedScreen = ({ componentId }: ScreenProps) => {
const handleNavigationScreenPop = useCallback(() => {
Alert.alert(TestLabels.POPPED)
}, [])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ import { Navigation } from 'react-native-navigation'

import { Screens } from '.'
import { TestLabels, TestIDs } from '../testIDs'
import { ScreenProps } from '../interfaces'

/**
* Home
*/

const Home = ({ componentId }) => {
const Home = ({ componentId }: ScreenProps) => {
/**
* State
*/
Expand Down Expand Up @@ -104,37 +105,26 @@ const Home = ({ componentId }) => {
* Listeners
*/

// Listener called each time this component appears on screen (attached to the view hierarchy)
useNavigationComponentDidAppear(handleComponentDidAppear, componentId)

// Listener called each time this component disappears from screen (detached from the view heirarchy)
useNavigationComponentDidDisappear(handleComponentDidDisappear, componentId)

// Listener called whenever a Navigation command (i.e push, pop, showModal etc) is invoked.
useNavigationCommand(handleNavigationCommand)

// Global listener called only on iOS pageSheet modal when swipeToDismiss flag is set to true and modal swiped down to dismiss. (iOS 13+ only)
useNavigationModalAttemptedToDismiss(handleNavigationModalAttemptedToDismiss)

// Global listener called when modal dismissed.
useNavigationModalDismiss(handleNavigationModalDismiss)

// Listener called when a BottomTab is pressed by the user.
useNavigationBottomTabPress(handleNavigationBottomTabPress, componentId)
useNavigationBottomTabPress(handleNavigationBottomTabPress)

// Listener called when a BottomTab is long pressed by the user.
useNavigationBottomTabLongPress(handleNavigationBottomTabLongPress, componentId)
useNavigationBottomTabLongPress(handleNavigationBottomTabLongPress)

// Current screen listener called whenever a TopBar button is pressed by the user.
useNavigationButtonPress(handleNavigationButtonPress, componentId)

// Global listener called when a SearchBar from NavigationBar gets updated (iOS 11+ only)
useNavigationSearchBarUpdate(handleNavigationSearchBarUpdate)

// Global listener called when the cancel button on the SearchBar from NavigationBar gets pressed (iOS 11+ only)
useNavigationSearchBarCancelPress(handleNavigationSearchBarCancelPress)

// Global listener called when preview peek is completed (iOS 11.4+ only)
useNavigationPreviewComplete(handleNavigationPreviewComplete)

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import { View, Text, StyleSheet } from 'react-native'
import { useNavigationBottomTabSelect } from 'react-native-navigation-hooks'

import { TestLabels } from '../testIDs'
import { ScreenProps } from '../interfaces'

/**
* SecondaryScreen
*/

const SecondaryScreen = ({ componentId }) => {
const SecondaryScreen = ({ componentId }: ScreenProps) => {
/**
* State
*/
Expand All @@ -29,7 +30,7 @@ const SecondaryScreen = ({ componentId }) => {
*/

// Listener called when a BottomTab is selected by the user.
useNavigationBottomTabSelect(handleNavigationBottomTabSelect, componentId)
useNavigationBottomTabSelect(handleNavigationBottomTabSelect)

return (
<View style={styles.container}>
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions example/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6969,6 +6969,11 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

[email protected]:
version "3.3.1"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.3.1.tgz#6de14e1db4b8a006ac535e482c8ba018c55f750b"
integrity sha512-cTmIDFW7O0IHbn1DPYjkiebHxwtCMU+eTy30ZtJNBPF9j2O1ITu5XH2YnBeVRKWHqF+3JQwWJv0Q0aUgX8W7IA==

ua-parser-js@^0.7.18:
version "0.7.21"
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.21.tgz#853cf9ce93f642f67174273cc34565ae6f308777"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"react-native-navigation": ">=6.5.0",
"react-test-renderer": "16.12.0",
"semantic-release": "17.0.3",
"typescript": "3.7.5"
"typescript": "3.3.1"
},
"release": {
"branch": "master",
Expand Down
Loading

0 comments on commit ae938ae

Please sign in to comment.