0

Following is my code for onpress handle

<TouchableOpacity style={{right: 45,}} onPress={()=>changeVisible(true)}>
                <Icon name="map-pin" size={20} />
 </TouchableOpacity>

This is my modal

<Modal
        transparent={true}
        animationType="fade"
        visible={isModalVisible}
        onRequestClose={() => changeVisible(false)}
        style={{flex:1}}>

        <Mymap />
        {/* <MapView style={{flex:1}}/> */} // manually putting in here works
 </Modal>

Then this is my 'Mymap' component

const Mymap = () => {
  const initialLocation = {
    latitude: 70,
    longitude: 70,
    latitudeDelta: 0.0022,
    longitudeDelta: 0.0021,
  };
  return (
    <View style={styles.mapcontainer}>
      <MapView
        provider={PROVIDER_GOOGLE} // remove if not using Google Maps
        style={styles.map}
        region={initialLocation}
      />
     </View>
  );
};
const styles = StyleSheet.create({
  mapcontainer: {
    // height: windowHeight,
    // width: windowWidth,
    flex: 1,
  },
  map: {
    // ...StyleSheet.absoluteFillObject,
    // marginBottom: 20,
    flex: 1,
  },
});

if I just put the '' inside modal it works but otherwise doesn't. I've tried using various styles inside the 'styles.map' and 'styles.container' but it is not working

2
  • could you also add display:'flex' in mapcontainer Commented May 2, 2023 at 13:53
  • Actually the problem was in latitude and longitude delta . Changing it to a higher number solved it . I should probably remove this quesion 😆 Commented May 4, 2023 at 10:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.