0
Ich verwende TabNavigator von https://reactnavigation.org/docs/navigators/tab, ich möchte meine Komponente dynamisch mit dem state.routeName zurückgeben.React-Native - Make dynamische Komponente
import React, { Component } from 'react';
import { View, Text} from 'react-native';
export default class DashboardSelectionTab extends Component {
constructor(props) {
super(props);
}
render() {
const {state} = this.props.navigation;
bekomme ich folgende state.routeName hier also "Tag", "Woche", "Monat", "Custom" für die einzelnen Tab entsprechend
const Day =() => (
<Text>Day</Text>
);
const Week =() => (
<Text>Week</Text>
);
const Month =() => (
<Text>Month</Text>
);
const Custom =() => (
<Text>Custom</Text>
);
Ich tat dies, aber ich Syntax bekommen Error.
return <{state.routeName } />
}
}
Irgendwelche Hilfe? Vielen Dank.