Tag: JavaScript

React-Native渲染多个图像

我正在尝试从奇迹api渲染多个图像。 这里是一个例子: "images": [ { "path": "http://i.annihil.us/u/prod/marvel/i/mg/e/00/52264475c3499", "extension": "jpg" }, { "path": "http://i.annihil.us/u/prod/marvel/i/mg/e/70/51fc0cb22a1ff", "extension": "jpg" }, { "path": "http://i.annihil.us/u/prod/marvel/i/mg/f/70/51fc0c8f4dee4", "extension": "jpg" }, { "path": "http://i.annihil.us/u/prod/marvel/i/mg/7/40/51f9695a3ee93", "extension": "jpg" } … 这里是一些代码: class Character extends Component { constructor(props) { super(props); } render() { let comic = this.props.character; return ( <View style={styles.container}> <Text>{comic.description}</Text> <Text style={styles.castTitle}>Characters in this comic:</Text> […]

如何在NativeScript中获取对self.view和self.view.frame的引用

我试图在iPad上的NativeScript中调用UIPrinterPickerController。 我跟踪了我需要做的事情,现在在这里: UIPrinterPickerController.presentFromRectInViewAnimatedCompletionHandler(rect: CGRect, view: UIView, animated: boolean, completion: (arg1: UIPrinterPickerController, arg2: boolean, arg3: NSError) => void): boolean; 在我看到的例子中, rect param是对self.view.frame的引用,而view param是对self.view的引用。 如何在NativeScript中find这些引用? 我已经尝试了ui.view模块,这是行不通的。 我已经尝试了pageLoaded事件args.object ,这是行不通的。 任何帮助,将不胜感激。 // My code here if ( ! UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiomPad) { found = printPicker.presentAnimatedCompletionHandler(false, completionHandler); } else { found = printPicker.presentFromRectInViewAnimatedCompletionHandler(view.frame, view, false, completionHandler); }

在React Native FBSDK中AccessToken的问题

我在使用React Native获取fbsdk中的AccessToken方面遇到了麻烦。 我正在调用Facebookbuild议的核心: const FBSDKCore = require('react-native-fbsdkcore'); const { FBSDKAccessToken, } = FBSDKCore; 在一个场景中,我尝试在日志中logging令牌,就像SO上这里所说的类似问题所build议的那样。 <View> <View style={{flex: 1, alignItems: 'center', padding: 50, marginTop: 250}}> <View> <LoginButton publishPermissions={["publish_actions"]} onLoginFinished={ (error, result) => { if (error) { alert("login has error: " + result.error); } else if (result.isCancelled) { alert("login is cancelled."); } else { FBSDKAccessToken.getCurrentAccessToken((token)=> { console.log(token); […]

是否可以访问移动设备的电池状态或通过Web浏览器的API充电?

我花了一些时间来看看是否有可能通过networking浏览器访问移动设备的电池状态或充电,但是甚至没有find任何资源,甚至没有讨论这个话题。 这使我相信这是不可能的,因为它不是在任何原因(安全?)的规格。 无论哪种方式,我发现有可能获得与iOS,cordova,Phonegap,Appcelerator等电池状态/电量的百分比..所有这些都有一个我可能能够工作的API可能为我正在寻找的工作发展。 但是,所有这些解决scheme仍然需要应用程序作为本机应用程序运行 – 我希望能够在设备上的浏览器中运行它。 这可能吗? 如果是这样,我应该看什么浏览器API?

如何从网页打开android应用程序?

我可以从HTML调用我的应用程序吗? 例如:我可以从我的应用程序正确调用网页的代码。 android代码: startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse( "myDomain.com"))); 并在我的网站做了一些事情后,我想再次打开我的Android应用程序。 我find这个代码, <a href="market://details?id=info.androidhive.slidingmenu"> 但它只是叫市场来find并安装应用程序!

为什么Chrome for iOS插入图片/ webp内容types?

我有一个移动的networking应用程序,通过$ .get()发出一个AJAX请求。 Safari iOS的请求成功,但状态为0且状态文本为“错误”的iOS iOS版本失败。 在我的服务器上使用tcpdump,我可以看到Safari发送/接收以下头文件: Accept: */* (outgoing) Content-Type: text/plain;charset=ISO-8859-1 (returning) Chrome for iOS在出站的Accept:标题中添加一个MIMEtypes的“image / webp”,返回的Content-Type为“image / webp”: Accept: */*,image/webp (outgoing) HTTP/1.1 200 OK Content-Type: image/webp (returning) 通过阅读jQuery代码,它看起来像$ .get()只parsingAJAX响应中的某些内容types,所以我在考虑一个图像MIMEtypes被拒绝,导致“错误”状态。 在iOS版Chrome的请求到达我的服务器时,还有这个标题: Via:1.1 Chrome-Compression-Proxy …这表示iOS版Chrome已经向Google代理服务器发送了请求,以处理请求(info https://support.google.com/chrome/answer/3517349?hl=zh-CN )。 看起来像这个代理服务器设置额外的内容types,不知何故内容types返回作为图像/ WebP在回来的路上? 服务器代码是RESTful Spring 3; 我在控制器代码中将内容types设置为“text / plain”,但不知何故,这并没有被采用,它仍然以“image / webp”的forms返回。 有没有人有类似的问题,并find了解决办法? 我需要返回Content-Type的“text / plain”才能正确地将数据返回给我的应用程序。 这个请求也适用于Android的Chrome以及AFAIK,没有做过tcpdump,但该应用程序正常工作; 只在iOS版Chrome上失败。

locking设备的风景方向

我正在做一个项目,我需要帮助如何locking移动设备上的横向。 我已经应用CSS媒体属性,他们让我改变的可见性,但我希望有一次,我在网页肖像模式,它不会允许改变它的方向infact它将locking任何。

实现500MB + WebSQL iOS Safari存储

有没有人有iOS7的主屏幕Web应用程序的“无限制”WebSQLfunction的任何数据? 使用存储滥用者我已经能够在我的主屏幕Safari Web应用程序中持续存储450MB,直到它在启动时不断崩溃。 我注意到它也不会要求用户许可,这太棒了。 还有人还有其他的经验吗? 好奇看看真正的上限是多less。

PhoneGap 2.1.0不适用于iOS 4.3.3

我已经开发了一个使用PhoneGap Build的hello world示例,它在iOS 5上工作正常,但在iOS 4.33上崩溃。 这里是崩溃日志: Incident Identifier: 96D8E936-F4A3-43C6-864E-5BE8631E454E CrashReporter Key: c2c95d63cf11603079ae85170ab939102266467f Hardware Model: iPhone2,1 Process: HelloWorld210 [305] Path: /var/mobile/Applications/8DFA1B8E-DF57-41F6-A504-261D2185358C/HelloWorld210.app/HelloWorld210 Identifier: HelloWorld210 Version: ??? (???) Code Type: ARM (Native) Parent Process: launchd [1] Date/Time: 2012-10-11 15:09:53.724 +0100 OS Version: iPhone OS 4.3.3 (8J2) Report Version: 104 Exception Type: EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x00000001, 0xe7ffdefe Crashed […]

removeClass在iOS上不起作用

当你点击.menuButton jquery将添加一个名为active的类。 这个Jquery代码可以在Windows和Android上运行,除了iOS(使用Chrome和Safari进行testing)。 HTML5 <div class="menuButton"> Menu Button </div> <div class="navmenu"> <ul> <li><a href="#">Home</a></li> <li><a href="#">Something</a></li> </ul> </div> jQuery的 var removeClassVar = true; $('.menuButton').on('click', function() { $('.navmenu').toggleClass('active'); removeClassVar = false; }); $('.navmenu').on('click', function() { removeClassVar = false; }); $(document).on('click', function() { if (removeClassVar == true) { $('.navmenu').removeClass('active'); } removeClassVar = true; }); CSS3 .menuButton { […]