AddEventListener will not trigger in Android
See original GitHub issue splitImage (canvas, x, y, rows, cols) {
const {height, width} = Dimensions.get('screen')
const CanvasXSize = width / cols - 2
const CanvasYSize = (height / 2) / rows
canvas.width = CanvasXSize
console.log('CanvasXSize',CanvasXSize);
canvas.height = CanvasYSize
const ctx = canvas.getContext('2d')
const img = new CanvasImage(canvas)
img.src = "https://scontent-sin6-2.cdninstagram.com/t51.2885-15/s640x640/sh0.08/e35/21820297_280457069027480_5332287299113713664_n.jpg"
img.addEventListener('load', () => {
this.setState({ test: 'load' })
const imgW = img.width
console.log('imgW', imgW)
const imgH = img.height
const chunkWidth = imgW / cols
console.log('chunkWidth', chunkWidth)
const chunkHeight = imgH / rows
ctx.drawImage(
img,
x * chunkWidth,
y * chunkHeight,
chunkWidth,
chunkHeight,
0,
0,
CanvasXSize,
CanvasYSize
)
}, false)
}
I’m trying to split image based on the row and col and i manage to get everything working in ios but on android it can’t seem to trigger load event, did anyone know why and how to solve it?
Issue Analytics
- State:
- Created 6 years ago
- Comments:23 (12 by maintainers)
Top Results From Across the Web
addeventlistener does not work when browsing on Android?
I Googled this and came across this: AddEventListener works on the browser but does not on Android, however there is no accepted answer....
Read more >EventTarget.addEventListener() - Web APIs
Events that are bubbling upward through the tree will not trigger a listener designated to use capture. Event bubbling and capturing are two...
Read more >Input events overview - Android Developers
Even if an input method presents a keyboard-like interface, it will generally not trigger the onKeyDown() family of events.
Read more >Handling Events :: Eloquent JavaScript
Events and DOM nodes. Each browser event handler is registered in a context. In the previous example we called addEventListener on the window...
Read more >HTMLFormElement: submit event - Web APIs | MDN
The event is not sent to the form when calling the form.submit() method ... a form that does not pass validation triggers an...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We’re having some issues on Android in the current version. Will dig into it when I’ll have a chance as this might affect my projects as well.
yes, sure , fighting with one 😃))