Using the hook useStyleSheet with ESlint Hook rules doesn't work. The code works when disabling the rule with // eslint-disable-next-line react-hooks/rules-of-hooks.
https://reactjs.org/docs/hooks-rules.html#eslint-plugin
import React from 'react';
import {
Layout,
Text,
useStyleSheet,
} from '@ui-kitten/components';
export const UseStyleSheetSimpleUsageShowcase = () => {
const styles = StyleSheet.create();
return (
<Layout style={styles.container}>
<Text category='h4' status='control'>
I use success color as background!
</Text>
</Layout>
);
};
const StyleSheet = useStyleSheet({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'color-success-default',
},
});
No warnings/errors should show up.
| Package | Version |
| ----------- | ----------- |
| @eva-design/eva | 4.4.0-beta.2 |
| @ui-kitten/components | 4.4.0-beta.2 |
System:
OS: macOS Mojave 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
Binaries:
Node: 12.13.1 - /usr/local/bin/node
Yarn: 1.21.1 - ~/.yarn/bin/yarn
npm: 6.13.6 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.0, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.6010548
Xcode: 11.0/11A420a - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz => 0.61.4
npmGlobalPackages:
react-native-cli: 2.0.1
This is why this version is beta.
There are few advices on how to make it better and currently we're looking for how to update it with less breaking changes
You can view conversation here: https://github.com/akveo/react-native-ui-kitten/pull/782
Thanks! I should have searched amongst existing the issues more before creating this one.
Let's keep it open so we can track the progress. Thanks for reporting