Skip to content

Invalid hook call. Cannot read property 'useContext' of null #847

Description

@Malberee

Description

Hello. In the initial configuration I only changed the contents of index.tsx, making it a simple component and didn't change anything else

// src/index.tsx

import { View } from 'react-native';

export const Button = () => {
  return (
    <View style={{{ width: 100, height: 100, backgroundColor: 'red' }}></View>}
  );
};

Error:
Image

Packages

  • create-react-native-library
  • react-native-builder-bob

Selected options

JavaScript library

Link to repro

.

Environment

System:
OS: Windows 11 10.0.22621
CPU: (6) x64 Intel(R) Core(TM) i5-9600KF CPU @ 3.70GHz
Memory: 2.87 GB / 15.94 GB
Binaries:
Node:
version: 23.11.1
path: C:\Program Files\nodejs\node.EXE
Yarn:
version: 3.6.1
path: ~\AppData\Roaming\npm\yarn.CMD
npm:
version: 9.6.3
path: C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK:
API Levels:
- "33"
- "34"
- "35"
Build Tools:
- 34.0.0
System Images:
- android-34 | Google APIs Intel x86 Atom_64
- android-34 | Google Play Intel x86 Atom_64
- android-TiramisuPrivacySandbox | Google Play Intel x86 Atom_64
Android NDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: AI-223.8836.35.2231.11090377
Visual Studio: Not Found
Languages:
Java:
version: 18.0.2.1
path: /c/Program Files/Common Files/Oracle/Java/javapath/javac
Ruby: Not Found
npmPackages:
"@react-native-community/cli":
installed: 18.0.0
wanted: latest
react:
installed: 19.0.0
wanted: 19.0.0
react-native:
installed: 0.79.2
wanted: 0.79.2
react-native-windows: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not found

Activity

  1. Malberee commented on May 21, 2025

    @Malberee
    Author

    #849 helped. @jkrmarmol thank you so much! I've been looking for a solution for 3 days. Hope the pull request will be accepted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions