mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-28 12:25:21 +08:00
This adds ability to listen to events from the component where the navigator is defined, even if the screen is not rendered.
```js
<Tabs.Screen
name="Chat"
component={Chat}
options={{ title: 'Chat' }}
listeners={{
tabPress: e => console.log('Tab press', e.target),
}}
/>
```
Closes #6756
17 lines
519 B
TypeScript
17 lines
519 B
TypeScript
import { ParamListBase, NavigationState } from '@react-navigation/routers';
|
|
import { RouteConfig, EventMapBase } from './types';
|
|
|
|
/**
|
|
* Empty component used for specifying route configuration.
|
|
*/
|
|
export default function Screen<
|
|
ParamList extends ParamListBase,
|
|
RouteName extends keyof ParamList,
|
|
State extends NavigationState,
|
|
ScreenOptions extends object,
|
|
EventMap extends EventMapBase
|
|
>(_: RouteConfig<ParamList, RouteName, State, ScreenOptions, EventMap>) {
|
|
/* istanbul ignore next */
|
|
return null;
|
|
}
|