mirror of
https://github.com/zhigang1992/nativewind.git
synced 2026-06-15 10:17:54 +08:00
fix: react is not defined in some environments
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "1.0.0",
|
||||
"version": "0.0.0",
|
||||
"name": "tailwindcss-react-native",
|
||||
"description": "Use Tailwindcss in your cross-platform React Native applications",
|
||||
"main": "dist/index.js",
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import { createContext, PropsWithChildren, useContext, useState } from "react";
|
||||
import React, {
|
||||
createContext,
|
||||
PropsWithChildren,
|
||||
useContext,
|
||||
useState,
|
||||
} from "react";
|
||||
import { Appearance, ColorSchemeName } from "react-native";
|
||||
|
||||
export interface ColorSchemeContext {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { createContext, PropsWithChildren, useContext } from "react";
|
||||
import React, { createContext, PropsWithChildren, useContext } from "react";
|
||||
import { useWindowDimensions } from "react-native";
|
||||
import { useDeviceOrientation } from "@react-native-community/hooks";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { createContext, PropsWithChildren, useContext } from "react";
|
||||
import React, { createContext, PropsWithChildren, useContext } from "react";
|
||||
import { Platform } from "react-native";
|
||||
|
||||
export interface PlatformContext {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as React from "react";
|
||||
import React from "react";
|
||||
import { PropsWithChildren } from "react";
|
||||
import { ColorSchemeName, Platform } from "react-native";
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import * as React from "react";
|
||||
import React from "react";
|
||||
import { styled } from "./styled";
|
||||
import { StyledProps } from "./utils/styled";
|
||||
|
||||
@@ -10,6 +9,7 @@ export type StyledComponentProps<P> = StyledProps<P> & {
|
||||
export const StyledComponent = React.forwardRef(
|
||||
({ component, ...options }, ref) => {
|
||||
const Component = styled(component);
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
return <Component {...(options as any)} ref={ref as any} />;
|
||||
}
|
||||
) as <T, P>(
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"esModuleInterop": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "react-native",
|
||||
"jsx": "react",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "dist",
|
||||
"strict": true,
|
||||
|
||||
Reference in New Issue
Block a user