Commit Graph

2235 Commits

Author SHA1 Message Date
alburkerk
1c30ac07e4 feat: allow navigation params to be typed in navigate method (#6444)
Motivation
We can type navigation params in component by writing something like this in component props declaration :

export interface SomeNavigationParams {
  foo: string;
  bar: number;
}

export interface Props {
  navigation: NavigationScreenProp<any, SomeNavigationParams>;
}
But when we are navigating to this screen, we only call navigate method without any type checking.

// Next line doesn't trigger ts error
this.props.navigation.navigate('MyRouteName', { foo: "foo", bar: "bar"})
By making navigate a generic method, we can type those params correctly

import { SomeNavigationParams } from '@Screens/....../SomeScreen.types.ts'

......
// Next line triggers an error
this.props.navigation.navigate<SomeNavigationParams>('MyRouteName', { foo: "foo", bar: "bar"});
......
Test plan
No .js code so it's can't be breaking anything. Plus, can't also break typing as changes are seamless for react-navigation API.
2020-01-23 12:19:32 +01:00
Frieder Bluemle
8438221632 Fix typos (#6579) 2020-01-23 03:16:52 -08:00
Satyajit Sahoo
653a119b91 chore: update issue template 2020-01-11 16:28:07 +01:00
Satyajit Sahoo
960ce843ae fix: remove drawer methods from navigation prop 2020-01-04 15:41:46 +01:00
Satyajit Sahoo
f21c7004fa chore: upgrade depenendecies 2020-01-04 15:40:30 +01:00
imgbot[bot]
87f2ba0464 chore: optimize images (#6544)
*Total -- 138.77kb -> 80.11kb (42.27%)

/example/src/assets/splash.png -- 133.30kb -> 75.22kb (43.57%)
/example/src/assets/dog-back.png -- 4.55kb -> 3.98kb (12.57%)
/example/src/assets/back.png -- 0.92kb -> 0.91kb (0.96%)

Signed-off-by: ImgBotApp <ImgBotHelp@gmail.com>

Co-authored-by: Imgbot <help@imgbot.net>
2020-01-03 11:37:07 +01:00
Satyajit Sahoo
7e25d0fe96 chore: close stale issues automatically 2019-11-18 02:08:33 +01:00
KUBO
7219cac9f4 fix: remove params in NavigationJumpToAction (#6360)
* fix: remove params in NavigationJumpToAction

* Update react-navigation.d.ts
2019-10-16 23:12:33 +09:00
KUBO
d760da796d fix: make params required in NavigationSetParamsActionPayload (#6343) 2019-09-30 06:36:15 +09:00
Brent Vatne
541ad54b7e chore: release 4.0.10 2019-09-25 17:54:13 -07:00
Brent Vatne
0f42057c8e fix: update link to docs page from deprecation messages 2019-09-25 17:47:20 -07:00
Ashoat Tevosyan
447413128b [flow] Remove Flow libdef from repo (#6327) 2019-09-25 20:45:49 -04:00
satyajit.happy
a28be3b502 chore: release 4.0.9 2019-09-24 13:23:53 +02:00
satyajit.happy
f58c06f192 fix: fix types for switch navigator. fixes #6324 2019-09-24 13:16:11 +02:00
satyajit.happy
8f2a0aa240 chore: release 4.0.8 2019-09-23 22:35:38 +02:00
satyajit.happy
eaebe5d46d fix: add type aliases for switch navigator. fixes #6324 2019-09-23 22:34:14 +02:00
satyajit.happy
433a4cab5a chore: release 4.0.7 2019-09-22 00:30:34 +02:00
satyajit.happy
cb4c6994bb fix: accept type parameter for screenProps 2019-09-22 00:29:42 +02:00
satyajit.happy
2494fb4493 chore: release 4.0.6 2019-09-19 16:49:24 +02:00
satyajit.happy
c75e02af99 fix: fix typings for switch navigator. fixes #6310 2019-09-19 16:46:28 +02:00
satyajit.happy
51cf75f970 refactor: don't use export * to reexport deprecations 2019-09-19 16:30:32 +02:00
Nicholas Lee
20411adf8c fix: fix the type of NavigationJumpToActionPayload (#6210)
As mentioned in https://reactnavigation.org/docs/en/switch-actions.html
the param which's name is 'key' of `SwitchActions.jumpTo()`  should be optional
2019-09-16 20:07:43 +09:00
Jeremy
838bcc08ca docs: add the readme back into example (#6284) 2019-09-16 23:01:55 +12:00
satyajit.happy
68d89545f3 chore: release 4.0.5 2019-09-14 15:58:08 +02:00
satyajit.happy
42fba673ae fix: update react-navigation/core 2019-09-14 15:56:09 +02:00
satyajit.happy
61a2eb49ff chore: use proper types for stack in example 2019-09-12 16:31:48 +02:00
satyajit.happy
aa1f8f449f chore: release 4.0.4 2019-09-12 16:15:20 +02:00
satyajit.happy
1ca7abe7c1 fix: improve type definitions 2019-09-12 16:14:48 +02:00
satyajit.happy
e2f53a24fd chore: release 4.0.3 2019-09-11 16:48:36 +02:00
satyajit.happy
b2367880cd fix: fix type definitions 2019-09-11 16:48:05 +02:00
satyajit.happy
ab086432f0 chore: release 4.0.2 2019-09-09 23:02:06 +02:00
satyajit.happy
bb9f26ecdf fix: fix typo in definitions 2019-09-09 23:01:45 +02:00
satyajit.happy
eebfeadf3e chore: release 4.0.1 2019-09-09 16:27:01 +02:00
satyajit.happy
d3bb3833b4 chore: fix missing import in example 2019-09-09 16:23:57 +02:00
satyajit.happy
d8f1d16599 fix: update typescript definitions. closes #6276 2019-09-09 16:20:49 +02:00
Taylor Kline
5bdf25360b docs: add Changelog information to README (#6264)
Now that there is no longer a `CHANGELOG.md` file, this should address concerns of users who come to the Github repository looking for release notes.
2019-09-07 09:06:39 -05:00
Brent Vatne
4edc49f25a fix: status bars in example 2019-09-03 16:24:26 -07:00
jamsch
f0881e3768 fix(deprecations) typo in package name (#6245) 2019-09-03 06:11:42 +12:00
satyajit.happy
8373652f7d docs: fix license in README 2019-09-01 23:59:58 +02:00
satyajit.happy
64e740d2ae docs: remove changelog file 2019-09-01 23:13:51 +02:00
satyajit.happy
dc7b9c2200 chore: release 4.0.0 2019-08-31 12:34:00 +02:00
satyajit.happy
2e56a30c2b chore: update yarn.lock 2019-08-31 12:33:27 +02:00
satyajit.happy
2d1e2322f5 chore: prepare for 4.x 2019-08-30 14:54:54 +02:00
Brent Vatne
8e2a62ac18 Release 3.12.1 2019-08-26 09:54:02 -07:00
Brent Vatne
3a6f9345f2 Release 3.12.0 2019-08-26 09:52:28 -07:00
Levi Buzolic
f2994b7eba Export NavigationContext and ScrollView in flow types (#6152)
These two types are missing entirely from the flow definition, while they're incomplete they at least prevent flow from complaining that they're not defined at all.

I decided against copying the `ScrollView` types from `react-native` as they're really quite complex and likely to fall out-of-sync with the implementation in `react-native`. So instead I'd recommend overriding the types when  consuming using something like:

```js

import {ScrollView as NativeScrollView} from 'react-native';
import {ScrollView as NavigationScrollView} from 'react-navigation';

const ScrollView: React.ComponentType<typeof NativeScrollView>) = NavigationScrollView;
```
2019-08-09 14:25:21 +10:00
Maxime Aubaret
050eb1b600 Fix NavigationParams on NavigationState (#6164) 2019-08-09 06:24:11 +02:00
Brent Vatne
02cf24ea57 Update navigation playground app 2019-07-31 16:57:47 -07:00
Lucas Vieira
7f127afab0 Add NavigationSwitchAction to NavigationAction typescript (#6124) 2019-07-26 00:49:13 -03:00
Brent Vatne
42f38606fb Fix example postinstall 2019-07-25 16:39:39 -07:00