1

I need to open a modal through the right button in the header and I am able to do it.The problem is The modal should be 3/4 of the page's width and the rest 1/4 of the previous page should be visible.

StackNavigator code is below

FilterOptions: {
  screen: FilterOptions,
  transparentCard: true,
  navigationOptions: {
    headerMode: "none",
    header: null,
    modal: "modal",
    transparentCard: true,
  }, cardStyle: {
    backgroundColor: "transparent",
    opacity: 1
  }
}

FilterOptions Page code is

import React, { Component } from 'react';
import { Modal, Text, TouchableHighlight, View } from 'react-native';

class ModalExample extends Component {

render() {
    return (

        <View style={{ flex: 1, flexDirection: 'row', justifyContent: 'flex-end', backgroundColor: "transparent" }}>

            <View style={{ height: "100%", width: '70%', backgroundColor: "#fff", justifyContent: "center" }}>
                <Text>Testing a modal with transparent background</Text>
            </View>
        </View>

    );
}
}
export default ModalExample

Can anyone help to do this.

Janaki Narayanan
  • 523
  • 6
  • 24

2 Answers2

0

you use react-navigation or react-native navigation ?

you do not have to use a StackNavigator

you can use react-native {Animated}

0

Have you followed the docs for this? If yes, you can change your modal size by setting it's container size directly.

If you have some trouble with React Navigation's Modal, i suggest you use React-Native's one, as it is best used when not in full span.

Romain Lavalle
  • 129
  • 1
  • 7