在初始化新项目然后启动x-code模拟器时获取以下消息."React-Native Version Mismatch"Javascript版本0.50.1原生版本:0.50.0
确保您已重建本机代码...
有谁知道这里发生了什么,可以帮助我吗?
谢谢!
我在React Navigation和React Native 的导航方面遇到了问题.它是关于重置导航并返回主屏幕.
我在DrawerNavigator中构建了一个StackNavigator,主屏幕和其他屏幕之间的导航工作正常.但问题是,导航堆栈的增长和增长.我不知道如何从堆栈中删除屏幕.
例如,当从主屏幕进入设置屏幕,然后进入输入屏幕并最后再次进入主屏幕时,主屏幕在堆栈中是两次.使用后退按钮我不会离开应用程序,但再次进入输入屏幕.
再次选择主页按钮时,堆栈的重置会很好,但我不知道如何执行此操作.这里有人试图帮助其他有类似问题的人,但解决方案对我不起作用.
const Stack = StackNavigator({
Home: {
screen: Home
},
Entry: {
screen: Entry
},
Settings: {
screen: Settings
}
})
export const Drawer = DrawerNavigator({
Home: {
screen: Stack
}},
{
contentComponent: HamburgerMenu
}
)
Run Code Online (Sandbox Code Playgroud)
这是抽屉屏幕的一个简单示例
export default class HamburgerMenu extends Component {
render () {
return <ScrollView>
<Icon.Button
name={'home'}
borderRadius={0}
size={25}
onPress={() => { this.props.navigation.navigate('Home')}}>
<Text>{I18n.t('home')}</Text>
</Icon.Button>
<Icon.Button
name={'settings'}
borderRadius={0}
size={25}
onPress={() => { this.props.navigation.navigate('Settings')}}>
<Text>{I18n.t('settings')}</Text>
</Icon.Button>
<Icon.Button …Run Code Online (Sandbox Code Playgroud) 我想回去两个屏幕.目标是从EditPage去Cover.这是我的导航堆栈:
Main -> Cover -> EditCover -> EditPage
我阅读了文档,它说要提供你想要返回的屏幕的键,这是我的代码:
this.props.navigation.dispatch(NavigationActions.back({key: 'EditCover'}));
Run Code Online (Sandbox Code Playgroud)
我也尝试过(没有运气):
this.props.navigation.dispatch(NavigationActions.back('EditCover'));
this.props.navigation.dispatch(NavigationActions.back({key: 'EditCover'}));
this.props.navigation.dispatch(NavigationActions.back({routeName: 'EditCover'}));
this.props.navigation.goBack('EditCover');
this.props.navigation.goBack({key: 'EditCover'});
this.props.navigation.goBack({routeName: 'EditCover'});
Run Code Online (Sandbox Code Playgroud)
关于这一切的有趣之处在于我没有错误.调用代码时没有任何反应......
PS如果我想回到一个屏幕,这段代码工作正常:
this.props.navigation.goBack(null);
Run Code Online (Sandbox Code Playgroud)
PSS如果在有解决方案之前有人遇到过此问题.这个黑客现在有效:
this.props.navigation.goBack(null);
this.props.navigation.goBack(null);
Run Code Online (Sandbox Code Playgroud) 我有一个角度4.3.5应用程序,它使用一段时间后变得更慢(约20分钟).
我的情景如下:
发生了什么:
附加信息:
提出问题的组件如下:
import { Component, OnInit, OnDestroy } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import 'rxjs/add/operator/takeUntil';
import { Subject } from 'rxjs/Subject';
import { SweetAlertService } from 'ng2-cli-sweetalert2';
import { ApiService } from '.././api.service';
import { NFCService } from '.././nfc.service';
@Component({
selector: 'app-menu',
templateUrl: './menu.component.html',
styleUrls: ['./menu.component.scss']
})
export class MenuComponent implements OnInit, OnDestroy {
private …Run Code Online (Sandbox Code Playgroud) <html>
<body>
<div class="main">
<div class="submain"><h2></h2><p></p><ul></ul>
</div>
<div class="submain"><h2></h2><p></p><ul></ul>
</div>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我把html加载到了HtmlDocument.然后我选择了XPath作为submain.然后,我不知道如何访问到每个标签,即h2,p分别.
HtmlAgilityPack.HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes("//div[@class=\"submain\"]");
foreach (HtmlAgilityPack.HtmlNode node in nodes) {}
Run Code Online (Sandbox Code Playgroud)
如果我使用node.InnerText我得到所有文本,InnerHtml也没用.如何选择单独的标签?
我想Component从.vue文件中导出几个接口。
基本.vue:
<template>
<div class="app">
<router-view></router-view>
</div>
</template>
<script lang="ts">
import { Vue, Component } from "vue-property-decorator";
export interface IBasic {
name :string;
}
/**
* Simplest container
*/
@Component
export class Basic extends Vue {}
export default Basic;
</script>
Run Code Online (Sandbox Code Playgroud)
但是当我从另一个.ts文件导入它时,我得到:
我该怎么做才能成功导入接口?
我正在寻找一种拥有嵌套对象的所有键/值对的方法。
(用于 MongoDB 点符号键/值类型的自动完成)
interface IPerson {
name: string;
age: number;
contact: {
address: string;
visitDate: Date;
}
}
Run Code Online (Sandbox Code Playgroud)
这就是我想要实现的目标,使其成为:
type TPerson = {
name: string;
age: number;
contact: { address: string; visitDate: Date; }
"contact.address": string;
"contact.visitDate": Date;
}
Run Code Online (Sandbox Code Playgroud)
在这个答案中,我可以得到密钥Leaves<IPerson>。于是就变成了'name' | 'age' | 'contact.address' | 'contact.visitDate'。
在 @jcalz 的另一个答案中,我可以通过DeepIndex<IPerson, ...>.
是否有可能将它们组合在一起,成为类似的类型TPerson?
当我开始这个问题时,我在想它可以像这样简单[K in keyof T]: T[K];,只需进行一些巧妙的转换。但是我错了。这是我需要的:
所以界面
interface IPerson { …Run Code Online (Sandbox Code Playgroud) javascript mongodb mongodb-query typescript typescript-generics
我搜索了很多网站,但找不到实际适用于react-native + flow类型的教程.
来自react-native@0.22文件的流量安装指南,但它已经在react-native@0.46中消失了.
但它在运行测试和贡献中再次出现,我测试了运行npm run flow但没有工作,并且它没有说它如何使其工作.它可能是react-native文档中缺少的部分.
我需要的是使用react-native正确运行流程.每次重新加载页面时自动检查流程flow将是最好的.
我正在尝试使用多个http调用将数据存储在本地存储中.我使用forkJoin等待所有调用完成,然后我想恢复我的Promise.then调用链.我该怎么做呢?
updateCache() {
var cachesToUpdate;
return this.fetchServerTimestamps()
.then(res => {
var localTimestamps = this.getLocalTimestamps();
var serverTimestamps = this.getServerTimestamps();
//Compare timestamps and decide which cache data types to update
cachesToUpdate = this.cacheTypes.filter(function (cacheType) {
return localTimestamps ? localTimestamps[cacheType.timestamp] != serverTimestamps[cacheType.timestamp] : true;
});
}).then(res => {
//Request data and insert into cache
this.fetchData(cachesToUpdate)
.subscribe(res => {
res.forEach(function (item, index) {
this.insert(cachesToUpdate[index].messageType, JSON.stringify(item));
}.bind(this));
});
});
}
fetchData(cachesToUpdate): Observable<any> {
return forkJoin(cachesToUpdate.map(i => this.callservice.serverRead({ path: 'api/' + i.messageType })));
} …Run Code Online (Sandbox Code Playgroud) 如果不使用Redux,如何使用react导航选项卡导航器检测选项卡更改?
我知道我需要以某种方式使用onNavigationStateChange但我无法弄清楚如何更新当前视图.
export default () => <MyTabNav
ref={(ref) => { this.nav = ref; }}
onNavigationStateChange={(prevState, currentState) => {
//call function on current view
}}
/>;
Run Code Online (Sandbox Code Playgroud) react-native ×5
typescript ×3
angular ×2
javascript ×2
c# ×1
flowtype ×1
mongodb ×1
navigation ×1
observable ×1
promise ×1
raspberry-pi ×1
rxjs ×1
vue.js ×1
vuejs2 ×1