Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16552

position: "absolute" with Button is not working on IOS | React Native

$
0
0

I have a hamburger button that triggers a side menu in a mobile app. The button doesn't respond when position is set to absolute. I have seen similar issue which suggest wrapping the button with <View> </View> and setting its position to absolute, however this didn't work in my case. The button doesn't respond when being clicked on IOS. Android works perfectly fine

Code Snippet:

import React, { useState, useEffect } from "react";import { View, StyleSheet } from "react-native";import Hamburger from "@psyycker/rn-animated-hamburger";function HamburgerIcon({ navigation }) {  const [status, setStatus] = useState(false);  useEffect(() => {    const unsubscribe = navigation.addListener("drawerClose", (e) => {      setStatus(false);    });    return unsubscribe;  }, [navigation]);  async function callBack() {    setStatus(true);    navigation.toggleDrawer();  }  return (<View style={styles.btnContainer}><View style={{ marginTop: 40, marginLeft: 20 }}><Hamburger            active={status}            type="spinArrow"            color="blue"            onPress={() => callBack()}></Hamburger></View></View>  );}const styles = StyleSheet.create({  btnContainer: {    position: "absolute",    flex: 1,  },});

Viewing all articles
Browse latest Browse all 16552

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>