Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Not supporting Expo SDK 52 #1249

Open
2 tasks done
thinkbix opened this issue Nov 15, 2024 · 5 comments
Open
2 tasks done

🐛 Not supporting Expo SDK 52 #1249

thinkbix opened this issue Nov 15, 2024 · 5 comments
Labels

Comments

@thinkbix
Copy link

Prerequisites

  • I checked the documentation and FAQ without finding a solution
  • I checked to make sure that this issue has not already been filed

Expected Behavior

Getting in so many libraries, But sending any one

@expo/[email protected]
node_modules/@expo/metro-config
@expo/metro-config@"^0.19.4" from the root project
@expo/metro-config@"~0.19.0" from @expo/[email protected]
node_modules/@expo/cli
@expo/cli@"0.21.5" from [email protected]
node_modules/expo
expo@"^52.0.7" from the root project
@expo/metro-config@"0.19.4" from [email protected]
node_modules/expo
expo@"^52.0.7" from the root project

@expo/[email protected]
node_modules/react-native-ble-plx/node_modules/@expo/metro-config
@expo/metro-config@"0.18.11" from @expo/[email protected]
node_modules/react-native-ble-plx/node_modules/@expo/cli
@expo/cli@"0.18.31" from [email protected]
node_modules/react-native-ble-plx/node_modules/expo
expo@"^51.0.14" from [email protected]
node_modules/react-native-ble-plx
react-native-ble-plx@"^3.2.1" from the root project
@expo/metro-config@"0.18.11" from [email protected]
node_modules/react-native-ble-plx/node_modules/expo
expo@"^51.0.14" from [email protected]
node_modules/react-native-ble-plx
react-native-ble-plx@"^3.2.1" from the root project

Current Behavior

BLE Library Working but getting warnings and all

Library version

3.2.1

Device

iPhone 15 Pro, Android 8.0

Environment info

expo-env-info 1.2.1 environment info:
    System:
      OS: macOS 12.7.6
      Shell: 5.8.1 - /bin/zsh
    Binaries:
      Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
      Yarn: 1.22.22 - ~/.nvm/versions/node/v20.11.1/bin/yarn
      npm: 10.9.0 - ~/.nvm/versions/node/v20.11.1/bin/npm
      Watchman: 2024.08.26.00 - /usr/local/bin/watchman
    Managers:
      CocoaPods: 1.15.2 - /usr/local/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
      Android SDK:
        API Levels: 23, 25, 26, 29, 30, 31, 32, 33, 34
        Build Tools: 23.0.2, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 27.0.0, 27.0.1, 27.0.3, 28.0.3, 29.0.2, 29.0.3, 30.0.2, 30.0.3, 32.0.0, 33.0.1, 34.0.0
        System Images: android-23 | Google APIs Intel x86 Atom, android-24 | Google Play Intel x86 Atom, android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom, android-32 | Google APIs Intel x86 Atom_64
        Android NDK: 22.1.7171670
    IDEs:
      Android Studio: 2022.2 AI-222.4459.24.2221.10121639
      Xcode: 14.2/14C18 - /usr/bin/xcodebuild
    npmPackages:
      @expo/metro-config: ^0.19.4 => 0.19.4 
      expo: ^52.0.0 => 52.0.6 
      expo-router: ~4.0.5 => 4.0.5 
      react: 18.3.1 => 18.3.1 
      react-dom: 18.3.1 => 18.3.1 
      react-native: ^0.76.1 => 0.76.1 
    npmGlobalPackages:
      eas-cli: 13.2.1
      expo-cli: 6.3.12
    Expo Workflow: managed

Steps to reproduce

Formatted code sample or link to a repository

