magic-script-components icon indicating copy to clipboard operation
magic-script-components copied to clipboard

[ScrollView] aabb not working on lumin

Open grzegorzdec opened this issue 4 years ago • 0 comments

ScrollView parameter aabb is not working on the ZI simulator. I expected to limit the size of the scrollview.

Screenshot and code:

Screenshot 2020-04-07 at 10 22 17
import React from "react";
import {
  View,
  ScrollView,
  ScrollBar,
  Text,
  LinearLayout
} from "magic-script-components";

export class ExampleScrollView extends React.Component {
  render() {
    const alphabet = [
      "Alfa",
      "Bravo",
      "Charlie",
      "Delta",
      "Echo",
      "Foxtrot",
      "Golf",
      "Hotel",
      "India",
      "Juliett",
      "Kilo",
      "Lima",
      "Mike",
      "November",
      "Oscar",
      "Papa",
      "Quebec",
      "Romeo",
      "Sierra",
      "Tango",
      "Uniform",
      "Victor",
      "Whiskey",
      "X-ray",
      "Yankee",
      "Zulu"
    ];

    const aabb = {
      min: [-0.25, -0.45, -0.1],
      max: [0.25, 0.35, 0.1]
    };

    const calculateValue = (number, multiplier) =>
      ((number + 1 * multiplier) % 10) * 0.1;

    return (
      <View name="main-view">
        <Text
          alignment="center-center"
          text="Phonetic Alphabet"
          textAlignment="center"
          textSize={0.07}
          localPosition={[0, 0.4, 0]}
        />
        <ScrollView scrollBarVisibility="always" scrollBounds={aabb}>
          <ScrollBar length={0.6} thumbSize={0.03} orientation="vertical" />
          <LinearLayout
            defaultItemAlignment="center-left"
            defaultItemPadding={[0.01, 0.01, 0.01, 0.01]}
            orientation="vertical"
          >
            {alphabet.map((word, index) => (
              <Text
                textSize={0.05}
                key={index}
                text={`${word[0]} - ${word}`}
                textColor={[
                  calculateValue(index, 1),
                  calculateValue(index, 2),
                  calculateValue(index, 3),
                  0.8
                ]}
              />
            ))}
          </LinearLayout>
        </ScrollView>
      </View>
    );
  }
}

grzegorzdec avatar Apr 07 '20 08:04 grzegorzdec