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.

Bug when using Slider in BottomSheetModal

See original GitHub issue

Bug

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:

  1. To move slider in BottomSheetModal

Video link (in Android)

https://user-images.githubusercontent.com/57602380/126652126-f49102a2-48d7-4093-a0d6-5831a08b8d0a.mp4

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:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

0reactions
hristowwecommented, Aug 8, 2021

So how can i fix it?

Read more comments on GitHub >

github_iconTop 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 >

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