Skip to content

LazyVerticalGrid and LazyColumn preview not working #162

@Angelk90

Description

@Angelk90

Library Version

2.0.0-rc.2

React Native Version

0.85.3

React Version

19.2.3

Expo Version

56.0.5

Minimal Reproduction

I wanted to try using LazyVerticalGrid and LazyColumn, but when I test it in the preview I don't see anything, only the VoltraWidgetPreview is displayed.

Image
import { StatusBar, StyleSheet, useColorScheme, View } from 'react-native';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import {
  VoltraWidgetPreview,
} from '@use-voltra/android-client';
import { VoltraAndroid } from '@use-voltra/android'

function App() {
  const isDarkMode = useColorScheme() === 'dark';
  return (
    <SafeAreaProvider>
      <StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
      <View style={styles.container}>
        <MyWidgetPreview />
      </View>
    </SafeAreaProvider>
  );
}

function MyWidgetPreview() {
  const letters = Array.from({ length: 11 }, (_, i) =>
    String.fromCharCode(65 + i)
  );
  return (
    <VoltraWidgetPreview
      family="extraLarge"
      style={{ backgroundColor: '#1557ff', borderRadius: 4 }}
    >
      <VoltraAndroid.LazyVerticalGrid
        columns={3}
        horizontalAlignment="center-horizontally"
        verticalAlignment="center"
        style={{
          padding: 6,
        }}
      >
        {letters.map((letter, index) => (
          <VoltraAndroid.Box
            key={letter}
            style={{
              backgroundColor: index % 2 === 0 ? "#ffffff" : "#000000",
              borderRadius: 4,
              width: 100,
              height: 100,
              margin: 5,
            }}
            contentAlignment="center"
          >
            <VoltraAndroid.Text
              style={{
                color: index % 2 === 0 ? "#000" : "#fff",
              }}
            >
              {letter}
            </VoltraAndroid.Text>
          </VoltraAndroid.Box>
        ))}
      </VoltraAndroid.LazyVerticalGrid>
    </VoltraWidgetPreview>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
});

export default App;

Additional Information (Optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions