我有以下代码:
/**
* The tab that's is going to stay in the Home Section
* @type {[type]}
*/
const HomeTab = createMaterialTopTabNavigator({
//Home: Home,
PostFriends: PostFriends,
// Another screens
}, {
tabBarComponent: null,
mode: 'hide',
navigationOptions: {
visible: false // Now I don't want to see this tab, but I'll need it in the future
}
});
/**
* The Stack that
* @type {[type]}
*/
const HomeStack = createStackNavigator({
HomeTab: HomeTab,
// Another screens
}, {
headerMode: 'float',
cardStyle: {
top: -20 // This is the value that I want to change it to make the animation
}
});
在简历中,正如您所看到的,我有一个隐藏的TabNavigator,它位于StackNavigator中,我希望将此最后的标题设置为最常见的应用程序的标题,当屏幕向下滚动时,标题直到消失为止。
现在,我在PostFriend的屏幕里面有一个包含大量数据的ScrollView,因此,当我在这个屏幕上滚动时,我想访问HomeStack来改变属性" cardStyle"和" navigationOption"改变它的价值并制作动画。
这是我的屏幕代码:
export default class PostFriends extends React.Component {
static navigationOptions = ({ navigation }) => {
const { params } = navigation.state;
// I tried a lot of black magic to
// connect with the HomeStack
};
/**
* Constructor of the component
* @param {[type]} props [description]
* @return {[type]} [description]
*/
constructor(props) {
super(props);
// Some attributes
}
render() {
return (
<ScrollView>
// A lot of data
</ScrollView>
);
}
}