@@ -701,5 +701,62 @@ pluginTester({
701701 )
702702 `
703703 } ,
704+ {
705+ title : 'Should correctly detect dependency in square brackets' ,
706+ code : `
707+ import { View, Text } from 'react-native'
708+ import { StyleSheet } from 'react-native-unistyles'
709+
710+ export const Example = () => {
711+ return (
712+ <View style={styles.container}>
713+ <Text>Hello world</Text>
714+ </View>
715+ )
716+ }
717+
718+ const styles = StyleSheet.create((theme, rt) => ({
719+ container: {
720+ backgroundColor: theme.palette.purple[500]
721+ },
722+ container2: {
723+ paddingBottom: theme.spacing[rt.breakpoint]
724+ }
725+ }))
726+ ` ,
727+ output : `
728+ import { UnistylesShadowRegistry } from 'react-native-unistyles'
729+ import { View, Text } from 'react-native'
730+ import { StyleSheet } from 'react-native-unistyles'
731+
732+ export const Example = () => {
733+ return (
734+ <View
735+ style={[styles.container]}
736+ ref={ref => {
737+ UnistylesShadowRegistry.add(ref, [styles.container], undefined, [[]])
738+ return () => UnistylesShadowRegistry.remove(ref)
739+ }}
740+ >
741+ <Text>Hello world</Text>
742+ </View>
743+ )
744+ }
745+
746+ const styles = StyleSheet.create(
747+ (theme, rt) => ({
748+ container: {
749+ backgroundColor: theme.palette.purple[500],
750+ uni__dependencies: [0]
751+ },
752+ container2: {
753+ paddingBottom: theme.spacing[rt.breakpoint],
754+ uni__dependencies: [0, 3]
755+ }
756+ }),
757+ 664955283
758+ )
759+ `
760+ } ,
704761 ]
705762} )
0 commit comments