question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is it possible to reproduce the iOS Action Sheet (formSheet, pageSheet) Modal style?

See original GitHub issue

Ask your Question

I was wondering if it was possible to create the native iOS formSheet/pageSheet modal using react-native-modal since the default options have a lot of style applied to them.

This is how it looks using the default Modal component from react-native:

Only problem with this is, that it’s not possible to swipe down to dismiss (god knows why)

So I’ve tried using

<Modal
	presentationStyle="formSheet"
	hideModalContentWhileAnimating={true}
	useNativeDriver={true}
	isVisible={searchFilterModalShown}
	onDismiss={() => console.log('on dismiss')}>
	<SearchFilterView searchFilter={state.searchFilter} />
</Modal>

But

  1. this give me the LogBox warning that a “Modal with ‘formSheet’ presentation style and ‘transparent’ value is not supported.”
  2. Doesn’t look native at all. Has weird margins, has weird static shadow, has no borders and cannot be dragged down either.

I guess the styling can be fixed using style, but what I’m trying to do is make it dismissable by user gesture. Is this possible?

Thanks!

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:8
  • Comments:13

github_iconTop GitHub Comments

11reactions
nice2seeucommented, Mar 27, 2021
   <Modal
      visible={modalVisible}
      animationType="slide"
      onDismiss={() => console.log("on ddismiss")}
      onRequestClose={() => console.log("on ddismiss")}
      presentationStyle={"pageSheet"}>
      <View style={{ flex: 1 }}>
          <TouchableWithoutFeedback onPressOut={(e) => {
              if (e.nativeEvent.locationY > 150) {
                setModalVisible(false)
              }}}>
            <View>
              <Icon type='material-icon' name='drag-handle' color='#ddd' />
            </View>
          </TouchableWithoutFeedback>
        <ModalContent / > // scrollable content works fine
      </View>
    </Modal>

Hope this works for you. I also like @mrousavy’s UI … nice!

7reactions
mwegener-comcommented, Oct 22, 2021

you could use the modal mode provided by react navigation. No need of any modal component.

https://user-images.githubusercontent.com/64470126/138456413-e27eb077-08cb-4f2b-a4e9-7be1ef5aeec5.mov

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it possible to reproduce the iOS Action Sheet (formSheet ...
I was wondering if it was possible to create the native iOS formSheet/pageSheet modal using react-native-modal since the default options have a lot...
Read more >
Modal presentation in iOS - Medium
This article describes the basics of the standard iOS modality and ... The display format of a sheet; The way of controlling a...
Read more >
How to present a Bottom Sheet in iOS 15 with ... - Sarunw
Set modalPresentationStyle to sheet. We have two options, .formSheet and .pageSheet . · Set the size of the sheet. .medium() is the size...
Read more >
Customize and resize sheets in UIKit - WWDC21 - Videos
Discover how you can create a layered and customized sheet experience in UIKit. We'll explore how you can build a non- modal experience...
Read more >
iOS 14 (SwiftUI) Sheet Modals not … | Apple Developer Forums
In any case, let me give you two examples of the very same app, one reproducing the issue and the other one without...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found