react-native-ui-lib
react-native-ui-lib copied to clipboard
Refactor text to optimize performance
Description
Don't Merge, just review
I did a few things here
- Create new hooks:
useModifiersanduseThemeProps- this should help us replaceasBaseComponent - Added support in ThemeManager to set a ThemeContext - This should replace the static context type we set on UIComponent
- Refactor Text component to a function component to use the all of the above
Due to this big change, I left with some issues I had to resolve
- because
Animated.createAnimatedComponentcan't accept function components, only class components. I created a new (very) simple HOC calledasClassComponent. All it does is convert a function component to a class component (we need this for very rare cases, specifically in our WheelPicker.Item component) - I ignored a TS issue that now appears in FloatingPlaceholder component - I couldn't figure out a solution for this. If you have ideas, do share..
Changelog
Refactor and improve Text component performance