Skip to content

Commit ae938ae

Browse files
authored
fix(docs): add docs to every method to be used with intellisense
* chore(docs): update RNN more info links on README * chore(deps): downgrade typescript to 3.3.1
1 parent 970d5e8 commit ae938ae

File tree

14 files changed

+268
-84
lines changed

14 files changed

+268
-84
lines changed

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ A set of React hooks for React Native Navigation
3535

3636
### useNavigationComponentDidAppear
3737

38-
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)
38+
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)
3939

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

6262
### useNavigationComponentDidDisappear
6363

64-
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)
64+
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)
6565

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

8888
### useNavigationCommand
8989

90-
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)
90+
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)
9191

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

109109
### useNavigationCommandComplete
110110

111-
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)
111+
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)
112112

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

130130
### useNavigationModalAttemptedToDismiss
131131

132-
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)
132+
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)
133133

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

156156
### useNavigationModalDismiss
157157

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

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

182182
### useNavigationScreenPop
183183

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

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

208208
### useNavigationBottomTabSelect
209209

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

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

229229
### useNavigationBottomTabPress
230230

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

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

250250
### useNavigationBottomTabLongPress
251251

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

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

271271
### useNavigationButtonPress
272272

273-
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)
273+
Emitted whenever a TopBar button is pressed by the user. [more info](https://wix.github.io/react-native-navigation/api/events/#navigationbuttonpressed-event)
274274

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

306306
### useNavigationSearchBarUpdate (iOS 11+ only)
307307

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

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

334334
### useNavigationSearchBarCancelPress (iOS 11+ only)
335335

336-
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)
336+
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)
337337

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

360360
### useNavigationPreviewComplete (iOS 11.4+ only)
361361

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

364364
```js
365365
import { useNavigationPreviewComplete } from 'react-native-navigation-hooks'
File renamed without changes.

example/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
"jest": "23.6.0",
3434
"metro-react-native-babel-preset": "0.58.0",
3535
"prettier": "2.0.5",
36-
"react-test-renderer": "16.11.0"
36+
"react-test-renderer": "16.11.0",
37+
"typescript": "3.3.1"
3738
},
3839
"jest": {
3940
"preset": "react-native"
File renamed without changes.

example/src/interfaces.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export type ScreenProps = {
2+
componentId: string
3+
}

example/src/screens/ModalScreen.js renamed to example/src/screens/ModalScreen.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ import { useNavigationCommandComplete } from 'react-native-navigation-hooks'
55
import { Navigation } from 'react-native-navigation'
66

77
import { TestLabels } from '../testIDs'
8+
import { ScreenProps } from '../interfaces'
89

910
/**
1011
* ModalScreen
1112
*/
1213

13-
const ModalScreen = ({ componentId }) => {
14+
const ModalScreen = ({ componentId }: ScreenProps) => {
1415
/**
1516
* State
1617
*/

example/src/screens/PushedScreen.js renamed to example/src/screens/PushedScreen.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ import { View, Text, StyleSheet, Alert } from 'react-native'
44
import { useNavigationScreenPop } from 'react-native-navigation-hooks'
55

66
import { TestLabels } from '../testIDs'
7+
import { ScreenProps } from '../interfaces'
78

89
/**
910
* PushedScreen
1011
*/
1112

12-
const PushedScreen = ({ componentId }) => {
13+
const PushedScreen = ({ componentId }: ScreenProps) => {
1314
const handleNavigationScreenPop = useCallback(() => {
1415
Alert.alert(TestLabels.POPPED)
1516
}, [])

example/src/screens/RootScreen.js renamed to example/src/screens/RootScreen.tsx

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ import { Navigation } from 'react-native-navigation'
1818

1919
import { Screens } from '.'
2020
import { TestLabels, TestIDs } from '../testIDs'
21+
import { ScreenProps } from '../interfaces'
2122

2223
/**
2324
* Home
2425
*/
2526

26-
const Home = ({ componentId }) => {
27+
const Home = ({ componentId }: ScreenProps) => {
2728
/**
2829
* State
2930
*/
@@ -104,37 +105,26 @@ const Home = ({ componentId }) => {
104105
* Listeners
105106
*/
106107

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

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

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

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

119-
// Global listener called when modal dismissed.
120116
useNavigationModalDismiss(handleNavigationModalDismiss)
121117

122-
// Listener called when a BottomTab is pressed by the user.
123-
useNavigationBottomTabPress(handleNavigationBottomTabPress, componentId)
118+
useNavigationBottomTabPress(handleNavigationBottomTabPress)
124119

125-
// Listener called when a BottomTab is long pressed by the user.
126-
useNavigationBottomTabLongPress(handleNavigationBottomTabLongPress, componentId)
120+
useNavigationBottomTabLongPress(handleNavigationBottomTabLongPress)
127121

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

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

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

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

140130
return (

example/src/screens/SecondaryScreen.js renamed to example/src/screens/SecondaryScreen.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ import { View, Text, StyleSheet } from 'react-native'
44
import { useNavigationBottomTabSelect } from 'react-native-navigation-hooks'
55

66
import { TestLabels } from '../testIDs'
7+
import { ScreenProps } from '../interfaces'
78

89
/**
910
* SecondaryScreen
1011
*/
1112

12-
const SecondaryScreen = ({ componentId }) => {
13+
const SecondaryScreen = ({ componentId }: ScreenProps) => {
1314
/**
1415
* State
1516
*/
@@ -29,7 +30,7 @@ const SecondaryScreen = ({ componentId }) => {
2930
*/
3031

3132
// Listener called when a BottomTab is selected by the user.
32-
useNavigationBottomTabSelect(handleNavigationBottomTabSelect, componentId)
33+
useNavigationBottomTabSelect(handleNavigationBottomTabSelect)
3334

3435
return (
3536
<View style={styles.container}>
File renamed without changes.

0 commit comments

Comments
 (0)