callstack / callstack/masked-view
Slow performance when using many masked views
- Dominant language
- JavaScript
- Stars
- 1.2k
- Forks
- 131
- PR merge metrics
- No merged PRs in 30d
Description
Here is a simple app which runs very slow on Android phone:
```js
import React from 'react';
import {ScrollView, StyleSheet, Text, View} from 'react-native';
import MaskedView from '@react-native-masked-view/masked-view';
const BOXES = 100;
const boxes = [];
for (let i = 0; i < BOXES; i++) {
boxes.push({id: i, text: `Box ${i}`});
}
function Box({box}) {
return (
}>
{box.text}
);
}
export default function App() {
return (
{boxes.map(box => (
))}
);
}
const styles = StyleSheet.create({
mask: {
flex: 1,
backgroundColor: 'black',
},
boxContainer: {
width: 250,
height: 250,
},
box: {
width: '100%',
height: '100%',
backgroundColor: 'lawngreen',
borderColor: 'black',
borderWidth: 1,
},
boxText: {
fontSize: 20,
},
});
```
Setting the `boxContainer` size affects the performance:
* `100x100`: app runs smoothly
* `200x200`: app is slow
* `500x500`: app crashes
Contributor guide
Research direction
The issue provides a React Native reproduction but names no repository file or test. Run the supplied app on Android with 100px, 200px, and 500px containers, then trace masked-view behavior for these cases; done means the reported slowdown and crash are addressed without breaking masking.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- mobile, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100