Comments (9)
This is how I have done it. It covers both dynamic content and react navigation bottom tab.
-
Create bottom sheet provider
-
Create main stack navigator(somehow bottom sheet doesn't work if tab navigator is not wrapped in a stack navigator)
-
Create tab navigator and wrap it inside the bottom sheet provider
Have created a repository for reference: https://github.com/nkbhasker/react-navigation-bottomsheet
from react-native-reanimated-bottom-sheet.
@roshangm1 I use something like that:
// define renderContent func with useCallback hook and don't forget to set dependencies
const renderContent = useCallback(() => <SomeJSX />, [...dependenciesForSomeJSX])
<BottomSheet
// BottomSheet will get new `renderContent` prop and rerender if dependenciesForSomeJSX will change
renderContent={renderContent}
/>
from react-native-reanimated-bottom-sheet.
@osdnk I think this issue can be closed
from react-native-reanimated-bottom-sheet.
useCallback
is unnecessary here and won't change anything because the BottomSheet
component is not a PureComponent
from react-native-reanimated-bottom-sheet.
all right, than you can use wrapper like:
const PureBottomSheet = React.memo((props) => <BottomSheet {...props} />)
from react-native-reanimated-bottom-sheet.
It's very likely that render will be called when you're changing something. If you're not changing something and your component is being re-rendered, it's probably good idea to add memo higher on the tree
from react-native-reanimated-bottom-sheet.
Agree, but if parent component render something besides BottomSheet and it's content, I would recommend to make a pure wrapper if one care about performance
from react-native-reanimated-bottom-sheet.
can someone share a "best-practice" here on how to dynamically render content on BottomSheet ?
@satya164 Im using navigation v5. Would you recommend to place a global BottomSheet (with dynamic content) beside Stack.Navigator ?
from react-native-reanimated-bottom-sheet.
@nkbhasker i'm trying your solution but i'm having issues with the fact that onOpenStart
and onCloseEnd
are not being called, i'm also unable to close the bottom sheet after it opened. Did you also encounter these issues?
Edit: I figured it out, the amount of snap points need to stay the same, I had default 2 snap points and updated it to 3, now I changed the default to 3 and everything works nice.
from react-native-reanimated-bottom-sheet.
Related Issues (20)
- Bottomsheet is under other components
- use in react js app HOT 1
- Bottomsheet automatically opening and closing on rotation HOT 1
- how to scroll list to the bottom? HOT 1
- Overlay HOT 2
- Property 'snapToIndex' does not exist on type 'never'.ts(2339) HOT 2
- Is the package still maintained? HOT 1
- BottomSheet is overlapping the Content
- can't run in RN-cli HOT 1
- enabledGestureInteraction Prop
- not working in RN 0.69 HOT 4
- FlatList wont Scroll Till end of screen HOT 4
- Is this community still active? HOT 1
- BottomSheet import from react-native-reanimated-bottom-sheet is not available in RN 0.69.1 HOT 1
- Drag not working at all
- Preventing keyboard from dismissing with FlatList in BottomSheet
- How to set content height dynamically based on content?
- export 'default'.'Code' (imported as 'Animated') was not found in 'react-native-reanimated' HOT 2
- reanimated-bottom-sheet & react-native-reanimated HOT 4
- Cannot read property 'prototype' of undefined HOT 18
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-reanimated-bottom-sheet.