NativeScript / NativeScript/NativeScript
Project unable to build when using native api in code-sharing project
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 25.7k
- Forks
- 1.7k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 35
Description
Environment
- CLI: 6.3.3
- Cross-platform modules: 6.3.2
- Android Runtime:
- iOS Runtime: 6.3.0
- Plugin(s):
Describe the bug
Unable to build when using native api (iOS) in angular code sharing project. I have tried using multiple different ios specific functions and classes but I always get the same error. "Cannot find name ..."
When trying to access the same function in a regular project (non-code sharing) everything works as expected.
To Reproduce
- Create a code-sharing project.
- Install tns-platform-declarations (https://www.npmjs.com/package/tns-platform-declarations)
- Write some code that interacts with the native api.
- Build/Run
Expected behavior
The code-sharing project should build just like the regular one.
Sample project
https://github.com/johandrott/ns-codesharing
Additional context
Console output:
ERROR in src/app/home/home.component.tns.ts:9:21 - error TS2304: Cannot find name 'UIVisualEffectView'.
9 public overlay: UIVisualEffectView;
~~~~~~~~~~~~~~~~~~
src/app/home/home.component.tns.ts:19:22 - error TS2304: Cannot find name 'UIApplication'.
19 const window = UIApplication.sharedApplication.keyWindow;
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked sample project and src/app/home/home.component.tns.ts, then reproduce the Angular code-sharing build after installing tns-platform-declarations. Trace why UIVisualEffectView and UIApplication are unavailable in the TypeScript build; done means the sample builds and the native API references resolve as they do in a regular project.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, ios, typescript
- Domain
- build-system, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100