// Start Scanning
    const bleManager = new BleManager();

    // Bluetooth Permission
    const requestBluetoothPermissions = async (): Promise<boolean> => {
        if (Platform.OS === 'android') {
            // const granted = await PermissionsAndroid.request(
            //     PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION
            // );
            // return granted === PermissionsAndroid.RESULTS.GRANTED;
            try {
                const permissions = [
                    PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
                    PermissionsAndroid.PERMISSIONS.BLUETOOTH_SCAN,
                    PermissionsAndroid.PERMISSIONS.BLUETOOTH_CONNECT,
                ];

                const granted = await PermissionsAndroid.requestMultiple(permissions);

                if (
                    granted['android.permission.ACCESS_FINE_LOCATION'] === PermissionsAndroid.RESULTS.GRANTED &&
                    granted['android.permission.BLUETOOTH_SCAN'] === PermissionsAndroid.RESULTS.GRANTED &&
                    granted['android.permission.BLUETOOTH_CONNECT'] === PermissionsAndroid.RESULTS.GRANTED
                ) {
                    return true;
                } else {
                    Alert.alert('Permissions Denied', 'Bluetooth permissions are required to connect to devices.');
                    return false;
                }
            } catch (error) {
                Alert.alert('Error', 'Failed to request permissions');
                return false;
            }
        }
        return true;
    }

    // Handle Scan Printers
    const handleScanPrinters = async () => {
        const permissionsGranted = await requestBluetoothPermissions();
        if (!permissionsGranted) return;

        // Set Flag
        setScanning(true);
        handleHapticFeedback();

        try {
            bleManager.startDeviceScan(null, null, (error: BleError | null, device: Device | null) => {
                if (error && error?.reason) {
                    Alert.alert(`${error?.errorCode}`, `${error.reason}`);
                    setScanning(false);
                    return;
                }
                // Only proceed if device has both id and name
                if (device && device.name && device.id) {
                    setPrinters((prevList) => {
                        const deviceExists = prevList.some((d) => d.id === device.id);
                        if (!deviceExists) {
                            return [...prevList, { id: device.id, name: device.name }];
                        }
                        return prevList;
                    });
                }
            });
            setTimeout(() => {
                bleManager.stopDeviceScan();
                setScanning(false);
            }, 15000);
        } catch (error: any) {
            Alert.alert('Error!', `${error.message}`);
            setScanning(false);
        } finally {
            // bleManager.destroy();
            // setScanning(false);
        }
    }

    // Handle Printer
    const handlePrinter = async (id: string) => {
        setPrinterId(id);
        handleHapticFeedback();
        return;
    }

Relevant log output

Getting issues in below libraries just because of BLE library

The package "expo-modules-autolinking" should not be installed directly in your project. It is a dependency of other Expo packages, which will install it automatically as needed.

Expected package expo-modules-autolinking@~2.0.0
Found invalid:
  [email protected]
  (for more info, run: npm why expo-modules-autolinking)
Expected package @expo/config-plugins@~9.0.0
Found invalid:
  @expo/[email protected]
  (for more info, run: npm why @expo/config-plugins)
Expected package @expo/prebuild-config@~8.0.0
Found invalid:
  @expo/[email protected]
  (for more info, run: npm why @expo/prebuild-config)
Expected package @expo/metro-config@~0.19.0
Found invalid:
  @expo/[email protected]
  (for more info, run: npm why @expo/metro-config)

Additional information

No response

@thinkbix thinkbix added the bug label Nov 15, 2024
@akhockey21
Copy link

I've added a PR:
#1250

@thinkbix
Copy link
Author

I've added a PR: #1250

Is it solved? If yes then please guide me what i have to do at my end?

@akhockey21
Copy link

I've added a PR: #1250

Is it solved? If yes then please guide me what i have to do at my end?

Until the PR is merged, feel free to just update your package.json dep with this:
"react-native-ble-plx": "github:akhockey21/react-native-ble-plx",

@g-otn
Copy link

g-otn commented Nov 26, 2024

Shouldn't expo and @expo/config-plugins be peerDependencies anyways? The problem (two different expo versions installed) wouldn't happen then.

@g-otn
Copy link

g-otn commented Nov 26, 2024

As a workaround, you may update react-native-ble-plx dependencies using npm overrides (or yarn resolutions, etc):

// package.json
{
  // ...
  "dependencies": {
    "expo": "~52.0.10"
    // ...
  },
  "overrides": {
    "react-native-ble-plx": {
      "expo": ">=51.0.14",
      "@expo/config-plugins": ">=7.2.5"
    }
   // ...
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants