created the new npm and react-native-textInputBox for learning purpose and try to run that multiply in the other Project getting the error

未关闭
#945 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
30/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
javascript, react-native, typescript
领域
mobile, tooling

调研方向

首先,使用 multiply 导入复现已发布的 react-native-textinputbox 0.1.0 示例,并检查 lib/commonjs/index.js 以及 lib/typescript/module/src/index.d.ts。先检查生成的 package 和 native module 注册;当 multiply 能够在没有 Textinputbox 错误的情况下运行,并且 TypeScript 能够根据报告的 module 设置解析声明文件时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

I created a new npm package react-native-textinputbox for learning purposes using the create-react-native-library tool. After publishing the library, I tried using it in another project and encountered an issue when calling the multiply function from the library. I'm seeing the following error:

Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'Textinputbox' could not be found. Verify that a module by this name is registered in the native binary.

Could not find a declaration file for module 'react-native-textinputbox'. '.../node_modules/react-native-textinputbox/lib/commonjs/index.js' implicitly has an 'any' type.
There are types at '.../node_modules/react-native-textinputbox/lib/typescript/module/src/index.d.ts', but this result could not be resolved under your current 'moduleResolution' setting.

there is not typeScript Support as well
Screenshot 2025-01-14 at 11 06 27 AM
Screenshot 2025-01-14 at 11 06 41 AM

Steps to Reproduce:

Create a new npm package react-native-textinputbox using create-react-native-library.
Publish the package to npm.
Install the package in another React Native project.
Import the multiply function from react-native-textinputbox:
javascript
Copy code
import { multiply } from 'react-native-textinputbox';
Call the multiply function like so:
javascript
Copy code
const result = multiply(3, 7);
console.log(result);
Run the app and observe the errors.

Expected Behavior: The multiply function should work as expected without throwing errors, and the TypeScript declaration files should resolve correctly.

Environment:

react-native-textinputbox: 0.1.0
React Native: 0.76.5
TypeScript: 0.76.5
Expo (if applicable): 2.0.53

Possible Solution:
the default example should work as normal comes with the code and not ts support.
it should have the ts support.

主要语言
JavaScript
星标
13.2k
派生
1.3k
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

expo/create-react-native-app 的其他 Issue

查看 expo/create-react-native-app 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。