Skip to content

Uncaught TypeError: Cannot read properties of null (reading 'getBoundingClientRect') #429

Open
@arpitmalik

Description

@arpitmalik

Getting The Error:

Uncaught TypeError: Cannot read properties of null (reading 'getBoundingClientRect')
at use-scroll-handlers.js:105:32

Code:

import {
    View,
    Text,
    TouchableOpacity,
    StyleSheet,
    ScrollView,
    Linking,
} from "react-native";
import ActionSheet, { ActionSheetRef, ScrollView as ActionSheetScrollView } from "react-native-actions-sheet";

  const handleLegal = (type: "terms" | "privacy") => {
        actionSheetRef.current?.show();
    };
    const actionSheetRef = useRef<ActionSheetRef>(null);

 <View style={{ flex: 1 }}>
            <ScrollView style={styles.container}>
                <Text style={styles.sectionTitle}>Profile</Text>
                {user ? (
                    <View style={styles.card}>
                        <Text style={styles.info}>Name: {user.name}</Text>
                        <Text style={styles.info}>Email: {user.email}</Text>
                    </View>
                ) : (
                    <Text style={styles.info}>No user logged in</Text>
                )}

                <Text style={styles.sectionTitle}>Legal</Text>
                <TouchableOpacity style={styles.option} onPress={() => handleLegal("terms")}>
                    <Text style={styles.optionText}>Terms & Conditions</Text>
                </TouchableOpacity>
            </ScrollView>

            <ActionSheet
                ref={actionSheetRef}
                gestureEnabled
                containerStyle={{ height: "80%" }}
            >
                <ActionSheetScrollView>
                    <Text style={styles.sheetText}>T&C content goes here...</Text>
                    <Text style={styles.sheetText}>Privacy Policy content goes here...</Text>
                </ActionSheetScrollView>
            </ActionSheet>
        </View>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions