我正在尝试使用类似于iMessage的布局创建消息传递视图,其中聊天"气泡"是其内容的大小,直到它达到一定的宽度.像这样:

使用nativescript,我无法找到适合这种情况的布局.我尝试使用GridLayout,但列的自动性质似乎意味着它将是内容的大小,即使内容的大小超出视图范围.
<GridLayout width="100%" columns="40, auto" rows="auto, 20" class="msg them" visibility="{{is_me ? 'collapsed' : 'visible'}}">
<Image class="authorimg" col="0" stretch="aspectFill" verticalAlignment="top" src="{{user.profile_photo ? user.profile_photo.sizes.tiny_square : ''}}" />
<StackLayout class="msg_text" col="1">
<Label text="{{message}}" textWrap="true" verticalAlignment="top" />
</StackLayout>
<Label class="msg_timestamp" text="{{author}}" verticalAlignment="top" row="1" colSpan="2" />
</GridLayout>
Run Code Online (Sandbox Code Playgroud)
这产生了这个:

请注意,尽管Label上的textWrap = true,但较长的不会换行.
硬币的另一面是这样的:
<GridLayout width="100%" columns="40, *" rows="auto, 20" class="msg them" visibility="{{is_me ? 'collapsed' : 'visible'}}">
<Image class="authorimg" col="0" stretch="aspectFill" verticalAlignment="top" src="{{user.profile_photo ? user.profile_photo.sizes.tiny_square : ''}}" />
<StackLayout class="msg_text" col="1">
<Label text="{{message}}" textWrap="true" verticalAlignment="top" /> …Run Code Online (Sandbox Code Playgroud) 对于该项目,我们当前正在使用带有angular2的本机脚本启动,单元测试对我们来说至关重要。因此,我首先尝试为给定的Groceries示例实现一些简单的操作,以使其更实用。非常简单的测试,例如测试电子邮件地址的验证是否正常,并且执行起来并不繁琐。一旦我开始进行更复杂的测试,就只有在涉及Testbed时才出现错误。
这是我在Testbed上执行的最简单的启动实现:
import "reflect-metadata";
import 'nativescript-angular/zone.js/dist/zone-nativescript';
import {TestBed} from '@angular/core/testing';
import { UserService } from "../../../shared/user/user.service";
declare var describe: any;
declare var expect: any;
declare var it: any;
declare var beforeEach: any;
describe('UserService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [UserService]
});
});
it("just testing", () => {
console.log('hier');
expect(false).toBe(false);
});
});
Run Code Online (Sandbox Code Playgroud)
这是我运行该错误时会收到的那种错误:
sampleGroceries[66839]: CONSOLE LOG file:///app/tests/shared/user/user.service.spec.js:13:20: hier
NativeScript / 10.0 (10.0; iPhone) A suite contains spec with an expectation FAILED
TypeError: undefined is not an object (evaluating 'ProxyZoneSpec.assertPresent') …Run Code Online (Sandbox Code Playgroud) 我正在尝试为Android创建一个Angular 2组件,用于显示特定路径的内容.为此,我创建了以下app-routing.module:
@NgModule({
imports: [
NativeScriptRouterModule.forRoot([
{ path: '', component: HomeComponent },
{ path: 'folder-content/:path', component: FolderContentComponent },
])
],
exports: [NativeScriptRouterModule]
})
Run Code Online (Sandbox Code Playgroud)
为了完整性,这里是folder-content.xml的xml
<StackLayout>
<GridLayout row="auto, *" row="2">
<ListView [items]="getContent(currentPath)">
<template let-item="item">
<GridLayout columns="auto, *" [nsRouterLink]="['/folder-content', item.path]">
<GridLayout columns="auto" rows="auto" cssClass="favorite-wrap">
<Image id="imgFav" [src]="item.isFile() ? 'res://ic_add_to_fav_1': 'res://folder'" stretch = "none" cssClass="icon-image"></Image>
</GridLayout>
<StackLayout col="1">
<Label [text]="item.name" cssClass="info-bigger"></Label>
<Label [text]="item.path" cssClass="info-orange"></Label>
</StackLayout>
</GridLayout>
</template>
</ListView>
</GridLayout>
</StackLayout>
Run Code Online (Sandbox Code Playgroud)
每次点击列表项时,我都想导航到同一页面,但是使用不同的参数(这可以按预期工作).
问题是当我尝试向后导航(使用物理后退按钮)时,我被重定向到HomeComponent而不是FolderContentComponent.
我尝试使用以下代码段打印路由器事件以获取更多信息:
router.events.forEach((event) => {
console.log(event);
});
Run Code Online (Sandbox Code Playgroud)
当从默认路径导航到 …
Android 和 iOS 的不同版本的操作系统有不同大小的状态栏。使用本机脚本,我怎样才能算出这个高度是多少?
我需要它,这样我就可以在应用程序的顶部添加一个与状态栏大小相同的填充,否则它会与我的应用程序内容的不同数量重叠。
我曾经运行命令:tns run android --bundle。当我保存更改时,它们会在物理和虚拟 Android 模拟器中自动更新。
现在,当我保存更改时,没有任何反应,必须再次运行命令才能查看更改。
当我保存项目时,出现以下消息:
File change detected. Starting incremental webpack compilation...
Hash: 2e482eb5460af6f4127a
Version: webpack 4.27.1
Time: 1119ms
Built at: 12/04/2019 11:31:32 AM
Asset Size Chunks Chunk Names
a3a53c6e399658f9e1f5.hot-update.json 48 bytes [emitted]
bundle.a3a53c6e399658f9e1f5.hot-update.js 10.1 KiB bundle [emitted] bundle
bundle.js 892 KiB bundle [emitted] bundle
runtime.js 71.4 KiB runtime [emitted] runtime
+ 1 hidden asset
Entrypoint bundle = runtime.js vendor.js bundle.js bundle.a3a53c6e399658f9e1f5.hot-update.js
[../node_modules/nativescript-dev-webpack/style-hot-loader.js!../node_modules/nativescript-dev-webpack/apply-css-loader.js!../node_modules/css-loader/dist/cjs.js?!../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../node_modules/vue-loader/lib/index.js?!./pages/VistaPrueba.vue?vue&type=style&index=0&id=f4390c96&scoped=true&lang=css&] ../node_modules/nativescript-dev-webpack/style-hot-loader.js!../node_modules/nativescript-dev-webpack/apply-css-loader.js!../node_modules/css-loader/dist/cjs.js??ref--1-2!../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../node_modules/vue-loader/lib??vue-loader-options!./pages/VistaPrueba.vue?vue&type=style&index=0&id=f4390c96&scoped=true&lang=css& 1.26 KiB {bundle} [built]
[../node_modules/ts-loader/index.js?!../node_modules/vue-loader/lib/index.js?!./pages/VistaPrueba.vue?vue&type=script&lang=ts&] ../node_modules/ts-loader??ref--4!../node_modules/vue-loader/lib??vue-loader-options!./pages/VistaPrueba.vue?vue&type=script&lang=ts& 1.12 KiB {bundle} [built]
[../node_modules/vue-loader/lib/loaders/templateLoader.js?!../node_modules/vue-loader/lib/index.js?!./pages/VistaPrueba.vue?vue&type=template&id=f4390c96&scoped=true&] …Run Code Online (Sandbox Code Playgroud) 我想使用来自 google 和 facebook 的身份验证插件
我想放入Info.plist
对于谷歌:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>REVERSED_CLIENT_ID</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.1052836194035-l81fsjai1u40ocnqjcpnoebnnsltt03b</string>
</array>
</dict>
</array>
Run Code Online (Sandbox Code Playgroud)
对于脸书:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb{your-app-id}</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>{your-app-id}</string>
<key>FacebookDisplayName</key>
<string>{your-app-name}</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-share-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
Run Code Online (Sandbox Code Playgroud)
如何在一个 Info.plist 中同时使用两者?
当我在 facebook 中删除 CFBundleURLTypes 时,在控制台中显示错误:解析时缺少密钥
有什么想法吗?
我无法向我的 Nativescript 项目添加新组件,当我执行ng generate component faqs它时返回错误:
Option "entryComponent" is deprecated: Since version 9.0.0 with Ivy, entryComponents is no longer necessary.
Cannot read property 'kind' of undefined
Run Code Online (Sandbox Code Playgroud)
或者如果我运行它就像ng generate component它问我组件名称一样
? What name would you like to use for the component? faqs
Run Code Online (Sandbox Code Playgroud)
并返回
Option "entryComponent" is deprecated: Since version 9.0.0 with Ivy, entryComponents is no longer necessary.
Cannot read property 'match' of undefined
Run Code Online (Sandbox Code Playgroud)
我在用:
Nativescript 7.0.10
Angular CLI: 10.1.4
Node: 12.18.4
OS: win32 x64
Angular: 10.1.4
... …Run Code Online (Sandbox Code Playgroud) 在 IOS 上也遇到了构建问题,“为 iOS 模拟器构建,但在为 iOS 构建的 dylib 中链接,文件‘.../platforms/ios/Pods/CouchbaseLite/iOS/CouchbaseLite.framework/CouchbaseLite’用于架构 arm64”
我目前使用的是nativescript 6.5.3 和cocoapod 1.10。采用M1芯片组。
我目前正在尝试使用 Nx monorepo 工具设置一个多平台代码共享入门项目。该项目将 Angular 用于 Web,并使用 NativeScript 用于跨平台移动设备。
\n理想情况下,我希望能够使用 Jest 来运行所有单元测试。目前,我可以使用根目录中的 jest 成功运行单元测试。它们对于 Angular 应用程序及其库正确执行,但在尝试为 NativeScript (NativeScript Angular) 项目执行单元测试时遇到错误,特别是当这些单元测试导入 NativeScript 组件时(即实际上有用)。也就是说,虚拟测试期望true能够true正常工作,因此 Jest 可以毫无问题地找到并运行测试。但是当我尝试导入组件时,我遇到了问题。
我已经解决了一些问题。最初我收到的错误是:
\n \xe2\x97\x8f Test suite failed to run\n\n Jest encountered an unexpected token\n\n This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.\n\n By default, if Jest sees a Babel config, it will use that to transform your files, ignoring …Run Code Online (Sandbox Code Playgroud) 我是 Svelte Native 的新手。我正在遵循文档上的快速入门步骤。安装nativescript和创建新的 Svelte-Native 应用程序npx degit halfnelson/svelte-native-template myapp没有问题。
但是,在我cd myapp运行之后ns preview(立即继续上面的屏幕截图):
注意:我在第二次尝试时做了,因为我在文档的屏幕截图上看到了这一点,只是为了测试它并看看它是否会工作(但它也没有)。tnspreview
那么我应该等到预览服务启用吗?如果没有,我不知道如何配置本地构建并使用“ns run”代替。我该怎么做?
nativescript ×10
angular ×3
ios ×3
typescript ×3
android ×1
cocoapods ×1
firebase ×1
info.plist ×1
jasmine ×1
jestjs ×1
label ×1
nrwl ×1
styling ×1
unit-testing ×1
vue.js ×1
xcode ×1
xcode12 ×1