我有一个这样的组件:
<Parent>
<Child/>
</Parent>
Run Code Online (Sandbox Code Playgroud)
和<Child/>
组件有一个方法foo
.我想测试foo
方法,但我不知道如何访问它.我试过了:
mount(<Parent><Child/></Parent>).props().children.foo
Run Code Online (Sandbox Code Playgroud)
要么
mount(<Parent><Child/></Parent>).children().foo
Run Code Online (Sandbox Code Playgroud)
但他们都是undefined
.我无法使用,.instance()
因为它不是root.我无法挂载<Child/>
只是因为<Parent>
添加了一些东西(react-router's context.router
),context
而我在init时需要它们<Child/>
.有这个想法吗?
var onSuccess = function(imageUri){
$scope.report.imgUri = imageUri;
};
var onError = function(message){
alert('Failed because: ' + message);
};
$scope.capturePhoto = function(){
navigator.camera.getPicture(onSuccess, onError, {
quality: 40,
destinationType: navigator.camera.DestinationType.FILE_URI,
correctOrientation: true,
saveToPhotoAlbum: true,
encodingType: navigator.camera.EncodingType.PNG,
targetWidth: divWidth
});
};
Run Code Online (Sandbox Code Playgroud)
嗨伙计们,我正在使用Android 4.3在Samsung S3上构建Cordova 3.5.0.该camera.capturePhoto
功能始终忽略correctOrientation
设置,因此pic不会旋转到正确的方向.但它适用于Android 4.4的HTC Butterfly.BTW,encodingType
也不适用于Android.任何理想?
myApp.services.factory('GCMHelper', ($q)->
pushNotification = {}
_init = ()->
defer = $q.defer()
ionic.Platform.ready(()->
pushNotification = window.plugins.pushNotification;
window.onNotification = (res)->
console.log('onNotification', res)
defer.resolve()
)
return defer.promise
return {
register: ()->
_init().then(()->
pushNotification.register(
(res)->
console.log('gcm register success', res)
(err)->
console.log('gcm register err', err)
{
"senderID": "*********",
"ecb": "onNotification"
}
);
)
}
)
Run Code Online (Sandbox Code Playgroud)
在控制器中:
GCMHelper.register()
Run Code Online (Sandbox Code Playgroud)
(请原谅我可怜的英语)我将Cordova PushPlugin与Cordova 4.2和Ionic beta 14联系起来,每次用"OK"字符串获得成功回调,但ecb onNotification
从未被解雇,并且在控制台没有错误.我几乎没有理想......,任何一个帮助?
angularjs cordova google-cloud-messaging cordova-plugins ionic
cordova ×2
android ×1
angularjs ×1
enzyme ×1
ionic ×1
javascript ×1
react-router ×1
reactjs ×1