Bug when using Slider in BottomSheetModal
See original GitHub issueBug
I am tring to use Slider component from this link github but it cant slide . I can slide only on Iphone but in Android it wont work. I will upload video –>
Environment info
Library | Version |
---|---|
@gorhom/bottom-sheet | 3.6.6 |
react-native | 0.64.2 |
react-native-reanimated | 2.2.0 |
react-native-gesture-handler | 1.10.3 |
Steps To Reproduce
1.Fix slider to working with BottomSheetModal
Describe what you expected to happen:
- To move slider in BottomSheetModal
Video link (in Android)
import React, { useCallback, useMemo, useRef } from "react";
import { View, StyleSheet, Button, Image } from "react-native";
import {
BottomSheetModal,
BottomSheetModalProvider,
} from "@gorhom/bottom-sheet";
import Slider from "@react-native-community/slider";
const App = () => {
// ref
const bottomSheetModalRef = useRef(null);
// variables
const snapPoints = useMemo(() => ["25%", "35%"], []);
// callbacks
const handlePresentModalPress = useCallback(() => {
bottomSheetModalRef.current?.present();
}, []);
const handleSheetChanges = useCallback((index) => {
console.log("handleSheetChanges", index);
}, []);
// renders
return (
<BottomSheetModalProvider>
<View style={styles.container}>
<Button
onPress={handlePresentModalPress}
title="Present Modal"
color="black"
/>
<BottomSheetModal
ref={bottomSheetModalRef}
index={1}
snapPoints={snapPoints}
onChange={handleSheetChanges}
>
<View style={styles.contentContainer}>
<View
style={{
flexDirection: "row",
justifyContent: "center",
alignContent: "center",
}}
>
<Image
source={require("./assets/sun.png")}
style={{
width: 20,
height: 20,
top: 10,
opacity: 0.7,
right: 5,
justifyContent: "center",
}}
/>
<Slider
style={{ width: "70%", height: 40 }}
minimumValue={0}
maximumValue={1}
minimumTrackTintColor="gray"
maximumTrackTintColor="#000000"
thumbTintColor="gray"
/>
<Image
source={require("./assets/sun.png")}
style={{ width: 26, height: 26, top: 8, left: 5 }}
/>
</View>
<View
style={{
flexDirection: "row",
justifyContent: "center",
alignContent: "center",
}}
></View>
</View>
</BottomSheetModal>
</View>
</BottomSheetModalProvider>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
padding: 24,
justifyContent: "center",
backgroundColor: "grey",
},
contentContainer: {
flex: 1,
},
});
export default App;
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
[v4] performance issue BottomSheetModal with react-native ...
Bug I'm having a big problem when using react-native-multi-slider with BottomSheetModal، When scrolling on the slider it consumes RAM, ...
Read more >Troubleshooting | React Native Bottom Sheet - GitHub Pages
This section attempts to outline issues that users frequently encounter when first getting accustomed to using React Native Bottom Sheet.
Read more >How to Move bottomsheet along with keyboard which has ...
The below written was a bug. UPDATED 2020! This answer is true, but you don't have to give bottom padding now! Find and...
Read more >Creating and styling a modal bottom sheet in React Native
In this tutorial, we'll create a basic application with a modal bottom sheet feature. We'll set up the app, fetch data, and style...
Read more >Ion-Slides: Mobile Touch Slider with Built-In & Custom Animation
Ion-Slides is a multi-section container which offers custom and built-in mobile touch slider animation effects. See how Ion-Slides works with iOS and ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@hristowwe in this case you need to use
activeOffsetY
&failOffsetX
, look at https://github.com/gorhom/react-native-bottom-sheet/blob/18a32e5979d22a693734d1af7fef6cc9887cea67/example/src/screens/integrations/ViewPagerExample.tsx#L12-L19So how can i fix it?