• Stars
    star
    131
  • Rank 266,887 (Top 6 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created about 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

React Native Binding for PanModal by SlackHQ

React Native Slack Bottom Sheet

React Native binding for Slack Bottom Sheet

Rainbow App. The first consumer of this library.

TODOs

  • Add motivation to README
  • Add gifs to README
  • Add usage example in readme
  • Add callbacks on close / open / transition
  • Describe props
  • Export more options from Slack library
  • Add stub on Android and explanation
  • Add commit name check
  • Squash commits and release
  • add typings to native component and probably some wrapper
  • Navigation bindings and adapter for android bottom-sheet

It's WIP so use it if you're brave enough.

Usage

import SlackBottomSheet from 'react-native-slack-bottom-sheet';

<SlackBottomSheet
 topOffset={100}
 unmountAnimation={false}
 initialAnimation={false}
 presentGlobally={false}
 backgroundOpacity={0}
 allowsDragToDismiss={false}
 allowsTapToDismiss={false}
 isHapticFeedbackEnabled={false}
 blocksBackgroundTouches={false}
 interactsWithOuterScrollView
>
 <View style={StyleSheet.absoluteFillObject}>
   <ScrollView>
     <Lorem />
   </ScrollView>
 </View>
</SlackBottomSheet>

Props

none of props but for children are required. If prop is experimental it means that setting it might leads to unexpected behavior. Probably I'm using most of them so don't be too concerned.

name default experimental description
allowsDragToDismiss true A flag to determine if dismissal should be initiated when swiping down on the presented view.
allowsTapToDismiss true A flag to determine if dismissal should be initiated when tapping on the dimmed background view.
anchorModalToLongForm true A flag to determine if scrolling should be limited to the longFormHeight. Set false to cap scrolling at .max height
backgroundColor #000000 The background view color
backgroundOpacity 0.7 The background view color opacity
blocksBackgroundTouches true ๐Ÿ’ ๐Ÿ’ A flag to determine if the content below background should accept touches
cornerRadius 8.0 The corner radius used when shouldRoundTopCorners is enabled
headerHeight 0 The Height of spaces on the top of modal always prioritizing dismissing over scrolling content
initialAnimation true ๐Ÿ’ A flag to determine of the component should animate on mount
interactsWithOuterScrollView false ๐Ÿ’ ๐Ÿ’ A flag to determine if ScrollView wrapping modal should accept touches. Note: works only with presentGlobally: false
isHapticFeedbackEnabled true A flag to determine if haptic feedback should be enabled during presentation.
isShortFormEnabled true A flag to determine if the short form of modal should be available
isUserInteractionEnabled true A flag to toggle user interactions on the container view. Note: Return false to forward touches to the presentingViewController.
longFormHeight maxHeight + offset The height of the pan modal container view when in the longForm presentation state. This value is capped to .max, if provided value exceeds the space available
onDidDismiss Callback on did dismiss
onWillDismiss Callback on will dismiss
onWillTransition Callback on will transition
presentGlobally true ๐Ÿ’ ๐Ÿ’ ๐Ÿ’ Bottom Sheet is presented over the whole content by default. If this flag is set to true, sheet could be presented inside another component as well
shortFormHeight 300 The height of the pan modal container view when in the shortForm presentation state. This value is capped to .max, if the provided value exceeds the space available
shouldRoundTopCorners true A flag to determine if the top corners should be rounded.
showDragIndicator true A flag to determine if a drag indicator should be shown above the pan modal container view
springDamping 0.8 The springDamping value used to determine the amount of 'bounce' seen when transitioning to short/long form
startFromShortForm false A flag to determine if the component should start from instead of long one
topOffset 42 The offset between the top of the screen and the top of the pan modal container view.
transitionDuration 0.5 The transitionDuration value is used to set the speed of animation during a transition, including initial presentation
unmountAnimation true ๐Ÿ’ A flag to determine of the component should animate on unmount
visible true ๐Ÿ’ A flag for hiding or showing modal. Basically works in the same way like mounting and unmounting.

RN Screens

It does not work with modals from RN Screens. If your app's using RN Screens unmount all bottom sheets before pushing any modals.

Installation

  1. Change platform :ios, '9.0' to platform :ios, '10.0' in Podfile

  2. Open ios/YourAppName.xcworkplace in Xcode

    Right-click on Your App Name in the Project Navigator on the left, and click New Fileโ€ฆ

    Create a single empty Swift file to the project (make sure that Your App Name target is selected when adding), and when Xcode asks, press Create Bridging Header and do not remove Swift file then.

    (detailed screenshots in installation folder)

npm install react-native-slack-bottom-sheet
cd ios && pod install && cd ..

License

MIT

More Repositories

1

react-native-reanimated-bottom-sheet

Highly configurable bottom sheet component made with react-native-reanimated and react-native-gesture-handler
TypeScript
3,298
star
2

react-native-tab-view-viewpager-adapter

Helper that allows for utilizing React Native ViewPager in React Native Tab View
TypeScript
78
star
3

react-native-spline-interpolate

Spline interpolation for React Native animations
JavaScript
70
star
4

peek-and-pop

very WIP but that's how we lives
Objective-C
65
star
5

reanimated-bottom-sheet-navigator

React Navigation integration for Reanimated Bottom Sheet
TypeScript
61
star
6

sysopy

[JAK KRADNIESZ, DAJ GWIAZDKฤ˜] This special repo is made to provide solutions for SO course
C
48
star
7

jsi-module-example

Example of building JSI module from scratch with Fresh react native project
CMake
35
star
8

instagram-cropper

TypeScript
17
star
9

slack-pan-sheet-react-native-experiment

MOVED HERE: https://github.com/osdnk/react-native-slack-bottom-sheet/
Swift
13
star
10

react-native-jsi-meets-rust

Java
12
star
11

react-native-animated-props

WIP I HACK REACT NATIVE
11
star
12

react-native-scroll-view-imitate

wish to imitate scrollview behavior for implementing bottomsheet component as a next step
JavaScript
10
star
13

appjs-workshop

Enhancing user experience with high-performance Gestures & Animations
JavaScript
9
star
14

react-native-ultimate-list-playground-2

I stolen that app from @mrousavy (coz it has a beautiful setup) - 2
Java
9
star
15

send-love

https://twitter.com/mosdnk/status/1278139142132695040
TypeScript
5
star
16

osdnk.github.io

JavaScript
4
star
17

react-native-spline-interpolate-workspace

Third order spline interpolation declarative API for React Native
JavaScript
4
star
18

react-native-paper-bottom-sheet-POC

POC of bottom-sheet made with RNGH, reanimated and react-native-paper
JavaScript
3
star
19

eslint-enforce-react-hooks

Just to ensure everyone understands how great are hooks
JavaScript
2
star
20

reanimated-examples

Some react-native-reanimated examples
JavaScript
2
star
21

rntv-976

Objective-C
2
star
22

react-native-ultimate-list-playground

I stolen that app from @mrousavy (coz it has a beautiful setup)
C++
2
star
23

react-native-blur-reanimated-example

JavaScript
2
star
24

rainbow-list

Java
1
star
25

rainbow-backend

1
star
26

svg-moving

1
star
27

PBD

Python
1
star
28

hapticly-iOS

supportive app to be compared with Hapticly
Swift
1
star
29

raspberry-pi-open-cv

Python
1
star
30

hapticly

Haptic example for Android
Kotlin
1
star
31

react-native-store-review

Rate on App Store directly in your React Native app
Objective-C
1
star
32

react-native-haptics

Library for performing haptic feedback in React Native
Java
1
star
33

FSO6

JavaScript
1
star