我正在使用jquery-ui-maps和HTML5地理位置向用户显示位置列表,我需要利用用户的地理位置.
那么,这是用例,
我相信我已经将其缩小为一个Phonegap问题,其中GPS权限在应用程序加载时初始化,从未重新评估.
我的问题是,可以在应用程序的运行时启用GPS,还是Phonegap需要重新加载应用才能使用GPS?
我正在查看React-Native中的navigator组件,但无法接受已经在堆栈中的子节点.例如,如果我们以Facebook应用程序为例.用户可以搜索用户,然后单击"朋友",然后单击其他用户.当我尝试将错误添加到堆栈时,这会崩溃
Invariant Violation: Expected a component class, got [object Object].
Run Code Online (Sandbox Code Playgroud)
我通过标准导航器和当前的React-Native-Router尝试了这个.我目前的代码看起来像这样
class OptionsBranch extends Component {
render() {
/*<TouchableHighlight style={styles.spaceOut} onPress={() => {this.props.toRoute({name:"test", component:UserProfile})}}><Text>[push]</Text></TouchableHighlight>*/
return (
<View style={styles.container}>
<Text>[OptionsScreen]</Text>
<TouchableHighlight style={styles.spaceOut} onPress={() => {this.props.toRoute({id:"x", name:"test", component:UserProfile})}}><Text>[push]</Text></TouchableHighlight>
<TouchableHighlight style={styles.spaceOut} onPress={() => {this.props.toBack()}}><Text>[pop]</Text></TouchableHighlight>
</View>
);
}
}
Run Code Online (Sandbox Code Playgroud)
只要我从不重复使用课程,我就能无限期地工作.我做的那一刻,我得到了错误.
我会发布链接到研究,但除了框架中包含的样本之外,Navigator(而不是NavigatorIOS)没有多少,他们似乎实现了ti,但没有通过我需要的完整路线.
例如
<NavButton onPress={() => { navigator.push(_getRandomRoute()) }} text="Push"/>
Run Code Online (Sandbox Code Playgroud)
如果我尝试在我的代码中使用它(没有React-Native-Router),即
<TouchableHighlight onPress={() => { this.props.navigator.push({ name:"myComponent", component:myComponent }) }} />
Run Code Online (Sandbox Code Playgroud)
它也错了.
为什么是这样?这是Navigator的限制吗?这是我的代码中的错误吗?
使用TabBar和Navigator的Boiler plate应用可能非常有用.NavigatorIOS对定制有点限制.
我正在尝试将应用程序国际化,并且需要测试它在其他语言环境中的行为方式.
但是,即使我在Chrome和OS X中更改了语言设置,也navigator.language始终会返回en-US.
我可以对浏览器做什么强制navigator.language返回类似的东西es-MX?
澄清
我试图通过GUI,而不是代码,以用户身份进行更改.
我使用的是真正的Android设备(版本5.1)
我能够确定使用反应 - 原生地图(我的应用程序内的地图正确蓝点位置)+我能够使用谷歌地图应用程序,并转到我的位置(GPS工作)我的位置.
我正在使用一个大的超时,将enableHighAccuracy切换为true和false,删除选项等等.都没能得到navigator.geolocation来获取数据.
这是我的代码:
var options = {
enableHighAccuracy: true,
timeout: 5000,
maximumAge: 0
};
function success(pos) {
var crd = pos.coords;
console.log('Your current position is:');
console.log(`Latitude : ${crd.latitude}`);
console.log(`Longitude: ${crd.longitude}`);
console.log(`More or less ${crd.accuracy} meters.`);
};
function error(err) {
console.warn(`ERROR(${err.code}): ${err.message}`);
};
navigator.geolocation.getCurrentPosition(success, error, options);
Run Code Online (Sandbox Code Playgroud)
我正进入(状态 : ERROR(3): Location request timed out
android geolocation navigator react-native react-native-maps
我在这里找到了中间件的“GlobalKey NavigatorState”解决方案,但无法克服错误“The method 'pushedNamed' was called on null”。然后我找到了这个替代解决方案来使用单独的类和静态变量来解决这个问题,但它产生了同样的错误。 我真正需要的是一个非常基本的设置示例以及如何在其他地方调用“pushedNamed”函数。
当前代码
在单独的文件夹中初始化 GlobalKey:
class NavKey{
static final navKey = new GlobalKey<NavigatorState>();
}
Run Code Online (Sandbox Code Playgroud)
主要.dart:
import 'package:eumag/assets/tools/route_navigation_constants.dart';
...
@override
Widget build(BuildContext context) {
return StoreProvider<AppState>(
store: store,
child: MaterialApp(
theme: ThemeData.dark(),
navigatorKey: NavKey.navKey,
routes: <String, WidgetBuilder>{
ROUTE_LOGIN_PAGE: (BuildContext context) => LoginPage(store),
ROUTE_MAIN_PAGE: (BuildContext context) => MainPage(store),
},
home: StoreBuilder<AppState>(
builder: (BuildContext context, Store<AppState> store) =>
LoginPage(store),
),
),
);
}
Run Code Online (Sandbox Code Playgroud)
中间件.dart:
import …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Permissions API:https : //developer.mozilla.org/en-US/docs/Web/API/Permissions/query Firefox 应该支持它。(我目前使用的是Firefox Developer Edition 66.0b14)。
我有一个页面,我最初在其中检查用户权限。就像是;
if (navigator.permissions) {
navigator.permissions.query({ name: 'geolocation' }).then(result => {
if (result.state === 'granted') {
this.getCurrentPosition()
} else if (result.state === 'prompt') {
this.getCurrentPosition()
console.log('Permissions requested. Waiting for user input...')
} else if (result.state === 'denied') {
this.locationError = true
}
result.onchange = event => {
if (event.target.state === 'granted') {
this.locationError = false
this.getCurrentPosition()
console.log('Thanks for letting us know...')
} else if (event.target.state === 'denied') { …Run Code Online (Sandbox Code Playgroud) 在此应用程序中,当用户单击登录页面时导航到主页,但当用户按主屏幕上的后退按钮时,页面将导航到登录,因此这不是正确的流程
我尝试 navigator.pushReplacement 但是当用户在主屏幕上的应用程序关闭时按下后退按钮并转到后台时,当用户从后台打开该应用程序然后显示主屏幕时,它会显示登录屏幕,所以请提供建议,
这是我的代码登录屏幕
Future<void> login(
String emailId, String password, String accessToken) async {
final dio = Dio(); // Provide a dio instance
String token = AppStrings.keyBearer + accessToken;
var customHeaders = {
AppStrings.authorization: token,
AppStrings.keyContentType: AppStrings.valueContentType
};
dio.options.headers.addAll(customHeaders);
final client = RestClient(dio);
await client
.loginUser(LoginUser(
deviceToken: AppStrings.valueDeviceToken,
lastLoginPlatform: AppStrings.valuePlatform))
.then((res) {
if(res.interests.isEmpty){
AppHelper.showToastMessage(
AppStrings.message_logged_in_successfully);
Navigator.of(context, rootNavigator: true).pop();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => InterestsPage(
userAccesstoken: accessToken,
)));
}
else{
AppHelper.showToastMessage(
AppStrings.message_logged_in_successfully);
Navigator.of(context, rootNavigator: true).pop();
Navigator.push(
context,
MaterialPageRoute(
builder: …Run Code Online (Sandbox Code Playgroud) 我正在将代码从 更改为WillPopScope来PopScope捕获后退按钮的按下情况。我需要在返回上一屏幕之前显示一个对话框。因此,我需要发出Navigator.pop两次,一次关闭对话框,另一次返回上一个屏幕。下面的代码可以正常工作,但是当我将其更改为“since is depreciated”时,会抛出WillPopScope错误 。'!_debugLocked': is not truePopScopeWillPopScope
// return WillPopScope(\nreturn PopScope(\n canPop:true,\n onPopInvoked: (bool didPop) async{\n // onWillPop: () async {\n if (vStatus[1] && !vStatus[2]) {\n _showMaterialDialog(context, 1);\n }\n return Future.value(true);\n },\n child: Scaffold(\n \xe2\x80\xa6\xe2\x80\xa6.\n\n\nvoid _showMaterialDialog(BuildContext context, int opt) {\n showDialog(\n context: context,\n builder: (context) {\n return AlertDialog(\n title: Text(getTextTitle(opt),style:TextStyle(fontFamily: 'DancingScriptBold',color:Colors.blue, fontSize: 20.0)),\n content: Text(getTextContent(opt),\n style: const TextStyle(\n fontFamily: 'DancingScriptBold', color:Colors.blue,fontSize: 20.0),\n ),\n actions: <Widget>[\n TextButton(\n onPressed: …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用以下代码与 Web Share API Level 2 共享文件:
var file = new File(["foo"], "foo.txt", {
type: "text/plain",
});
window.navigator.share({
text: "Share text",
title: "Share title",
files: [file]
})
Run Code Online (Sandbox Code Playgroud)
不幸的是,文件未与 iPhone 共享,但在 Android 上成功共享。
有什么解决办法吗?
提前致谢。
我有一堆我永远不会使用的应用程序(GLueviz、Orange3、Rstudio),我想从我的“主页”选项卡中删除它们。它们未安装,但无法删除应用程序的磁贴。齿轮图标不会为我做这件事。
我深入研究了配置文件~/.anaconda/navigator/anaconda-navigator.ini,那里没有任何明显的东西。奇怪的是,它说vscode_enable = FalseVS Code 确实显示为 tile。
我在 MacOS Catalina 上运行 1.9.12 个人版。
navigator ×10
flutter ×3
geolocation ×3
javascript ×3
android ×2
ios ×2
react-native ×2
anaconda ×1
cordova ×1
firefox ×1
navigation ×1
safari ×1
web ×1