Search code examples
react-nativereact-native-popup-menu

Popup menu does not overlay other components in Android


I am using react-native-popup-menu@0.10.0. It works fine on IOS but cannot overlay on another component on android. It is invisible on android. Please provide any solution .

renderHeader() {<Header><MenuContext style={styles.container}>
          <View>
            <Menu>
              <MenuTrigger customStyles={triggerStyles} onPress={() => this.setState({ opened: true })}>
                <FaIcon name='ellipsis-h' size={21} color='#b1b9bc'/>
              </MenuTrigger>
              <MenuOptions>
                <MenuOption onSelect={() => this.edit()} disabled={this.state.disabled}>
                  <Text style={this.state.disabled ? {color: 'lightgrey'} : {color: 'black'}}>Edit</Text>
                </MenuOption>
                <MenuOption onSelect={() => this.delete()} disabled={this.state.disabled}>
                  <Text style={this.state.disabled ? {color: 'lightgrey'} : {color: 'red'}}>Delete</Text>
                </MenuOption>
              </MenuOptions>
            </Menu>
          </View>
        </MenuContext></Header>}

Solution

  • This happened to me when the MenuContext wasn't high enough in the tree. Eventually I moved it to the very first component's render function as the wrapper for everything, and that works great.