Skip to content

Commit

Permalink
Added a close button to the modal
Browse files Browse the repository at this point in the history
  • Loading branch information
rafbc committed Jun 28, 2019
1 parent 36fe23f commit bb7b309
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
23 changes: 12 additions & 11 deletions example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import BrightcoveHeader from './components/video-header';
import BrightcoveScroll from './components/video-scroll';
import ArticleScreen from './components/article';
import VideoScreen from './components/video';
import { createStackNavigator, createAppContainer } from 'react-navigation';
import { createStackNavigator, createAppContainer, getActiveChildNavigationOptions } from 'react-navigation';

const ArticleStack = createStackNavigator(
{
Expand All @@ -14,22 +14,23 @@ const ArticleStack = createStackNavigator(
screen: VideoScreen
}
},
{
mode: 'modal',
headerMode: 'none'
}
{
mode: 'modal',
headerMode: 'none',
navigationOptions: ({ navigation, screenProps }) => {
return {
title: 'Article',
...getActiveChildNavigationOptions(navigation, screenProps),
}
}
}
);

const MainNavigator = createStackNavigator({
Home: { screen: Home },
BrightcoveHeader: { screen: BrightcoveHeader },
BrightcoveScroll: { screen: BrightcoveScroll },
ArticleStack: {
screen: ArticleStack,
navigationOptions: ({ navigation }) => ({
title: 'Article',
})
}
ArticleStack: { screen: ArticleStack }
});

const App = createAppContainer(MainNavigator);
Expand Down
16 changes: 15 additions & 1 deletion example/components/video.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
import { StyleSheet, View } from 'react-native';
import { StyleSheet, View, TouchableOpacity, Text } from 'react-native';
import { Header } from 'react-navigation';
import BCPlayer from './BCPlayer';

Expand All @@ -11,6 +11,17 @@ const AppHeader = (headerProps) => <Header {... headerProps} />;

export default class Video extends Component {

static navigationOptions = ({ navigation }) => {
return {
headerTitle: 'Video',
headerLeft: null,
headerRight:
<TouchableOpacity onPress={()=>{navigation.navigate('Article')}}>
<Text style={styles.close}>X Close</Text>
</TouchableOpacity>
}
};

render() {
return (
<View style={styles.container}>
Expand Down Expand Up @@ -51,5 +62,8 @@ const styles = StyleSheet.create({
width: '100%',
aspectRatio: 16/9,
backgroundColor: '#000000'
},
close: {
paddingRight: 20
}
});

0 comments on commit bb7b309

Please sign in to comment.