mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Change RRN.Link.component to ComponentType (#24758)
This commit is contained in:
parent
1f6b5b9e80
commit
89a3abfbff
2
types/react-router-native/index.d.ts
vendored
2
types/react-router-native/index.d.ts
vendored
@ -33,7 +33,7 @@ export class AndroidBackButton extends React.Component<BackButtonProps> {}
|
||||
export class DeepLinking extends React.Component {}
|
||||
|
||||
export interface LinkProps {
|
||||
component?: React.Component | React.ComponentClass;
|
||||
component?: React.ComponentType<any>;
|
||||
replace?: boolean;
|
||||
style?: any;
|
||||
to: H.LocationDescriptor;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import { StyleSheet, Text, View } from 'react-native';
|
||||
import { NativeRouter as Router, Route, Link, AndroidBackButton, BackButton } from 'react-router-native';
|
||||
import { StyleSheet, Text, TouchableOpacity, TouchableOpacityProperties, View } from 'react-native';
|
||||
import { AndroidBackButton, BackButton, Link, NativeRouter as Router, Route } from 'react-router-native';
|
||||
|
||||
const Home: React.SFC = () => {
|
||||
return (
|
||||
@ -24,6 +24,14 @@ const About: React.SFC = () => {
|
||||
);
|
||||
};
|
||||
|
||||
interface ButtonTextProps extends TouchableOpacityProperties {
|
||||
text: string;
|
||||
}
|
||||
|
||||
const ButtonText: React.SFC<ButtonTextProps> = ({ text, ...props }) => (
|
||||
<TouchableOpacity {...props}><Text>{text}</Text></TouchableOpacity>
|
||||
);
|
||||
|
||||
export default class App extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
@ -35,9 +43,7 @@ export default class App extends React.Component {
|
||||
<Link to="/" style={styles.navItem}>
|
||||
<Text>Home</Text>
|
||||
</Link>
|
||||
<Link to="/about" style={styles.navItem}>
|
||||
<Text>About</Text>
|
||||
</Link>
|
||||
<Link to="/about" style={styles.navItem} component={ButtonText} text="About" />
|
||||
</View>
|
||||
<Route exact path="/" component={Home} />
|
||||
<Route path="/about" component={About} />
|
||||
|
||||
Loading…
Reference in New Issue
Block a user